GK at ninebynine.org
Sun Nov 28 12:18:26 EST 2004
I use (an extended version of) the CFilter framework to perform namespace,
xml:lang and xml:base processing in my revised version of HaXml. Maybe my
code  might provide some clues for you?
Look for function 'applyNamespaces'.
The function 'buildNamespaces' illustrates my extension to the CFilter
framework, which allows an XML document to be transformed into a new
document type containing additional information about the XML elements.
'processNamespaces' actually applies the transformations, using function
'docReplaceContent' which is defined in . Maybe this module has the
clues you're after?
At 15:33 27/11/04 +0000, Dominic Steinitz wrote:
>I'd be grateful for some help on using HaXml.
>1. I can parse a String into a Document but it's not clear how you operate on
>it as the combinators all operate on Content. The only function I could find
>that operated on a Document was "document" in Pretty.
>2. I can construct a CFilter but it's not clear how you operate on it. How do
>I calculate the number of components of an Element? What I would like to do
>is accept "vname" (with 3 elements) and reject "iname" (with 4 elements). I'd
>also like to check that the characters in givenName, initial and familyName
>are in a given range (for example upper case or between ' ' and '~').
> "<Name><givenName>John</givenName>" ++
> "<initial>P</initial>" ++
> "<familyName>Smith</familyName>" ++
>d = document $ xmlParse "tmp" xmlName
>gn = mkElemAttr "givenName"  [literal "John"]
>i = mkElemAttr "initial"  [literal "P"]
>fn = mkElemAttr "familyName"  [literal "Smith"]
>validName = mkElemAttr "Name"  [gn,i,fn]
>invalidName = mkElemAttr "Name"  [gn,i,i,fn]
>vname = processXmlWith validName
>iname = processXmlWith invalidName
>Haskell mailing list
>Haskell at haskell.org
More information about the Haskell