q       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ R S T U V W X!Y!Z![!\!]!^!_"`"a"b"c"d"e"f"g"h"i"j"k"l"m"n"o"p"q"r"s"t"u"v"w"x"y"z"{"|"}"~"""""""""""""""""""""""######################$$$$$$$$$$$$$$$$$$$$$$$$$$$$%%%%%%&&&&&&&&&&&&&&&&&&&&'''''''''''''''''''''''''''''''''((((((( ( ( ( ( (((((((((((((())))* *!*"*#+$+%,&,',(,),*,+,,,--.-/-0.1.2.3/4/5/6/7/8090:0;0<0=0>0?0@0A0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V0W0X0Y0Z0[0\0]0^0_0`0a0b0c0d0e0f0g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0{0|0}0~0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011122222222222222 2 2 2 2 2222222222222222222 2!2"2#2$2%2&2'2(2)2*2+2,2-2.2/202122232425262728292:2;2<2=2>2?2@2A2B2C2D2E2F2G2H2I2J2K2L2M2N2O2P2Q2R2S2T2U2V2W2X2Y2Z2[2\2]2^2_2`2a2b2c2d2e2f2g2h2i2j2k2l2m2n2o2p2q2r2s2t2u3v3w3x3y3z3{3|3}3~3333333333333444444444444444444444444444444444444445555555555555555555555555555555555555555555555555555556666666666666777777777777777777777 7 7 7 7 7777777888888888888 9!9"9#9$9%9&9'9(9)9*9+9,9-:.:/:0:1:2:3:4:5:6:7:8:9:::;:<:=:>:?;@;A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;[;\;];^;_;`<a<b=c=d>e?f@gAhBiBjBkBlBmBnBoCpCqCrCsCtCuCvCwCxCyCzC{C|C}C~CCCDDDDDDDEFFFFFGHHHHHHHIIIIJJJJJJKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLMMMMMMMMMMMMMMMMMMMM M M N NRportablestableUwe Schmidt (uwe@fh-wedel.de)!parse a single Unicode character parse a XML name character !parse a XML name start character parse a XML NCName character #parse a XML NCName start character parse a XML letter character White Space (2.3) 8end of line handling (2.11) will be done before or with  parser White Space Normalization end of line handling (2.11)  #x0D and #x0D#x0A are mapped to #x0A    portable experimentalUwe Schmidt (uwe@fh-wedel.de)#Data type for regular expressions. 2Constructs a regular expression for an empty set. % 1.parameter errMsg : error message / returns : regular expression for an empty set 7Constructs a regular expression for an empty sequence. 4 returns : regular expression for an empty sequence 7Constructs a regular expression for accepting a symbol . 1.parameter sym : the symbol to be accepted 5 returns : regular expression for accepting a symbol @Constructs a regular expression for accepting any singel symbol > returns : regular expression for accepting any singel symbol >Constructs an optional repetition (*) of a regular expression 6 1.parameter re_a : regular expression to be repeted " returns : new regular expression  remove redundant nested *'s in RE % theoretically this is unneccessary, G but without this simplification the runtime can increase exponentally L when computing deltas, e.g. for a** or (a|b*)* which is the same as (a|b)* 4Constructs a repetition (+) of a regular expression 6 1.parameter re_a : regular expression to be repeted " returns : new regular expression 1Constructs an option (?) of a regular expression 7 1.parameter re_a : regular expression to be optional " returns : new regular expression !5Constructs a sequence (,) of two regular expressions : 1.parameter re_a : first regular expression in sequence ; 2.parameter re_b : second regular expression in sequence " returns : new regular expression "9Constructs an alternative (|) of two regular expressions = 1.parameter re_a : first regular expression of alternative > 2.parameter re_b : second regular expression of alternative " returns : new regular expression #;Checks if a regular expression matches the empty sequence. nullable e == [] `in` L(e) HThis check indicates if a regular expression fits to a sentence or not. 4 1.parameter re : regular expression to be checked B returns : true if regular expression matches the empty sequence,  otherwise false 9Derives a regular expression with respect to one symbol. L(delta e x) = x  L(e) 4 1.parameter re : regular expression to be derived J 2.parameter sym : the symbol on which the regular expression is applied * returns : the derived regular expression $9Derives a regular expression with respect to a sentence. & 1.parameter re : regular expression F 2.parameter s : sentence to which the regular expression is applied * returns : the derived regular expression %HChecks if an input matched a regular expression. The function should be  called after matches. Was the sentence used in matches, in the language of the regular expression?  -> matches e s == s `in` L(e)? 2 1.parameter re : the derived regular expression K returns : empty String if input matched the regular expression, otherwise , an error message is returned &<Constructs a string representation of a regular expression. ( 1.parameter re : a regular expression ? returns : the string representation of the regular expression  !"#$%& !"%$#&  !"#$%&'Cthe table with the mapping from file name extensions to mime types '''portable experimentalUwe Schmidt (uwe@fh-wedel.de)()*+,-./0123456789()*+,-./0123456789(*+,-./012)3456789()*+,-./0123456789portablestableUwe Schmidt (uwe@fh-wedel.de):Oremove leading and trailing whitespace with standard Haskell predicate isSpace ;Cconvert string to uppercase with standard Haskell toUpper function <Cconvert string to lowercase with standard Haskell toLower function =?find all positions where a string occurs within another string >5find the position of the first occurence of a string ?4find the position of the last occurence of a string @Removes leading /( trailing whitespaces and leading zeros A3Reduce whitespace sequences to a single whitespace B'replace all whitespace chars by blanks C(Escape all disallowed characters in URI  references (see  )http://www.w3.org/TR/xlink/#link-locators) Descape XML chars &lt;, &gt;, &Equot;, and ampercent by transforming them into character references  see also : F Eescape XML chars &`lt; and ampercent by transforming them into character references, used for escaping text nodes  see also : F FYescape XML chars in attribute values, same as stringEscapeXml, but none blank whitespace  is also escaped  see also : D GH3convert a string of hexadecimal digits into an Int I'convert a string of digits into an Int JDconvert a string into a hexadecimal string applying charToHexString  see also : K K8convert a char (byte) into a 2-digit hexadecimal string  see also : J, L L6convert a none negative Int into a hexadecimal string  see also : K M]take all elements of a list which occur more than once. The result does not contain doubles.  (doubles . doubles == doubles) N:drop all elements from a list which occur more than once. Oremove duplicates from list PQRS)mothers little helpers for to much curry T:;<=>?@ABCDEFGHIJKLMNOPQRST:<;=>?@ABCEDFGJKLHIMNOPQRST:;<=>?@ABCDEFGHIJKLMNOPQRSTportable experimentalUwe Schmidt (uwe@fh-wedel.de)LUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~&the predefined namespace uri for xml: "http:// www.w3.org/XML/1998/ namespace" (the predefined namespace uri for xmlns: "http:// www.w3.org/2000/xmlns/" Relax NG namespace LUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~LVUXWZ[\]^_`abdcefghijYnoklpqrsuvwxtyzm|}~{LUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~5Try to extract charset spec from Content-Type header  e.g. "text/html; charset=ISO-8859-1" 8Sometimes the server deliver the charset spec in quotes  these are removed  portable experimentalUwe Schmidt (uwe@fh-wedel.de),1Namespace of the W3C XML schema datatype library ,,, =list of predefined XML entity names and their unicode values  Btable with all XHTML entity refs and corresponding unicode values  portablestableUwe Schmidt (uwe@fh-wedel.de)"check whether file exists, if not * try to unescape filename and check again  return the existing filename  7Selectors for pairs and 3-tuples: comp1, comp2, comp3, " this can be extended to n-tuples DA Selector is a pair of an access function and a modifying function 4 for reading and updating parts of a composite type Alias for constructor S  non-portable experimentalUwe Schmidt (uwe\@fh-wedel.de) #the internal cache for the strings (insert a bytestring into the atom cache creation of an Atom from a String /The internal operation running in the IO monad  Insert a String6 into the atom cache and convert the atom back into a String.  locically  share == id< holds, but internally equal strings share the same memory. portablestableUwe Schmidt (uwe@fh-wedel.de)lookup with default value 7lookup with empty list (empty string) as default value test for existence of a key ladd an entry, remove an existing entry before adding the new one at the top of the list, addEntry is strict !add a whole list of entries with  $delete an entry, delEntry is strict delete a list of entries with  portable experimentalUwe Schmidt (uwe\@fh-wedel.de)The interface for trees Xtree construction: a new tree is constructed by a node attribute and a list of children leaf construction: leafs don't have any children  definition:  mkLeaf n = mkTree n []  #leaf test: list of children empty? innner node test:  not . isLeaf  select node attribute select children edit node attribute edit children substitute node: " setNode n = changeNode (const n)  substitute children: , setChildren cl = changeChildren (const cl)  fold for trees all nodes of a tree depth of a tree number of nodes in a tree &format tree for readable trace output a  graphical+ representation of the tree in text format =convert a tree into a pseudo graphical string representation =multi parameter classes and functional depenedencies required experimentalUwe Schmidt (uwe\@fh-wedel.de)>The interface for accessing and changing the state component. BMulti parameter classes and functional dependencies are required. 9change the state of a state arrow by applying a function = for computing a new state from the old and the arrow input.  Result is the arrow input 7access the state with a function using the arrow input ) as data for selecting state components. ,read the complete state, ignore arrow input  definition:  getState = accessState (\ s x -> s)  overwrite the old state  definition:  setState = changeState (\ s x -> x)  5change state (and ignore input) and return new state convenience function, 1 usefull for generating e.g. unique identifiers: #example with SLA state list arrows  newId :: SLA Int b String  newId = nextState (+1)  >>>  arr (('#':) . show)  0 runSLA 0 (newId <+> newId <+> newId) undefined  = ["#1", "#2", "#3"] portable experimentalUwe Schmidt (uwe\@fh-wedel.de)$Edit operation on navigatable trees PThere is only a single navigatable tree implementation for a given tree allowed # (see the functional dependencies) <add an ordinary tree in front of the given navigatable tree :add an ordinary tree behind of the given navigatable tree @drop the direct left sibling tree of the given navigatable tree Adrop the direct right sibling tree of the given navigatable tree  *change the tree but remain the navigation  0Conversion between trees and navigatable trees, PThere is only a single navigatable tree implementation for a given tree allowed # (see the functional dependencies)  construct a navigatable tree  remove navigation  $The interface for navigatable trees move one step towards the root 'descend one step to the leftmost child move to the left neighbour move to the right neighbour                   portable experimentalUwe Schmidt (uwe\@fh-wedel.de)Jcollect all trees by moving into one direction, starting tree is included Ncollect all trees by moving into one direction, starting tree is not included XPath axis: parent XPath axis: ancestor XPath axis: ancestor or self XPath axis: child XPath axis: descendant XPath axis: descendant or self Znot an official XPath axis but useful: reverse descendant or self, used in preceding axis XPath axis: following sibling XPath axis: preceeding sibling XPath axis: self XPath axis: following XPath axis: preceding  move to the root ! ! ! !portable experimentalUwe Schmidt (uwe\@fh-wedel.de)"dA class of types that can be partially evaluated, but evaluation can be propagated deeper than WHNF #&Default for rwnf is reduction to WHNF $Default for rwnf2 is rwnf %&'"#$%&'%&'"#$"#$#$%&'portablestableUwe Schmidt (uwe\@fh-wedel.de)('shortcut for a sequence of n-ary trees ) n-ary ordered tree (rose trees) Aa tree consists of a node and a possible empty list of children. > If the list of children is empty, the node is a leaf, else it's  an inner node. (NTree implements Eq, Ord, Show and Read *Implementation of Data.Tree.Class interface for rose trees NTree implements class Functor ()*)*(()**portable experimentalUwe Schmidt (uwe\@fh-wedel.de)+:editNTreeBottomUp is a space optimized tree edit function JThe nodes in a tree are visited bottom up. An edit function is applied to K all nodes. A Nothing result of the editing function indicates no changes. A This is used to share the input tree within the resulting tree. The following law holds:  , editNTreeBottomUp (const Nothing) t == [t] GIn this case the resulting tree does not only represent the same value L but it is the same machine value (relative to some evaluations of closures  during the tree walk OWith a simple fold like editing function the whole tree would be reconstructed  in memory ,!A space optimized map for NTrees @Subtrees, that are not changed are reused in the resulting tree  See also: editNTreeBottomUp +,+,+,portablestableUwe Schmidt (uwe\@fh-wedel.de)-VOne unzipped step consists of the left siblings, the node info and the right siblings ./@The list of unzipped nodes from a current tree back to the root 0Zipper for rose trees RA zipper consist of the current tree and the branches on the way back to the root 12347Conversion of a rose tree into a navigatable rose tree 5BConversion of a navigatable rose tree into an ordinary rose tree. QThe context, the parts for moving up to the root are just removed from the tree. V So when transforming a navigatable tree by moving around and by changing some nodes,  one has to navigate back : to the root, else that parts are removed from the result 6789:;<=>?-./0123456789:;<=>?0123/-.456789:;<=>?-../0123123456789:;<=>?portablestableUwe Schmidt (uwe@fh-wedel.de)D@3Namespace support for element and attribute names. 9A qualified name consists of a name prefix, a local name  and a namespace uri. : All modules, which are not namespace aware, use only the I component. F When dealing with namespaces, the document tree must be processed by 0Text.XML.HXT.Arrow.Namespace.propagateNamespaces  to split names of structure "prefix:localPart"6 and label the name with the apropriate namespace uri  ABCDMType for the namespace association list, used when propagating namespaces by  modifying the @ values in a tree E[XML names are represented by Strings, but these strings do not mix up with normal strings. Y Names are always reduced to normal form, and they are stored internally in a name cache 4 for sharing equal names by the same data structure !"FGHIJKset name prefix Lset local part Mset name prefix Nbuilds the full name "prefix:localPart";, if prefix is not null, else the local part is the result O7functional list version of qualifiedName used in xshow P builds the " universal"1 name, that is the namespace uri surrounded with "{" and "}" followed by the local part  (specialisation of R) Q builds an " universal"b uri, that is the namespace uri followed by the local part. This is usefull for RDF applications, b where the subject, predicate and object often are concatenated from namespace uri and local part  (specialisation of R) R{builds a string from the namespace uri and the local part. If the namespace uri is empty, the local part is returned, else d namespace uri and local part are combined with the combining function given by the first parameter #STQconstructs a simple name, with prefix and localPart but without a namespace uri.  see also V, U U-constructs a simple, namespace unaware name.  If the name is in prefix:localpart" form and the prefix is not empty # the name is split internally into  a prefix and a local part. V*constructs a complete qualified name with H, I and J. K This function can be used to build not wellformed prefix:localpart names. + The XPath module uses wildcard names like xxx:*. These must be build with V  and not with mkName. W old name for U XUconstructs a simple, namespace aware name, with prefix:localPart as first parameter,  namspace uri as second.  see also U, T YUEquivalent QNames are defined as follows: The URIs are normalized before comparison.  Comparison is done with [ and Z Z.Comparison of normalized namespace URIs using \ [*Sometimes a weaker equality relation than  equalQName8 is appropriate, e.g no case significance in names, ... Y a name normalization function can be applied to the strings before comparing. Called by  equalQName and  Y \^Normalization of URIs: Normalization is done by conversion into lowercase letters. A trailing "/" is ignored ]DCompute the name prefix and the namespace uri for a qualified name. MThis function does not test whether the name is a wellformed qualified name.  see Namespaces in XML Rule [6] to [8]2. Error checking is done with separate functions,  see ` and _ for error checking. ^#test for wellformed NCName, rule [4] XML Namespaces _"test for wellformed QName, rule [6] XML Namespaces  predicate is used in filter valdateNamespaces. `"test for wellformed QName values. g A QName is wellformed, if the local part is a NCName, the namePrefix, if not empty, is also a NCName.  predicate is used in filter valdateNamespaces. a@test whether an attribute name is a namesapce declaration name. 2 If this is not the case True is the result, else 0 the name must be a well formed namespace name: & All namespace prefixes starting with "xml"+ are reserved for XML related definitions.  predicate is used in filter valdateNamespaces. b,test for a namespace name to be well formed c>test whether a name is a namespace declaration attribute name dpredicate is used in filter valdateNamespaces. e$1the internal cache for QNames (and name strings) %fghij&k'()*+lm,-./TTwo QNames are equal if (1. case) namespaces are both empty and the qualified names T (prefix:localpart) are the same or (2. case) namespaces are set and namespaces and  local parts are equal .@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm1@ABCEFDVUXWTYZ[HIJlfGmSBACMLKNOPQR\]^_`abcdijghke.@ABCABCDEFFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmportablestableUwe Schmidt (uwe@fh-wedel.de)*no>data type for representing a set of nodes as a tree structure Ethis structure is e.g. used to repesent the result of an XPath query D such that the selected nodes can be processed or selected later in  processing a document tree pqis this node part of the set ? rthe set of attribute nodes s>the set of child nodes, a list of pairs of index and node set tAttribute list 8used for storing option lists and features of DTD parts u5Binary large object implemented as a lazy bytestring vRepresents a DTD element w(for Parameter Entity References in DTDs x attr: name Ffor lists of names in notation types or nmtokens in enumeration types y-for INCLUDEs, IGNOREs and peRefs: attr: type  type = INCLUDE, IGNORE or %...; zfor notations {"for parameter entity declarations |for entity declarations } attributes:  name - name of element value - name of attribute type: "CDATA" | "ID" | "IDREF" | "IDREFS" | "ENTITY" | "ENTITIES" | "NMTOKEN" | "NMTOKENS" |"NOTATION" | "ENUMTYPE" kind: "REQUIRED\" | \"IMPLIED" | "DEFAULT" ~element content attr: kind, modifier  modifier: "" | "?" | "*" | "+" kind: seq | choice attr: name, kind name: element name kind: "EMPTY" | "ANY" | "#PCDATA" | children | mixed :attr: name, system, public, XDTD elems as children Represents elements "error message with level and text Iattribute with qualified name, the attribute value is stored in children 5DTD element with assoc list for dtd element features Dtag with qualified name and list of attributes (inner node or leaf) ;Processing Instr with qualified name (leaf)  with list of attributes. % If tag name is xml, attributs are "version", "encoding", " standalone", > else attribute list is empty, content is a text child node ;CDATA section (leaf) ;comment (leaf) ;entity reference (leaf) ;character reference (leaf) ;text represented more space efficient as bytestring (leaf) ;ordinary text (leaf) .List of navigatable rose trees with XML nodes %Navigatable rose tree with XML nodes "List of rose trees with XML nodes !Rose tree with XML nodes (XNode) "Evaluate an assoc list of strings no error, everything is ok %Error level for XError, type warning #Error level for XError, type error )Error level for XError, type fatal error `@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~*v~}|{zyxwutopqrsn*nopqrspqrstuv ~}|{zyxwwxyz{|}~ OportablestableUwe Schmidt (uwe@fh-wedel.de)0123456789:;<=>?@ABCDEF()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~portablestableUwe Schmidt (uwe@fh-wedel.de)Q)weak normalform versions of constructors e()*QQ<portablestableUwe Schmidt (uwe@fh-wedel.de)?GHIJK     LM 8      8      8      portable experimentalUwe Schmidt (uwe@fh-wedel.de)!"#$%&'(!"#$%&'(!"#$%&'(!"#$%&'(portablestableUwe Schmidt (uwe@fh-wedel.de)N)&convert a list of trees into a string  see also : xmlTreesToText for filter version, #Text.XML.HXT.Parser.XmlParsec.xread for the inverse operation *>convert an XML tree into a binary large object (a bytestring) +%convert a list of trees into a blob. 5Apply a quoting function for XML quoting of content, + a 2. quoting funtion for attribute values 0 and an encoding function after tree conversion ,OPQRSTUVWXYZ[\]^_`a)*+,)*+,)*+,portablestableUwe Schmidt (uwe@fh-wedel.de)-.bcde-..--.portable experimentalUwe Schmidt (uwe@fh-wedel.de)4/01fg2hi3jk45678l9:;mn<=>opqrs?@tuAvBCthe inverse function to ), (for XML content). <the string parameter is parsed with the XML content parser. S result is the list of trees or in case of an error a single element list with the D error message as node. No entity or character subtitution is done.  see also: D Dthe filter version of C Ea more general version of D. ; The parser to be used and the context are extra parameter FwGH<general parser for parsing arbitray parts of a XML document IParser for parts of a DTD JParser for general entites K7Parser for entity substitution within attribute values LParser for NMTOKENs MParser for XML names N"try to parse a xml encoding spec. : 1.parameter encParse : the parser for the encoding decl % 2.parameter root : a document root 1 returns : the same tree, but with an additional " attribute "encoding" in the root node 9 in case of a valid encoding spec 0 else the unchanged tree OP"/0123456789:;<=>?@ABCDEFGHIJKLMNOP"/0123456789:;<=>?@ABCDPFINOKJHELMG"/0123456789:;<=>?@ABCDEFGHIJKLMNOP portablestableUwe Schmidt (uwe@fh-wedel.de)*xyzQ{RS|}~TUVWQRSTUVWQRSTVWUQRSTUVW!portable experimentalUwe Schmidt (uwe@fh-wedel.de):XYZ[\]^=parse a tokenized DTD declaration represented by a DTD tree. b The content is represented by the children containing text and parameter entity reference nodes. c The parameter entity reference nodes contain their value in the children list, consisting of text f and possibly again parameter entity reference nodes. This structure is build by the parameter entity  substitution. n Output is again a DTD declaration node, but this time completely parsed and ready for further DTD processing 7collect the tokens of a DTD declaration body and build J a string ready for parsing. The structure of the parameter entity values N is stll stored in this string for checking the scope of the parameter values XYZ[\]^^]\XYZ[XYZ[\]^"portable experimentalUwe Schmidt (uwe@fh-wedel.de)6_`abcdef/The datatype for modelling the structure of an ghijklmnopqrstu-test: is schema a simple XML Schema datatype v+test: is type a fixed value attribute type wxyz{|}~1access an attribute of a descr of an atomic type 6_`abcdefghijklmnopqrstuvwxyz{|}~;ftrqmkjigssnoplplplhed_`abcuvwxyz{|}~6_`abc`abcdeftrqmkjigssnoplplplhghijklmnopqrstuvwxyz{|}~#portable experimentalUwe Schmidt (uwe@fh-wedel.de)"convert a DTD descr into XmlTrees *convert a pickler schema into a DTD descr $portable experimentalUwe Schmidt (uwe\@fh-wedel.de)The interface for list arrows Only mkA,  '(>>.)' don't have default implementations :construction of a 2 argument arrow from a binary function  |  | example:  a1 &&& a2 >>> arr2 f  9construction of a 3 argument arrow from a 3-ary function  |  | example:  a1 &&& a2 &&& a3 >>> arr3 f  9construction of a 4 argument arrow from a 4-ary function  |  | example:  a1 &&& a2 &&& a3 &&& a4 >>> arr4 f  ?construction of a 2 argument arrow from a singe argument arrow Cconstructor for a list arrow from a function with a list as result .constructor for a list arrow with 2 arguments constructor for a const arrow:  constA = arr . const  constructor for a const arrow:  constL = arrL . const  "builds an arrow from a predicate. _ If the predicate holds, the single list containing the input is returned, else the empty list Gcombinator for converting the result of a list arrow into another list  example:  foo >>. reverse  reverses the the result of foo  example:  foo >>. take 1 K constructs a deterministic version of foo by deleting all further results Ncombinator for converting the result of an arrow into a single element result scombinator for converting an arrow into a determinstic version with all results collected in a single element list   listA af = af >>. (:[])_this is useful when the list of results computed by an arrow must be manipulated (e.g. sorted) ,example for sorting the results of a filter * collectAndSort :: a b c -> a b c  6 collectAndSort collect = listA collect >>> arrL sort the inverse of    listA af >>> unlistA = afunlistA is defined as  arrL id  &the identity arrow, alias for returnA $the zero arrow, alias for zeroArrow Econverts an arrow, that may fail, into an arrow that always succeeds  example:  withDefault none "abc"  is equivalent to  constA "abc"  Emakes a list arrow deterministic, the number of results is at most 1  definition   single f = f >>. take 1 examples with strings: ! runLA ( single none ) "x" == [] $ runLA ( single this ) "x" == ["x"]  runLA ( single  (constA "y" $ <+> this ) ) "x" == ["y"] Bcompute an arrow from the input and apply the arrow to this input  definition:  (f &&& this) >>> app  Gin a point free style, there is no way to use an argument in 2 places, [ this is a combinator for simulating this. first the argument is used to compute an arrow, - then this new arrow is applied to the input applyA coresponds to:  apply f x = let g = f x in g x   see also: , , , ,  Hcompute the parameter for an arrow with extra parameters from the input ; and apply the arrow for all parameter values to the input  a kind of " function call"' for arrows, useful for joining arrows   infixl 2 ($<)  definition:   g $< f = applyA (f >>> arr g) if f$ fails, the whole arrow fails, e.g.  g $< none == none  if f computes n values and g5 is deterministic, the whole arrow computes n values .examples with simple list arrows with strings  - prefixString :: String -> a String String  prefixString s = arr (s++)  4 runLA ( prefixString $< none ) "x" == [] 8 runLA ( prefixString $< constA "y" ) "x" == ["yx"] 8 runLA ( prefixString $< this ) "x" == ["xx"] $ runLA ( prefixString $< constA "y" = <+> constA "z" ) "x" == ["yx","zx"] $ runLA ( prefixString $< constA "y" " <+> this B <+> constA "z" ) "x" == ["yx","xx","zx"]  see also: , , , ,  binary version of  -example with simple list arrows with strings 7 infixString :: String -> String -> a String String  infixString s1 s2 - = arr (\ s -> s1 ++ s ++ s2)  C runLA ( infixString $<< constA "y" &&& constA "z" ) "x" = ["yxz"] C runLA ( infixString $<< this &&& this ) "x" = ["xxx"] $ runLA ( infixString $<< constA "y" J &&& (constA "z" <+> this) ) "x" = ["yxz", "yxx"]  version of $ for arrows with 3 extra parameters typical usage  f $<<< g1 &&& g2 &&& g3  version of $ for arrows with 4 extra parameters typical usage ! f $<<<< g1 &&& g2 &&& g3 &&& g4 #compute the parameter for an arrow f% with an extra parameter by an arrow g  and apply all the results from g sequentially to the input   infixl 2 ($<$) typical usage:   g :: a b c  g = ...   f :: c -> a b b  f x = ... x ...   f $<$ g f# computes the extra parameters for g from the input of type b and g is applied with this J parameter to the input. This allows programming in a point wise style in g, which becomes 4 neccessary, when a value is needed more than once. Uthis combinator is useful, when transforming a single value (document) step by step,  with g, for collecting the data for all steps, and f) for transforming the input step by step if g1 is deterministic (computes exactly one result),   g $< $ f == g $< f  holds if g fails,  f $< $ g == this  if g computes more than one result, f< is applied sequentially to the input for every result from g .examples with simple list arrows with strings  - prefixString :: String -> a String String  prefixString s = arr (s++)  C runLA ( prefixString $<$ none ) "x" == ["x"] D runLA ( prefixString $<$ constA "y" ) "x" == ["yx"] E runLA ( prefixString $<$ constA "y" <+> constA "z" ) "x" == ["zyx"] . runLA ( prefixString $<$ constA "y" <+> this F <+> constA "z" ) "x" == ["zxyx"] !example with two extra parameter   g1 :: a b c1  g2 :: a b c2  ! f :: (c1, c2) -> a b b ! f (x1, x2) = ... x1 ... x2 ...   f $<$ g1 &&& g2  see also: ,  -merge the result pairs of an arrow with type  a a1 (b1, b2) , by combining the tuple components with the op arrow Aexamples with simple list arrows working on strings and XmlTrees  ' a1 :: a String (XmlTree, XmlTree) ( a1 = selem "foo" [this >>> mkText]  &&& / selem "bar" [arr (++"0") >>> mkText]  [ runLA (a1 >>> mergeA (<+>) >>> xshow this) "42" == ["<foo>42</foo>","<bar>420</bar>"] X runLA (a1 >>> mergeA (+=) >>> xshow this) "42" == ["<foo>42<bar>420</bar></foo>"]  see also: ,  and += in class Text.XML.HXT.Arrow.ArrowXml Puseful only for arrows with side effects: perform applies an arrow to the input * ignores the result and returns the input  example: ( ... >>> perform someTraceArrow >>> ...  #generalization of arrow combinator   definition:  catA = foldl (<+>) none  #generalization of arrow combinator   definition:  seqA = foldl (>>>) this  % non-portable experimentalUwe Schmidt (uwe\@fh-wedel.de),partial evaluation of an arrow result using Control.FlatSeq FThere are tow arrows with force the partial evaluation. By convention ( the 2. should be less lazy than the 1. VThese arrows are sometimes useful for preventing space leaks, especially when parsing R complex data structures. In many cases the evaluated AST is more space efficient . than the unevaluaded with a lot of closures. -complete evaluation of an arrow result using Control.DeepSeq Nthis is sometimes useful for preventing space leaks, especially after reading M and validation of a document, all DTD stuff is not longer in use and can be  recycled by the GC. &portable experimentalUwe Schmidt (uwe\@fh-wedel.de)an auxiliary data type for  *The interface for arrows as conditionals. [Requires list arrows because False is represented as empty list, True as none empty lists. Only  and  don't have default implementations if lifted to arrows  shortcut:  ifP p = ifA (isA p)   negation:  neg f = ifA f none this   f `when` g K : when the predicate g holds, f is applied, else the identity filter this  shortcut:  f `whenP` p = f `when` (isA p)   f `whenNot` g S : when the predicate g does not hold, f is applied, else the identity filter this like   g `guards` f 7 : when the predicate g holds, f is applied, else none like   shortcut for  f  this   f ` containing` g 4 : keep only those results from f for which g holds  definition:  f ` containing` g = f >>> g `guards` this   f ` notContaining` g < : keep only those results from f for which g does not hold  definition:  f ` notContaining` g = f >>> ifA g none this   f `orElse` g W : directional choice: if f succeeds, the result of f is the result, else g is applied generalisation of 2 for multi way branches like in case expressions. An auxiliary data type  with an infix constructor ( is used for writing multi way branches  example: 2 choiceA [ p1 :-> e1, p2 :-> e2, this :-> default ]  atag a value with Left or Right, if arrow has success, input is tagged with Left, else with Right >split a list value with an arrow and returns a pair of lists.  This is the arrow version of . The arrow is deterministic.  example:  runLA (spanA (isA (/= '-'))) "abc-def"  gives  [("abc","-def")]  as result 0partition a list of values into a pair of lists This is the arrow Version of  'portable experimentalUwe Schmidt (uwe\@fh-wedel.de)!*The interface for navigatable tree arrows +all functions have default implementations XPath axis: ancestor XPath axis: ancestor or self XPath axis: child XPath axis: descendant XPath axis: descendant or self 6not an XPath axis but useful: descendant or following Znot an official XPath axis but useful: reverse descendant or self, used in preceding axis XPath axis: following sibling XPath axis: preceeding sibling XPath axis: self XPath axis: following XPath axis: preceding move to the root /Conversion from a tree into a navigatable tree 9Conversion from a navigatable tree into an ordinary tree 8apply an operation using navigation to an ordinary tree =This root and all children may be visited in arbitrary order Iapply a simple operation without use of navigation to a navigatable tree EThis enables to apply arbitrary tree operations to navigatable trees /Filter an axis with an ordinary tree predicate [Example: In a tree of Ints find all nodes in the subtrees (in preorder) that have label 42  1 descendantAxis >>> filterAxis (hasNode (== 42)) ZExample: In an XML Tree find the following nodes of a node with attribute id and value 42 N descendantAxis >>> filterAxis (hasAttrValue "id" (=="42")) >>> followingAxis ;Move to the next tree on a given axis. Deterministic arrow VExample: Move to the next node in a preorder visit: next child or else next following " moveOn descendantOrFollowingAxis 2Change the current subtree of a navigatable tree. IThe arrow for computing the changes should be deterministic. If it fails  nothing is changed. ESubstitute the current subtree of a navigatable tree by a given tree {apply an ordinary arrow to the current subtree of a navigatabe tree and add the result trees in front of the current tree. dIf this arrow is applied to the root, it will fail, because we want a tree as result, not a forest. vapply an ordinary arrow to the current subtree of a navigatabe tree and add the result trees behind the current tree. dIf this arrow is applied to the root, it will fail, because we want a tree as result, not a forest. $addToOneSide does the real work for  and  @drop the direct left sibling tree of the given navigatable tree jIf this arrow is applied to the root or a leftmost tree, it will fail, because there is nothing to remove @drop the direct left sibling tree of the given navigatable tree kIf this arrow is applied to the root or a rightmost tree, it will fail, because there is nothing to remove !!!(portablestableUwe Schmidt (uwe\@fh-wedel.de)The interface for tree arrows +all functions have default implementations construct a leaf construct an inner node *select the children of the root of a tree +select the node info of the root of a tree +select the attribute of the root of a tree .substitute the children of the root of a tree  /substitute the attribute of the root of a tree  (edit the children of the root of a tree  )edit the attribute of the root of a tree  Bapply an arrow element wise to all children of the root of a tree D collect these results and substitute the children with this result  example:  processChildren isText 6 deletes all subtrees, for which isText does not hold  example:  processChildren (none `when` isCmt) - removes all children, for which isCmt holds  Lsimilar to processChildren, but the new children are computed by processing  the whole input tree  example:  replaceChildren (deep isText) - selects all subtrees for which isText holds H and substitutes the children component of the root node with this list  pronounced "slash", meaning g inside f  defined as  f /> g = f >>> getChildren >>> g   example:  hasName "html" / > hasName "body" / > hasName "h1"  This expression selects  all "h1" elements in the "body" element of an "html" element, an expression, that - corresponds 1-1 to the XPath selection path "html/body/h1"  pronounced " double slash"&, meaning g arbitrarily deep inside f  defined as  f //#> g = f >>> getChildren >>> deep g   example:  hasName "html" // > hasName "table"  This expression selects  all top level "table" elements within an "html" element, an expression. % Attantion: This does not correspond  to the XPath selection path "html//table"+. The latter on matches all table elements  even nested ones, but //>4 gives in many cases the appropriate functionality.  pronounced "outside" meaning f containing g  defined as  f </ g = f ` containing` (getChildren >>> g)  Mrecursively searches a whole tree for subtrees, for which a predicate holds. _ The search is performed top down. When a tree is found, this becomes an element of the result i list. The tree found is not further examined for any subtress, for which the predicate also could hold.  See  for this kind of search.  example:  deep isHtmlTable 4 selects all top level table elements in a document ^ (with an appropriate definition for isHtmlTable) but no tables occuring within a table cell. Lrecursively searches a whole tree for subrees, for which a predicate holds. $ The search is performed bottom up.  example:  deepest isHtmlTable 4 selects all innermost table elements in a document . but no table elements containing tables. See  and  for other search strategies. Mrecursively searches a whole tree for subtrees, for which a predicate holds. W The search is performed top down. All nodes of the tree are searched, even within the 2 subtrees of trees for which the predicate holds.  example:  multi isHtmlTable / selects all table elements, even nested ones. Jrecursively transforms a whole tree by applying an arrow to all subtrees, E this is done bottom up depth first, leaves first, root as last tree  example:  processBottomUp (getChildren `when` isHtmlFont) < removes all font tags in a HTML document, even nested ones 0 (with an appropriate definition of isHtmlFont)  similar to O, but recursively transforms a whole tree by applying an arrow to all subtrees @ with a top down depth first traversal strategie. In many cases  and   give same results. Jrecursively transforms a whole tree by applying an arrow to all subtrees, G but transformation stops when a predicte does not hold for a subtree,  leaves are transformed first Jrecursively transforms a whole tree by applying an arrow to all subtrees, C but transformation stops when a tree is successfully transformed. % the transformation is done top down  example: " processTopDownUntil (isHtmlTable `guards` tranformTable)  ` transforms all top level table elements into something else, but inner tables remain unchanged ;computes a list of trees by applying an arrow to the input C and inserts this list in front of index i in the list of children  example: ! insertChildrenAt 0 (deep isCmt) , selects all subtrees for which isCmt holds 5 and copies theses in front of the existing children  similar to :, but the insertion position is searched with a predicate Jan arrow for inserting a whole subtree with some holes in it (a template) H into a document. The holes can be filled with contents from the input. Example  5 insertTreeTemplateTest :: ArrowXml a => a b XmlTree  insertTreeTemplateTest  = doc  >>> + insertTreeTemplate template pattern  where Z doc -- the input data = = constA "<x><y>The Title</y><z>The content</z></x>"  >>> xread y template -- the output template with 2 holes: xxx and yyy Y = constA "<html><head><title>xxx</title></head><body><h1>yyy</h1></body></html>"  >>> xread  pattern  = [ hasText (== "xxx") -- fill the xxx hole with the input contents from element "x/y" @ :-> ( getChildren >>> hasName "y" >>> deep isText )   , hasText (== "yyy") -- fill the yyy hole with the input contents from element "x/z" @ :-> ( getChildren >>> hasName "z" >>> getChildren )  ] 1computes the XML tree for the following document W "<html><head><title>The Title</title></head><body><h1>The content</h1></body></html>"                     )portable experimentalUwe Schmidt (uwe\@fh-wedel.de)pure list arrow data type @conversion of pure list arrows into other possibly more complex  list arrows *portable experimentalUwe Schmidt (uwe\@fh-wedel.de)!list arrow combined with a state  !"4conversion of state list arrows into arbitray other  list arrows. 8allows running a state list arrow within another arrow:  example:  < ... >>> fromSLA 0 (... setState ... getState ... ) >>> ... >runs a state arrow with initial state 0 (e..g. an Int) within  another arrow sequence  !" !" ! !"+portable experimentalUwe Schmidt (uwe\@fh-wedel.de)#Edit parts of a rose tree OThe subtrees to be modified are selected by the first part of the IfThen pairs % The modification by the second part $#$#$#$,portable experimentalUwe Schmidt (uwe\@fh-wedel.de)%?the interface for converting an IO predicate into a list arrow &%builds an arrow from an IO predicate _if the predicate holds, the single list containing the input is returned, else the empty list,  similar to Control.Arrow.ArrowList.isA '8the interface for converting an IO action into an arrow (%construct an arrow from an IO action );construct an arrow from an IO action without any parameter *;construction of a 2 argument arrow from a binary IO action  |  | example:  a1 &&& a2 >>> arr2 f  +:construction of a 3 argument arrow from a 3-ary IO action  |  | example:  a1 &&& a2 &&& a3 >>> arr3 f  ,:construction of a 4 argument arrow from a 4-ary IO action  |  | example:  a1 &&& a2 &&& a3 &&& a4 >>> arr4 f  %&'()*+,'()*+,%&%&&'()*+,()*+,- not portable experimentalUwe Schmidt (uwe\@fh-wedel.de)-./-./-./-././.portable experimentalUwe Schmidt (uwe\@fh-wedel.de)0"list arrow combined with IO monad 1201201201212/portable experimentalUwe Schmidt (uwe\@fh-wedel.de)32list arrow combined with a state and the IO monad 456Jlift the state of an IOSLA arrow to a state with an additional component. LThis is uesful, when running predefined IO arrows, e.g. for document input, 3 in a context with a more complex state component. 7Jrun an arrow with augmented state in the context of a simple state arrow. 9 An initial value for the new state component is needed. PThis is useful, when running an arrow with an extra environment component, e.g.  for namespace handling in XML. 345673456734545670portablestableUwe Schmidt (uwe@fh-wedel.de)89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~>predefined system state data type with all components for the 3 system functions, like trace, error handling, ... 9The arrow for stateful arrows with no user defined state #The arrow type for stateful arrows ;state datatype consists of a system state and a user state  the user state is not fixed (read the user defined part of the state *change the user defined part of the state 'set the user defined part of the state extend user state FRun an arrow with an extended user state component, The old component N is stored together with a new one in a pair, the arrow is executed with this M extended state, and the augmented state component is removed form the state + when the arrow has finished its execution change the type of user state CThis conversion is useful, when running a state arrow with another I structure of the user state, e.g. with () when executing some IO arrows <store a string in global state under a given attribute name ?remove an entry in global state, arrow input remains unchanged *read an attribute value from global state &read all attributes from global state #store an int value in global state $read an int value from global state  getSysAttrInt 0 myIntAttr 89:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~{|}~rstuvwxyz^_`abcdefghijklmnopqSTUVWXYZ[\]NRQPOEFGHIJKLM<=>?@ABCD;:9889:;<=>?@ABCD=>?@ABCDEFGHIJKLMFGHIJKLMNRQPOOPQRS TUVWXYZ[\]TUVWXYZ[\]^_`abcdefghijklmnopq_`abcdefghijklmnopqrstuvwxyzstuvwxyz{ |}~|}~1portablestableUwe Schmidt (uwe@fh-wedel.de)Kset the table mapping of file extensions to mime types in the system state Default table is defined in !Text.XML.HXT.DOM.MimeTypeDefaults. Z This table is used when reading loacl files, (file: protocol) to determine the mime type Rset the table mapping of file extensions to mime types by an external config file /The config file must follow the conventions of etc%mime.types on a debian linux system, : that means all empty lines and all lines starting with a # are ignored. The other lines N must consist of a mime type followed by a possible empty list of extensions. X The list of extenstions and mime types overwrites the default list in the system state  of the IOStateArrow read the system mimetype table 2portable experimentalUwe Schmidt (uwe@fh-wedel.de)z Document Type Definition arrows JThese are separated, because they are not needed for document processing, Ronly when processing the DTD, e.g. for generating access funtions for the toolbox ?from a DTD (se example DTDtoHaskell in the examples directory)      Arrows for processing !Text.XML.HXT.DOM.TypeDefs.XmlTrees XThese arrows can be grouped into predicates, selectors, constructors, and transformers.  All predicates (tests) act like Control.Arrow.ArrowIf.none for failure and Control.Arrow.ArrowIf.this for success. A logical and can be formed by  a1 >>> a2 , a locical or by  a1 <+> a2 . _Selector arrows will fail, when applied to wrong input, e.g. selecting the text of a node with E ,will fail when applied to a none text node. uEdit arrows will remain the input unchanged, when applied to wrong argument, e.g. editing the content of a text node with ^D applied to an element node will return the unchanged element node. test for text nodes -test for char reference, used during parsing /test for entity reference, used during parsing test for comment ,test for CDATA section, used during parsing  test for processing instruction  test for processing instruction <?xml ...> test for element 'test for DTD part, used during parsing test for attribute tree test for error message &test for root node (element with name "/") ;test for text nodes with text, for which a predicate holds  example: hasText (all (`elem` " \t\n"))3 check for text nodes with only whitespace content *test for text nodes with only white space implemented with hasTest Ptest whether a node (element, attribute, pi) has a name with a special property Ktest whether a node (element, attribute, pi) has a specific qualified name ) useful only after namespace propagation  Jtest whether a node has a specific name (prefix:localPart ore localPart), 3 generally useful, even without namespace handling !7test whether a node has a specific name as local part, ) useful only after namespace propagation "0test whether a node has a specific name prefix, ) useful only after namespace propagation #1test whether a node has a specific namespace URI ) useful only after namespace propagation $Htest whether an element node has an attribute node with a specific name %Rtest whether an element node has an attribute node with a specific qualified name &Dtest whether an element node has an attribute with a specific value 'Ytest whether an element node has an attribute with a qualified name and a specific value (text node construction arrow )blob node construction arrow *>char reference construction arrow, useful for document output +@entity reference construction arrow, useful for document output ,6comment node construction, useful for document output -/CDATA construction, useful for document output .0error node construction, useful only internally /element construction: Q | the attributes and the content of the element are computed by applying arrows  to the input 0attribute node construction: E | the attribute value is computed by applying an arrow to the input 1%processing instruction construction: [ | the content of the processing instruction is computed by applying an arrow to the input 2Gconvenient arrow for element construction, more comfortable variant of / example for simplifying / :  6 mkElement qn (a1 <+> ... <+> ai) (c1 <+> ... <+> cj) equals $ mkqelem qn [a1,...,ai] [c1,...,cj] 3mconvenient arrow for element construction with strings instead of qualified names as element names, see also / and 3 4`convenient arrow for element constrution with attributes but without content, simple variant of 3 and / 5Vconvenient arrow for simple element constrution without attributes, simple variant of 3 and / 6Yconvenient arrow for constrution of empty elements without attributes, simple variant of 3 and / 7*construction of an element node with name "/" for document roots 8 alias for 0 9>convenient arrow for attribute constrution, simple variant of 0 :constant arrow for text nodes ;constant arrow for blob nodes <(constant arrow for char reference nodes =*constant arrow for entity reference nodes >constant arrow for comment ?constant arrow for warning @constant arrow for errors A constant arrow for fatal errors B7constant arrow for simple processing instructions, see 1 C\constant arrow for attribute nodes, attribute name is a qualified name and value is a text,  | see also 0, 8, 9 DAconstant arrow for attribute nodes, attribute name and value are  | given by parameters, see 0 Eselect the text of a text node F%select the value of a char reference G+select the name of a entity reference node H%select the comment of a comment node I#select the content of a CDATA node J,select the name of a processing instruction K/select the content of a processing instruction L#select the name of an element node M-select the attribute list of an element node N"select the DTD type of a DTD node O(select the DTD attributes of a DTD node P select the name of an attribute QCselect the error level (c_warn, c_err, c_fatal) from an error node R,select the error message from an error node S;select the qualified name from an element, attribute or pi TJselect the prefix:localPart or localPart from an element, attribute or pi U8select the univeral name ({namespace URI} ++ localPart) V6select the univeral name (namespace URI ++ localPart) Wselect the local part Xselect the name prefix Yselect the namespace URI Z5select the value of an attribute of an element node, 4 always succeeds with empty string as default value "" [like Z,, but fails if the attribute does not exist \like ZB, but select the value of an attribute given by a qualified name, 4 always succeeds with empty string as default value "" ]like \(, but fails if attribute does not exist ^edit the string of a text node _edit the blob of a blob node `*edit the comment string of a comment node a)edit an element-, attribute- or pi- name bedit an element name cedit an attribute name dedit a pi name eedit an attribute value f*edit an attribute list of an element node g)replace an element, attribute or pi name hreplace an element name ireplace an attribute name jreplace an element name k,replace an atribute list of an element node l'add a list of attributes to an element madd (or replace) an attribute nremove an attribute o*remove an attribute with a qualified name p8process the attributes of an element node with an arrow q?process a whole tree inclusive attribute list of element nodes  see also:  r:convenient op for adding attributes or children to a node usage:  tf += cf  the tf; arrow computes an element node, and all trees computed by cf are U added to this node, if a tree is an attribute, it is inserted in the attribute list * else it is appended to the content list. ;attention: do not build long content list this way because r is implemented by ++  examples:   eelem "a"  += sattr "href" "page.html"  += sattr "name" "here"  += txt "look here" is the same as  # mkelem [ sattr "href" "page.html"  , sattr "name" "here"  ]  [ txt "look here" ] !and results in the XML fragment: <a href=" page.html" name="here"> look here</a> advantage of the r7 operator is, that attributes and content can be added  any time step by step.  if tf0 computes a whole list of trees, e.g. a list of "td" or "tr" elements, D the attributes or content is added to all trees. useful for adding "class" or "style" attributes  to table elements. s]apply an arrow to the input and convert the resulting XML trees into a string representation t]apply an arrow to the input and convert the resulting XML trees into a string representation z      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstz !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst     z          f !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst3portablestableUwe Schmidt (uwe@fh-wedel.de)uvreset global error variable wset global error variable x!read current global error status y>raise the global error status level to that of the input tree zEset the error message handler and the flag for collecting the errors {+error message handler for output to stderr |:the default error message handler: error output to stderr },error message handler for collecting errors ~:error message handler for output to stderr and collecting *error message handler for ignoring errors 9if error messages are collected by the error handler for 7 processing these messages by the calling application, I this arrow reads the stored messages and clears the error message store 8filter error messages from input trees and issue errors generate a warnig message generate an error message 8generate a fatal error message, e.g. document not found ADefault exception handler: issue a fatal error message and fail. =The parameter can be used to specify where the error occured ;add the error level and the module where the error occured e to the attributes of a document root node and remove the children when level is greater or equal to .  called by * when the system state indicates an error <check whether the error level attribute in the system state E is set to error, in this case the children of the document root are f removed and the module name where the error occured and the error level are added as attributes with   else nothing is changed Ucheck whether tree is a document root and the status attribute has a value less than  uvwxyz{|}~uvwxyz{|}~uvwxyz{|}~4portablestableUwe Schmidt (uwe@fh-wedel.de)&withTace level. : system option, set the trace level, (0..4) withSysAttr key value5 : store an arbitarty key value pair in system state withMimeTypeFile filename : input option,  set the mime type table for file: documents by given file. H The format of this config file must be in the syntax of a debian linux " mime.types" config file /Force a given mime type for all file contents. ZThe mime type for file access will then not be computed by looking into a mime.types file withWarnings yes/noN : system option, issue warnings during reading, HTML parsing and processing,  default is  withErrors yes/no< : system option for suppressing error messages, default is  withRemoveWS yes/no[ : read and write option, remove all whitespace, used for document indentation, default is  withPreserveComment yes/noF : read option, preserve comments during canonicalization, default is  withParseByMimeType yes/noD : read option, select the parser by the mime type of the document " (pulled out of the HTTP header). When the mime type is set to "text/html" - the configured HTML parser is taken, when it' s set to  "text/xml" or "text/xhtml"% the configured XML parser is taken. I If the mime type is something else, no further processing is performed, N the contents is given back to the application in form of a single text node. T If the default document encoding is set to isoLatin1, this even enables processing  of arbitray binary data. withParseHTML yes/no+: read option, use HTML parser, default is  (use XML parser) withValidate yes/no9: read option, validate document againsd DTD, default is  withCheckNamespaces yes/no,: read option, check namespaces, default is  withCanonicalize yes/no2 : read option, canonicalize document, default is  withIgnoreNoneXmlContents yes/no5 : input option, ignore document contents of none XML/HTML documents. [This option can be useful for implementing crawler like applications, e.g. an URL checker. , In those cases net traffic can be reduced. withStrictInput yes/noM : input option, input of file and HTTP contents is read eagerly, default is  withEncodingErrors yes/no8 : input option, ignore all encoding errors, default is  withInputEncoding encodingName : input option Set default document encoding (4, F, 6, D, ... , 7, ...). 0 Only XML, HTML and text documents are decoded,  default decoding for XML/1HTML is utf8, for text iso latin1 (no decoding). withDefaultBaseURI URI* , input option, set the default base URI gThis option can be useful when parsing documents from stdin or contained in a string, and interpreting # relative URIs within the document withRedirect yes/noB : input option, automatically follow redirected URIs, default is   withProxy " host:port"H : input option, configure a proxy for HTTP access, e.g. www-cache:3128 withIndent yes/no< : output option, indent document before output, default is  withOutputEncoding encoding , output option, M default is the default input encoding or utf8, if input encoding is not set  withOutputXML" : output option, default writing 0Default is writing XML: quote special XML chars >,<,",',& where neccessary,  add XML processing instruction % and encode document with respect to  aWrite XHTML: quote all special XML chars, use HTML entity refs or char refs for none ASCII chars ,Write XML: quote only special XML chars, don',t substitute chars by HTML entities, and don'-t generate empty elements for HTML elements, & which may contain any contents, e.g.  script src=... /script instead of  script src=... / ,suppreses all char and entitiy substitution @Configure compression and decompression for binary serialization/deserialization. J First component is the compression function applied after serialization, : second the decompression applied before deserialization. &&&5portablestableUwe Schmidt (uwe@fh-wedel.de)6&commonly useful options for XML input 6can be used for option definition with haskell getopt defines options: , ,  a_use_curl, a_do_not_use_curl, a_options_curl, Z,  , , , , , ,  , , , , , 'commonly useful options for XML output defines options: , `,  and others commonly useful options defines options: ,  defines h option debug output options <select options from a predefined list of option desciptions 6666portablestableUwe Schmidt (uwe@fh-wedel.de)    7portablestableUwe Schmidt (uwe@fh-wedel.de).escape XmlText, < transform all special XML chars into char- or entity- refs  Applies some  Canonical XML rules to a document tree. MThe rule differ slightly for canonical XML and XPath in handling of comments KNote: This is not the whole canonicalization as it is specified by the W3C R Recommendation. Adding attribute defaults or sorting attributes in lexicographic  order is done by the  transform function of module !Text.XML.HXT.Validator.Validation. F Replacing entities or line feed normalization is done by the parser. Not implemented yet: 4 Whitespace within start and end tags is normalized c Special characters in attribute values and character content are replaced by character references see  and   Applies some  Canonical XML rules to a document tree. MThe rule differ slightly for canonical XML and XPath in handling of comments KNote: This is not the whole canonicalization as it is specified by the W3C R Recommendation. Adding attribute defaults or sorting attributes in lexicographic  order is done by the  transform function of module !Text.XML.HXT.Validator.Validation. F Replacing entities or line feed normalization is done by the parser. aRules: remove DTD parts, processing instructions, comments and substitute char refs in attribute  values and text Not implemented yet: 4 Whitespace within start and end tags is normalized c Special characters in attribute values and character content are replaced by character references Canonicalize a tree for XPath  Like # but comment nodes are not removed see  (Canonicalize the contents of a document 8substitutes all char refs in text and attribute values, D removes CDATA section and combines all sequences of resulting text  nodes into a single text node see  ^Collects sequences of text nodes in the list of children of a node into one single text node. C This is useful, e.g. after char and entity reference substitution #Applies collapseXText recursively.  see also :  [apply an arrow to the input and convert the resulting XML trees into an XML escaped string eThis is a save variant for converting a tree into an XML string representation that is parsable with Text.XML.HXT.Arrow.ReadDocument.  It is implemented with s@, but xshow does no XML escaping. The XML escaping is done with  $Text.XML.HXT.Arrow.Edit.escapeXmlDoc before xshow is applied. So the following law holds ! xshowEscapeXml f >>> xread == f >convert a document into a Haskell representation (with show). 'Useful for debugging and trace output.  see also : ,  Pconvert a document into a text and add line numbers to the text representation. 8Result is a root node with a single text node as child. ( Useful for debugging and trace output.  see also : ,  <convert a document into a text representation in tree form. 'Useful for debugging and trace output.  see also : ,  remove a Comment node *remove all comments in a tree recursively 'simple filter for removing whitespace. 0no check on sigificant whitespace, e.g. in HTML <pre>-elements, is done.  see also : ,  5simple recursive filter for removing all whitespace. Bremoves all text nodes in a tree that consist only of whitespace.  see also : ,  4filter for removing all not significant whitespace. =the tree traversed for removing whitespace between elements, 4 that was inserted for indentation and readability. / whitespace is only removed at places, where it's not significat < preserving whitespace may be controlled in a document tree  by a tag attribute  xml:space &allowed values for this attribute are default | preserve 5input is root node of the document to be cleaned up, 4 output the semantically equivalent simplified tree  see also : ,  :filter for indenting a document tree for pretty printing. Dthe tree is traversed for inserting whitespace for tag indentation. >whitespace is only inserted or changed at places, where it isn't significant,  is'Fs not inserted between tags and text containing non whitespace chars. :whitespace is only inserted or changed at places, where it's not significant. < preserving whitespace may be controlled in a document tree  by a tag attribute  xml:space &allowed values for this attribute are default | preserve. 9input is a complete document tree or a document fragment 7 result is the semantically equivalent formatted tree.  see also :  0converts a CDATA section into normal text nodes Fconverts CDATA sections in whole document tree into normal text nodes  .converts a character reference to normal text  =recursively converts all character references to normal text    add an < ?xml version="1.0"?> processing instruction  if it's not already there add an encoding spec to the < ?xml version="1.0"?> processing instruction 6add an XHTML strict doctype declaration to a document 6add an XHTML strict doctype declaration to a document <add an XHTML transitional doctype declaration to a document 8add an XHTML frameset doctype declaration to a document (add a doctype declaration to a document IThe arguments are the root element name, the PUBLIC id and the SYSTEM id                  8portable experimentalUwe Schmidt (uwe@fh-wedel.de)Etest whether an attribute node contains an XML Namespace declaration 6get the namespace prefix and the namespace URI out of 5 an attribute tree with a namespace declaration (see ) & for all other nodes this arrow fails ;collect all namespace declarations contained in a document apply  to a whole XmlTree 9collect all (namePrefix, namespaceUri) pairs from a tree Gall qualified names are inspected, whether a namespace uri is defined, I for these uris the prefix and uri is returned. This arrow is useful for K namespace cleanup, e.g. for documents generated with XSLT. It can be used  together with  to  rgenerate unique namespaces and add all namespace declarations to all top nodes containing a namespace declaration V Usually the top node containing namespace declarations is the root node, but this isn' t mandatory. Calls  with  ngenerate unique namespaces and add all namespace declarations for all prefix-uri pairs in all qualified names 9useful for cleanup of namespaces in generated documents.  Calls  with  collectNamespaceDecl <+> collectPrefixUriPairs  *does the real work for namespace cleanup. UThe parameter is used for collecting namespace uris and prefixes from the input tree <auxiliary arrow for processing with a namespace environment =process a document tree with an arrow, containing always the 1 valid namespace environment as extra parameter. / The namespace environment is implemented as a Data.AssocList.AssocList. C Processing of attributes can be controlled by a boolean parameter =process a document tree with an arrow, containing always the 1 valid namespace environment as extra parameter. .The namespace environment is implemented as a Data.AssocList.AssocList Rprocess all element nodes of a document tree with an arrow, containing always the T valid namespace environment as extra parameter. Attribute lists are not processed.  See also:  Pattach all valid namespace declarations to the attribute list of element nodes. TThis arrow is useful for document processing, that requires access to all namespace J declarations at any element node, but which cannot be done with a simple . %propagate all namespace declarations " xmlns:ns=..."3 to all element and attribute nodes of a document. 9This arrow does not check for illegal use of namespaces.  The real work is done by . 3The arrow may be applied repeatedly if neccessary. 9attaches the namespace info given by the namespace table 0 to a tag node and its attributes and children. 4validate the namespace constraints in a whole tree. 4Result is the list of errors concerning namespaces.  Predicates `, _, d  and a9 are applied to the appropriate elements and attributes. (a single node for namespace constrains.   9portablestableUwe Schmidt (uwe@fh-wedel.de)  set the global trace level !read the global trace level "Aset the global trace command. This command does the trace output ##acces the command for trace output $arun an arrow with a given trace level, the old trace level is restored after the arrow execution %0apply a trace arrow and issue message to stderr &<trace the current value transfered in a sequence of arrows. PThe value is formated by a string conversion function. This is a substitute for / the old and less general traceString function 'an old alias for & ( issue a string message as trace )Bissue the source representation of a document if trace level >= 3 =for better readability the source is formated with indentDoc *@issue the tree representation of a document if trace level >= 4 +trace a main computation step k issue a message when trace level >= 1, issue document source if level >= 3, issue tree when level is >= 4 ,  !"#$%&'()*+,  !"#$%&'()*+,  !"#$%&'()*+,:portablestableUwe Schmidt (uwe@fh-wedel.de)-Xset the base URI of a document, used e.g. for reading includes, e.g. external entities, # the input must be an absolute URI .)read the base URI from the globale state /Bchange the base URI with a possibly relative URI, can be used for G evaluating the xml:base attribute. Returns the new absolute base URI. 8 Fails, if input is not parsable with parseURIReference  see also: -, 6 0Aset the default base URI, if parameter is null, the system base ( file:///<cwd>/  ) is used, @ else the parameter, must be called before any document is read 1get the default base URI 2aremember base uri, run an arrow and restore the base URI, used with external entity substitution 3-parse a URI reference, in case of a failure, R try to escape unescaped chars, convert backslashes to slashes for windows paths,  and try parsing again 47compute the absolut URI for a given URI and a base URI 5arrow variant of 4 , fails if 4 returns Nothing 6oarrow for expanding an input URI into an absolute URI using global base URI, fails if input is not a legal URI 7Yarrow for selecting the scheme (protocol) of the URI, fails if input is not a legal URI. #See Network.URI for URI components 8]arrow for selecting the registered name (host) of the URI, fails if input is not a legal URI 9?arrow for selecting the port number of the URI without leading ':'$, fails if input is not a legal URI :>arrow for selecting the user info of the URI without trailing '@'$, fails if input is not a legal URI ;Tarrow for computing the path component of an URI, fails if input is not a legal URI <Uarrow for computing the query component of an URI, fails if input is not a legal URI =Xarrow for computing the fragment component of an URI, fails if input is not a legal URI >Tarrow for computing the path component of an URI, fails if input is not a legal URI -./0123456789:;<=>-./0123456789:;<=>-./0123456789:;<=>;portable experimentalUwe Schmidt (uwe@fh-wedel.de)!?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^8infix operator for applying an arrow to a list of trees  1.parameter f : the arrow % 2.parameter ts : the list of trees  returns : list of results _create an error message 0123456789:;<=>?@ABCDEF()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_!@?BCDEFAGHIJKLMNOPQRSTUVWXYZ[\]^_!?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_<portable experimentalUwe Schmidt (uwe@fh-wedel.de)`IChecks if the attribute value meets the lexical constraints of its type. , 1.parameter dtdPart : the children of the DOCTYPE node G 2.parameter attrDecl : the declaration of the attribute from the DTD E returns : a function which takes an element (XTag or XDTD ATTLIST), P checks if the attribute value meets the lexical constraints = of its type and returns a list of errors 5Dispatches the attibute check by the attribute type. ' 1.parameter typ : the attribute type , 2.parameter dtdPart : the children of the DOCTYPE node G 3.parameter attrValue : the normalized attribute value to be checked G 4.parameter attrDecl : the declaration of the attribute from the DTD F returns : a functions which takes an element (XTag or XDTD ATTLIST), T checks if the attribute value meets the lexical constraints A of its type and returns a list of errors 8Checks the value of Enumeration attribute types. (3.3.1 / p.27 in Spec) G 1.parameter attrDecl : the declaration of the attribute from the DTD G 2.parameter attrValue : the normalized attribute value to be checked 3Checks the value of ENTITY attribute types. (3.3.1 / p.26 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node, to get the 1 unparsed entity declarations G 2.parameter attrDecl : the declaration of the attribute from the DTD G 3.parameter attrValue : the normalized attribute value to be checked 5Checks the value of ENTITIES attribute types. (3.3.1 / p.26 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node, to get the 1 unparsed entity declarations G 2.parameter attrDecl : the declaration of the attribute from the DTD G 3.parameter attrValue : the normalized attribute value to be checked 4Checks the value of NMTOKEN attribute types. (3.3.1 / p.26 in Spec) G 1.parameter attrDecl : the declaration of the attribute from the DTD G 2.parameter attrValue : the normalized attribute value to be checked  5Checks the value of NMTOKENS attribute types. (3.3.1 / p.26 in Spec) G 1.parameter attrDecl : the declaration of the attribute from the DTD G 2.parameter attrValue : the normalized attribute value to be checked  /Checks the value of ID attribute types. (3.3.1 / p.25 in Spec) G 1.parameter attrDecl : the declaration of the attribute from the DTD G 2.parameter attrValue : the normalized attribute value to be checked  2Checks the value of IDREF attribute types. (3.3.1 / p.26 in Spec) G 1.parameter attrDecl : the declaration of the attribute from the DTD G 2.parameter attrValue : the normalized attribute value to be checked  3Checks the value of IDREFS attribute types. (3.3.1 / p.26 in Spec) G 1.parameter attrDecl : the declaration of the attribute from the DTD G 2.parameter attrValue : the normalized attribute value to be checked  /Checks if the value of an attribute is a name. - 1.parameter msg : error message, should be Entity or Attribute value G 2.parameter attrDecl : the declaration of the attribute from the DTD G 3.parameter attrValue : the normalized attribute value to be checked a?Normalizes an attribute value with respect to its type. (3.3.3 / p.29 in Spec) Q 1.parameter attrDecl : the declaration of the attribute from the DTD. Expected K is a list. If the list is empty, no declaration exists. ; 2.parameter value : the attribute value to be normalized  returns : the normalized value )Normalization of CDATA attribute values.  is already done when parsing 0 during entity substituion for attribute values 4Normalization of attribute values other than CDATA. 4Reduce whitespace sequences to a single whitespace. `a`a`a=portable experimentalUwe Schmidt (uwe@fh-wedel.de)bValidate a DTD. I returns : a functions which takes the DTD subset of the XmlTree, checks C if the DTD is valid and returns a list of errors BValidation of Notations, checks if all notation names are unique. 0 Validity constraint: Unique Notation Name (4.7 / p.44 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node  returns : a list of errors Validation of Entities.  ; Issues a warning if entities are declared multiple times. Optional warning: (4.2 / p.35 in Spec)  ? Validates that a notation is declared for an unparsed entity. .Validity constraint: Notation Declared (4.2.2 / p.36 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node M 2.parameter notationNames : list of all notation names declared in the DTD  returns : a list of errors $Validation of Element declarations.  ; Validates that an element is not declared multiple times. :Validity constraint: Unique Element Type Declaration (3.2 / p.21 in Spec)  R Validates that an element name only appears once in a mixed-content declaration. -Validity constraint: No Duplicate Types (3.2 / p.21 in Spec)  T Issues a warning if an element mentioned in a content model is not declared in the  DTD. Optional warning: (3.2 / p.21 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node H 2.parameter elemNames : list of all element names declared in the DTD  returns : a list of errors &Validation of Attribute declarations.  M Issues a warning if an attribute is declared for an element type not itself  decared. Optinal warning: (3.3 / p. 24 in Spec)  G Issues a warning if more than one definition is provided for the same J attribute of a given element type. Fist declaration is binding, later  definitions are ignored. Optional warning: (3.3 / p.24 in Spec)  K Issues a warning if the same Nmtoken occures more than once in enumerated . attribute types of a single element type. Optional warning: (3.3.1 / p.27 in Spec)  L Validates that an element type has not more than one ID attribute defined. 4Validity constraint: One ID per Element Type (3.3.1 / p.26 in Spec)  R Validates that an element type has not more than one NOTATION attribute defined. :Validity constraint: One Notation per Element Type (3.3.1 / p.27 in Spec)  . Validates that an ID attributes has the type  IMPLIED or  REQUIRED. 1Validity constraint: ID Attribute Default (3.3.1 / p.26 in Spec)  7 Validates that all referenced notations are declared. 0Validity constraint: Notation Attributes (3.3.1 / p.27 in Spec)  ? Validates that notations are not declared for EMPTY elements. 9Validity constraint: No Notation on Empty Element (3.3.1 /p.27 in Spec)  G Validates that the default value matches the lexical constraints of it's type. 4Validity constraint: Attribute default legal (3.3.2 / p.28 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node H 2.parameter elemNames : list of all element names declared in the DTD M 3.parameter notationNames : list of all notation names declared in the DTD  returns : a list of errors cIRemoves doublicate declarations from the DTD, which first declaration is @ binding. This is the case for ATTLIST and ENTITY declarations. L returns : A function that replaces the children of DOCTYPE nodes by a list < where all multiple declarations are removed. bccbbc>portable experimentalUwe Schmidt (uwe@fh-wedel.de) MLookup-table which maps element names to their transformation functions. The ) transformation functions are XmlArrows. d&filter for transforming the document. - 1.parameter dtdPart : the DTD subset (Node DOCTYPE) of the XmlTree 7 2.parameter doc : the document subset of the XmlTree  returns : a list of errors "Traverse the XmlTree in preorder. a 1.parameter transEnv : lookup-table which maps element names to their transformation functions * returns : the whole transformed document $Build all transformation functions. D 1.parameter dtdPart : the DTD subset, root node should be of type DOCTYPE S returns : lookup-table which maps element names to their transformation functions /Build transformation functions for an element. , 1.parameter dtdPart : the children of the DOCTYPE node R 1.parameter nd : element declaration for which the transformation functions are  created & returns : entry for the lookup-table :Sort the attributes of an element in lexicographic order. ? returns : a function which takes an element (XTag), sorts its T attributes in lexicographic order and returns the changed element Normalize attribute values. D returns : a function which takes an element (XTag), normalizes its C attribute values and returns the changed element 2Set default attribute values if they are not set. L returns : a function which takes an element (XTag), adds missing attribute ; defaults and returns the changed element ddd?portable experimentalUwe Schmidt (uwe@fh-wedel.de)eADerives a regular expression with respect to a list of elements. & 1.parameter re : regular expression Q 2.parameter list : list of elements to which the regular expression is applied * returns : the derived regular expression :Derives a regular expression with respect to one element. L(delta e x) = x  L(e) 4 1.parameter re : regular expression to be derived J 2.parameter el : the element on which the regular expression is applied * returns : the derived regular expression  !"%&e %e& !"e@portable experimentalUwe Schmidt (uwe@fh-wedel.de) !"#ILookup-table which maps element names to their validation functions. The % validation functions are XmlArrows. fValidate a document. - 1.parameter dtdPart : the DTD subset (Node DOCTYPE) of the XmlTree 7 2.parameter doc : the document subset of the XmlTree  returns : a list of errors $"Traverse the XmlTree in preorder. \ 1.parameter valiEnv : lookup-table which maps element names to their validation functions  returns : list of errors % Build all validation functions. @ 1.parameter dtdPart : DTD subset, root node should be of type DOCTYPE O returns : lookup-table which maps element names to their validation functions &@Build a validation function for the document root. By root node / = is meant, which is the topmost dummy created by the parser. @ 1.parameter dtdPart : DTD subset, root node should be of type DOCTYPE & returns : entry for the lookup-table '(+Build validation functions for an element. , 1.parameter dtdPart : the children of the DOCTYPE node N 2.parameter nd : element declaration for which the validation functions are  created & returns : entry for the lookup-table )@Build validation functions for the content model of an element. ' Validity constraint: Element Valid (3 / p.18 in Spec) R 1.parameter nd : element declaration for which the content validation functions  are built C returns : a function which takes an element (XTag), checks if its P children match its content model and returns a list of errors *JBuild a regular expression from the content model. The regular expression " is provided by the module XmlRE. 8 1.parameter nd : node of the content model. Expected: CONTENT or  NAME 3 returns : regular expression of the content model +=Build validation functions for the attributes of an element. , 1.parameter dtdPart : the children of the DOCTYPE node T 2.parameter nd : element declaration for which the attribute validation functions  are created C returns : a function which takes an element (XTag), checks if its D attributes are valid and returns a list of errors ,7Validate that all attributes of an element are unique. 0 Well-formdness constraint: Unique AttSpec (3.1 / p.19 in Spec) C returns : a function which takes an element (XTag), checks if its E attributes are unique and returns a list of errors -Validate that all #"REQUIRED attributes are provided. 1 Validity constraint: Required Attributes (3.3.2 / p.28 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node K 2.parameter nd : element declaration which attributes have to be checked C returns : a function which takes an element (XTag), checks if all P required attributes are provided and returns a list of errors .Validate that #*FIXED attributes match the default value. 5 Validity constraint: Fixed Attribute Default (3.3.2 / p.28 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node K 2.parameter nd : element declaration which attributes have to be checked C returns : a function which takes an element (XTag), checks if all X fixed attributes match the default value and returns a list of errors /CValidate that an element has no attributes which are not declared. 0 Validity constraint: Attribute Value Type (3.1 / p.19 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node K 2.parameter nd : element declaration which attributes have to be checked C returns : a function which takes an element (XTag), checks if all G attributes are declared and returns a list of errors 0MValidate that the attribute value meets the lexical constraints of its type. / Validity constaint: Attribute Value Type (3.1 / p.19 in Spec) , 1.parameter dtdPart : the children of the DOCTYPE node K 2.parameter nd : element declaration which attributes have to be checked C returns : a function which takes an element (XTag), checks if all W attributes meet the lexical constraints and returns a list of errors fffAportable experimentalUwe Schmidt (uwe@fh-wedel.de) 1234ILookup-table which maps element names to their validation functions. The & validation functions are XmlFilters. g Perform the validation of the IDIDREFIDREFS constraints. - 1.parameter dtdPart : the DTD subset (Node DOCTYPE) of the XmlTree 7 2.parameter doc : the document subset of the XmlTree  returns : a list of errors 5"Traverse the XmlTree in preorder. Z 1.parameter idEnv : lookup-table which maps element names to their validation functions  returns : list of errors 6Returns the value of an element'-s ID attribute. The attribute name has to be  retrieved first from the DTD. F 1.parameter dtdPart : list of ID attribute definitions from the DTD F 2.parameter n : element which ID attribute value should be returned 0 returns : normalized value of the ID attribute 7JBuild collector functions which return XTag nodes with ID attributes from  a document. , 1.parameter dtdPart : the children of the DOCTYPE node M returns : lookup-table which maps element names to their collector function 80Build validation functions for checking if IDREF/IDREFS values match a value  of some ID attributes. , 1.parameter dtdPart : the children of the DOCTYPE node E 2.parameter idNodeList : list of all XTag nodes with ID attributes N returns : lookup-table which maps element names to their validation function 9:Validate that all ID values are unique within a document.  Validity constraint: ID (3.3.1 /p. 25 in Spec) E 1.parameter idNodeList : list of all XTag nodes with ID attributes , 2.parameter dtdPart : the children of the DOCTYPE node  returns : a list of errors :Validate that all IDREF/4IDREFS values match the value of some ID attribute. # Validity constraint: IDREF (3.3.1 / p.26 in Spec) \ 1.parameter idRefEnv : lookup-table which maps element names to their validation function - 2.parameter doc : the document to validate  returns : a list of errors gggBportable experimentalUwe Schmidt (uwe@fh-wedel.de)hEMain validation filter. Check if the DTD and the document are valid. I returns : a function which expects a complete document as XmlTree input = and returns a list of all errors found. iCheck if the DTD is valid. H returns : a function which expects an XmlTree from the parser as input H and returns a list of all errors found in the DTD. j4Check if the document corresponds to the given DTD. I returns : a function which expects a complete document as XmlTree input Q and returns a list of all errors found in the content part. ;kBfilter for transforming a document with respect to the given DTD. Validating parsers E are expected to normalize attribute values and add default values. ? This function should be called after a successful validation. A returns : a function which expects a complete XML document tree 4 and returns the transformed XmlTree lHRemoves doublicate declarations from the DTD which first declaration is @ binding. This is the case for ATTLIST and ENTITY declarations. L returns : A function that replaces the children of DOCTYPE nodes by a list < where all multiple declarations are removed. mnhijklmnmnhijlkhijklmnCportablestableUwe Schmidt (uwe@fh-wedel.de)o apply an  to an empty root node with q () as initial state 7the main entry point for running a state arrow with IO  when running  runX f& an empty XML root node is applied to f.  usually f? will start with a constant arrow (ignoring the input), e.g. a ,Text.XML.HXT.Arrow.ReadDocument.readDocument arrow. for usage see examples with .Text.XML.HXT.Arrow.WriteDocument.writeDocument +if input has to be feed into the arrow use 5 like in  runIOSLA f emptyX inputDoc  pq@the default global state, used as initial state when running an  with 5 or  o rstuvwxyz{|}~opqrstuvwxyz{|}~opqrstuvwxyz{|}~opqrstuvwxyz{|}~PportablestableUwe Schmidt (uwe@fh-wedel.de)m89vwxyz|}~ !"#$%&'()*+-./012456789:;<=om98ovwxyz|}~ !$"#%(&')*+-./012456=;9<87:Dportable experimentalUwe Schmidt (uwe@fh-wedel.de)<=>?@ABCDE Read the content of a document. $This routine is usually called from 6Text.XML.HXT.Arrow.ProcessDocument.getDocumentContents. 0The input must be a root node (constructed with 7), usually without children. m The attribute list contains all input parameters, e.g. URI or source file name, encoding preferences, ... G If the source name is empty, the input is read from standard input. aThe source is transformed into an absolute URI. If the source is a relative URI, or a file name, L it is expanded into an absolut URI with respect to the current base URI. ' The default base URI is of protocol "file". and points to the current working directory. &The currently supported protocols are "http", "file", "stdin" and "string". :The latter two are internal protocols. An uri of the form "stdin:" stands for the content of  the standard input stream. "string:some text" means, that " some text" is taken as input. : This internal protocol is used for reading from normal F values. GHIJEportable experimentalUwe Schmidt (uwe@fh-wedel.de)KLMNOPQRSTUVa filter for DTD processing $inclusion of external parts of DTD,  parameter entity substitution  conditional section evaluation Binput tree must represent a complete document including root node WXYZ[\]Fportable experimentalUwe Schmidt (uwe@fh-wedel.de) NWrite the contents of a document tree into an output stream (file or stdout). OIf textMode is set, writing is done with Haskell string output, else (default) - writing is done with lazy ByteString output 6write the tree representation of a document to a file 1write a document with indentaion and line numers ^_`aGportable experimentalUwe Schmidt (uwe@fh-wedel.de)bcdefghijklm!substitution of general entities 4input: a complete document tree including root node nHportable experimentalUwe Schmidt (uwe@fh-wedel.de)  XML parser _Input tree must be a root tree with a text tree as child containing the document to be parsed. PThe parser generates from the input string a tree of a wellformed XML document, Kprocesses the DTD (parameter substitution, conditional DTD parts, ...) and Zsubstitutes all general entity references. Next step is character reference substitution. &Last step is the document validation. 4Validation can be controlled by an extra parameter.  Example:  9 parseXmlDocument True -- parse and validate document  A parseXmlDocument False -- only parse document, don't validate IThis parser is useful for applications processing correct XML documents. o HTML parser _Input tree must be a root tree with a text tree as child containing the document to be parsed. _The parser tries to parse everything as HTML, if the HTML document is not wellformed XML or if Qerrors occur, warnings are generated. The warnings can be issued, or suppressed.  Example:  parseHtmlDocument True % : parse document and issue warnings VThis parser is useful for applications like web crawlers, where the pages may contain garbitray errors, but the application is only interested in parts of the document, e.g. the plain text. Document validation 5Input must be a complete document tree. The document +is validated with respect to the DTD spec. 0Only useful for XML documents containing a DTD. EIf the document is valid, it is transformed with respect to the DTD, Ynormalization of attribute values, adding default values, sorting attributes by name,... 6If no error was found, result is the normalized tree, 7else the error status is set in the list of attributes of the root node "/"4 and the document content is removed from the tree. Namespace propagation CInput must be a complete document tree. The namespace declarations Care evaluated and all element and attribute names are processed by >splitting the name into prefix, local part and namespace URI. @Naames are checked with respect to the XML namespace definition ;If no error was found, result is the unchanged input tree, 7else the error status is set in the list of attributes of the root node "/"4 and the document content is removed from the tree. .creates a new document root, adds all options 0 as attributes to the document root and calls . DIf the document name is the empty string, the document will be read  from standard input. For supported protocols see  pqIportable experimentalUwe Schmidt (uwe@fh-wedel.de)&the main filter for writing documents 5this filter can be configured by an option list like ,Text.XML.HXT.Arrow.ReadDocument.readDocument usage: & writeDocument optionList destination  if  destination  is the empty string or "-"", stdout is used as output device for available options see (Text.XML.HXT.Arrow.XmlState.SystemConfig   withOutputXML : . (default) issue XML: quote special XML chars >,<,",',& where neccessary 2 add XML processing instruction H and encode document with respect to output encoding,  withOutputHTML : f issue HTML: translate all special XML chars and all HTML chars with a corresponding entity reference > into entity references. Do not generate empty elements, e.g.  script .../% for HTML elements, that are allowed < to contain a none empty body. Result is for the example is  script ... /script. 8 The short form introduces trouble in various browsers.  withOutputXHTML :  same as withOutputHTML?, but all none ASCII chars are substituted by char references.  withOutputPLAIN : T Do not substitute any chars. This is useful when generating something else than XML/ HTML, e.g. Haskell source code.   withXmlPi yes/no :  Add a  ?xml version=... encoding=... ?: processing instruction to the beginning of the document.  Default is yes.  withAddDefaultDTD : n if the document to be written was build by reading another document containing a Document Type Declaration, E this DTD is inserted into the output document (default: no insert)  withShowTree yes/no : ; show DOM tree representation of document (for debugging)  withShowHaskell yes/no : 9 show Haskell representaion of document (for debugging) .a minimal main program for copying a document  has the following structure:   module Main  where   import Text.XML.HXT.Core   main :: IO ()  main  = do + runX ( readDocument [] "hello.xml"  >>> ) writeDocument [] "bye.xml"  )  return () ran example for copying a document from the web to standard output with global trace level 1, input trace level 2, output encoding isoLatin1, and evaluation of error code is:  module Main  where   import Text.XML.HXT.Core  import Text.XML.HXT.Curl  -- or  -- import Text.XML.HXT.HTTP  import System.Exit   main :: IO ()  main  = do  [rc] <- runX Y ( configSysVars [ withTrace 1 -- set the defaults for all read-, U , withCurl [] -- write- and other operations 3 -- or withHTTP [] ! ]  >>> N readDocument [ withTrace 2 -- use these additional T , withParseHTML yes -- options only for this read ! ] 9 "http://www.haskell.org/"  >>> > writeDocument [ withOutputEncoding isoLatin1 ! ] J "" -- output to stdout  >>>  getErrStatus  ) ! exitWith ( if rc >= c_err % then ExitFailure 1 # else ExitSuccess  ) AConvert a document into a string. Formating is done the same way ! and with the same options as in . Default output encoding is O no encoding, that means the result is a normal unicode encode haskell string. ) The default may be overwritten with the ;Text.XML.HXT.Arrow.XmlState.SystemConfig.withOutputEncoding option. % The XML PI can be suppressed by the $Text.XML.HXT.XmlKeywords.a_no_xml_pi option. =This arrow fails, when the encoding scheme is not supported. 5 The arrow is pure, it does not run in the IO monad. ? The XML PI is suppressed, if not explicitly turned on with an  option  (a_no_xml_pi, v_0)  indent and format output Qportable experimentalUwe Schmidt (uwe\@fh-wedel.de)      !"#$%&'()*+,-./01234567JportablestableUwe Schmidt (uwe@fh-wedel.de)the main document input filter Rthis filter can be configured by a list of configuration options, a value of type (Text.XML.HXT.XmlState.TypeDefs.SysConfig %for all available options see module "Text.XML.HXT.XmlState.SystemConfig   withValidate yes/no :  switch on/Ioff DTD validation. Only for XML parsed documents, not for HTML parsing.  withParseHTML yes/no :  switch on HTML parsing.  withParseByMimeType yes/no :  select XML/#HTML parser by document mime type.  text/ xml and text/xhtml are parsed as XML, text/html as HTML.  withCheckNamespaces yes/no :  Switch on/'off namespace propagation and checking  withInputEncoding encoding-spec :  Set default encoding.   withTagSoup : 9 use light weight and lazy parser based on tagsoup lib. C This is only available when package hxt-tagsoup is installed and  Text.XML.HXT.TagSoup is imported   withRelaxNG schema.rng : H validate document with Relax NG, the parameter is for the schema URI. R This implies using XML parser, no validation against DTD, and canonicalisation.   withCurl [ curl-option...] : + Use the libCurl binding for HTTP access. @ This is only available when package hxt-curl is installed and  Text.XML.HXT.Curl is imported   withHTTP [ http-option...] : 0 Use the Haskell HTTP package for HTTP access. @ This is only available when package hxt-http is installed and  Text.XML.HXT.HTTP is imported  examples:   readDocument [] "test.xml" reads and validates a document "test.xml"?, no namespace propagation, only canonicalization is performed   ...  import Text.XML.HXT.Curl  ...  ' readDocument [ withValidate no . , withInputEncoding isoLatin1 ( , withParseByMimeType yes  , withCurl [] 1 ] \"http:\/\/localhost\/test.php\" reads document "test.php"u, parses it as HTML or XML depending on the mimetype given from the server, but without validation, default encoding F. !HTTP access is done via libCurl.  ( readDocument [ withParseHTML yes . , withInputEncoding isoLatin1  ] "" hreads a HTML document from standard input, no validation is done when parsing HTML, default encoding is F,  - readDocument [ withInputEncoding isoLatin1 & , withValidate no 5 , withMimeTypeFile "/etc/mime.types" ' , withStrictInput yes  ] "test.svg" reads an SVG document from "test.svg"D, sets the mime type by looking in the system mimetype config file, default encoding is F,   ...  import Text.XML.HXT.Curl  import Text.XML.HXT.TagSoup  ...  ' readDocument [ withParseHTML yes  , withTagSoup 4 , withProxy "www-cache:3128" & , withCurl [] & , withWarnings no * ] "http://www.haskell.org/" ?reads Haskell homepage with HTML parser, ignoring any warnings 7(at the time of writing, there were some HTML errors), 'with http access via libCurl interface  and proxy " www-cache" at port 3128, *parsing is done with tagsoup HTML parser. This requires packages "hxt-curl" and " hxt-tagsoup" to be installed  * readDocument [ withValidate yes * , withCheckNamespaces yes * , withRemoveWS yes ( , withTrace 2 ) , withHTTP [] & ] "http://www.w3c.org/" zread w3c home page (xhtml), validate and check namespaces, remove whitespace between tags, trace activities with level 2. .HTTP access is done with Haskell HTTP package "for minimal complete examples see .Text.XML.HXT.Arrow.WriteDocument.writeDocument and o4, the main starting point for running an XML arrow. rsthe arrow version of $, the arrow input is the source URI :read a document that is stored in a normal Haskell String Fthe same function as readDocument, but the parameter forms the input.  All options available for  are applicable for readString. VDefault encoding: No encoding is done, the String argument is taken as Unicode string the arrow version of $, the arrow input is the source URI Vparse a string as HTML content, substitute all HTML entity refs and canonicalize tree 2 (substitute char refs, ...). Errors are ignored. A simpler version of  but with less functionality.  Does not run in the IO monad _parse a string as XML content, substitute all predefined XML entity refs and canonicalize tree  (substitute char refs, ...) Kportable experimentalUwe Schmidt (uwe@fh-wedel.de)LThe class for overloading , the default pickler <conversion of an arbitrary value into an XML document tree. ?The pickler, first parameter, controls the conversion process. : Result is a complete document tree including a root node ?Conversion of an XML document tree into an arbitrary data type The inverse of . ( This law should hold for all picklers: ' unpickle px . pickle px $ v == Just v . 8 Not every possible combination of picklers make sense. C For reconverting a value from an XML tree, is becomes neccessary,  to introduce "enough"! markup for unpickling the value 7Pickles a value, then writes the document to a string. The zero pickler 0Encodes nothing, fails always during unpickling Lift a value to a pickler QWhen pickling, nothing is encoded, when unpickling, the given value is inserted.  This pickler always succeeds. !Lift a Maybe value to a pickler. Nothing is mapped to the zero pickler, Just x is pickled with xpLift x. pickle/-unpickle combinator for sequence and choice.  When the first unpickler fails, W the second one is taken, else the third one configured with the result from the first 0 is taken. This pickler is a generalisation for  and  . TThe schema must be attached later, e.g. in xpPair or other higher level combinators #Combine two picklers sequentially. If the first fails during ' unpickling, the whole unpickler fails #combine tow picklers with a choice .Run two picklers in sequence like with xpSeq. - When during unpickling the first one fails, 5 an alternative pickler (first argument) is applied. 9 This pickler is only used as combinator for unpickling. 6map value into another domain and apply pickler there %One of the most often used picklers. like ?, but if the inverse mapping is undefined, the unpickler fails ;Map a value into another domain. If the inverse mapping is * undefined (Nothing), the unpickler fails %pickle a pair of values sequentially 2Used for pairs or together with wrap for pickling * algebraic data types with two components Like  but for triples Like  and  but for 4-tuples Like  and  but for 5-tuples Like  and  but for 6-tuples Like  and  but for 7-tuples :Thanks to Tony Morris for doing xp7Tuple, ..., xp24Tuple. #Hopefully no one needs a xp25Tuple &Pickle a string into an XML text node :One of the most often used primitive picklers. Attention:  For pickling empty strings use . If the text has a more ( specific datatype than xsd:string, use  &Pickle a string into an XML text node =Text pickler with a description of the structure of the text 9 by a schema. A schema for a data type can be defined by .  In  Text.XML.HXT.Arrow.Pickle.Schema, there are some more functions for creating  simple datatype descriptions. 1Pickle a possibly empty string into an XML node. BMust be used in all places, where empty strings are legal values. L If the content of an element can be an empty string, this string disapears B during storing the DOM into a document and reparse the document. W So the empty text node becomes nothing, and the pickler must deliver an empty string, + if there is no text node in the document. MPickle a possibly empty string with a datatype description into an XML node. Like 9 but with extra Parameter for datatype description as in . <Pickle an arbitrary value by applyling show during pickling  and read during unpickling.  Real pickling is then done with . B One of the most often used pimitive picklers. Applicable for all  types which are instances of Read and Show Pickle an unsigned $Pickle an XmlTree by just adding it @Usefull for components of type XmlTree in other data structures jPickle a whole list of XmlTrees by just adding the list, unpickle is done by taking all element contents. ,This pickler should always be combined with . for taking the whole contents of an element. fPickle a string representing XML contents by inserting the tree representation into the XML document. 3Unpickling is done by converting the contents with   into a string, b this function will escape all XML special chars, such that pickling the value back becomes save.  Pickling is done with  GEncoding of optional data by ignoring the Nothing case during pickling H and relying on failure during unpickling to recompute the Nothing case $The default pickler for Maybe types 'Optional conversion with default value 6The default value is not encoded in the XML document, F during unpickling the default value is inserted if the pickler fails DEncoding of list values by pickling all list elements sequentially. ?Unpickler relies on failure for detecting the end of the list. F The standard pickler for lists. Can also be used in combination with  ' for constructing set and map picklers (Encoding of a none empty list of values 9Attention: when calling this pickler with an empty list,  an internal error "head of empty list is raised". Standard pickler for maps 2This pickler converts a map into a list of pairs. A All key value pairs are mapped to an element with name (1.arg), > the key is encoded as an attribute named by the 2. argument, E the 3. arg is the pickler for the keys, the last one for the values Pickler for sum data types. CEvery constructor is mapped to an index into the list of picklers. \ The index is used only during pickling, not during unpickling, there the 1. match is taken Pickler for wrapping/$unwrapping data into an XML element SExtra parameter is the element name given as a QName. THE pickler for constructing  nested structures  Example:  & xpElemQN (mkName "number") $ xpickle will map an (42::Int) onto  <number>42</number>  convenient Pickler for xpElemQN  xpElem n = xpElemQN (mkName n) Pickler for wrapping/Gunwrapping data into an XML element with an attribute with given value NTo make XML structures flexible but limit the number of different elements, it' s sometimes D useful to use a kind of generic element with a key value structure  Example:  ! <attr name="key1">value1</attr> ! <attr name="key2">value2</attr> ! <attr name="key3">value3</attr> (the Haskell datatype may look like this  > type T = T { key1 :: Int ; key2 :: String ; key3 :: Double } .Then the picker for that type looks like this  xpT :: PU T @ xpT = xpWrap ( uncurry3 T, \ t -> (key1 t, key2 t, key3 t) ) $ E xpTriple (xpElemWithAttrValue "attr" "name" "key1" $ xpickle) E (xpElemWithAttrValue "attr" "name" "key2" $ xpText0) E (xpElemWithAttrValue "attr" "name" "key3" $ xpickle) Pickler for storing/retreiving data into/from an attribute value HThe attribute is inserted in the surrounding element constructed by the  pickler  convenient Pickler for xpAttrQN  xpAttr n = xpAttrQN (mkName n) A text attribute. ;Add an optional attribute for an optional value (Maybe a). %Add an attribute with a fixed value. 5Useful e.g. to declare namespaces. Is implemented by  LLLLportable experimentalUwe Schmidt (uwe@fh-wedel.de) 5store an arbitray value in a persistent XML document HThe pickler converts a value into an XML tree, this is written out with   Text.XML.HXT.Arrow.writeDocument. The option list is passed to  Text.XML.HXT.Arrow.writeDocument %An option evaluated by this arrow is .  If  is set (n@), the pickler DTD is added as an inline DTD into the document. >Option for generating and adding DTD when document is pickled ,read an arbitray value from an XML document The document is read with Text.XML.HXT.Arrow.readDocument. Options are passed  to Text.XML.HXT.Arrow.readDocument/. The conversion from XmlTree is done with the  pickler. 7 xpickleDocument xp al dest >>> xunpickleDocument xp al' dest  is the identity arrow ] when applied with the appropriate options. When during pickling indentation is switched on, 3 the whitespace must be removed during unpickling. 4Write out the DTD generated out of a pickler. Calls  xpicklerDTD 2The arrow for generating the DTD out of a pickler =A DTD is generated from a pickler and check for consistency. ' Errors concerning the DTD are issued. An arrow for checking picklers @A value is transformed into an XML document by a given pickler, ? the associated DTD is extracted from the pickler and checked, < the document including the DTD is tranlated into a string, = this string is read and validated against the included DTD,  and unpickled. / The last step is the equality with the input. AIf the check succeeds, the arrow works like this, else it fails. *The arrow version of the pickler function ,The arrow version of the unpickler function (Compute the associated DTD of a pickler L_dfLfd_ Mportable experimentalUwe Schmidt (uwe@fh-wedel.de)#tuvwxyz{|Echeck whether a sequence of XmlTrees match an Xml regular expression The arrow for . BThe expession is build up from simple arrows acting as predicate () for 6 an XmlTree and of the usual cobinators for sequence (), repetition  (, mkRep', ) and choice (, ) :split the sequence of trees computed by the filter a into The arrow for  . ,a first part matching the regex and a rest, M if a prefix of the input sequence does not match the regex, the arrow fails 7 else the pair containing the result lists is returned Zscan the input sequence with a regex and give the result as a list of lists of trees back ` the regex must at least match one input tree, so the empty sequence should not match the regex The arrow for  . }~Cmatch a sequence of XML trees with a regular expression over trees TIf the input matches, the result is Nothing, else Just an error message is returned  Lsplit a sequence of XML trees into a pair of a a matching prefix and a rest 4If there is no matching prefix, Nothing is returned  Nscan a sequence of XML trees and split it into parts matching the given regex KIf the parts cannot be split because of a missing match, or because of the . empty sequence as match, Nothing is returned       Nportable experimentalUwe Schmidt (uwe@fh-wedel.de) RRead a serialied value from a file, optionally decompress it and decode the value F In case of an error, the error message is issued and the arrow fails  CSerialize a value, optionally compress it, and write it to a file. F In case of an error, the error message is issued and the arrow fails       RportablestableUwe Schmidt (uwe@fh-wedel.de)Z0123456789:;<=>?@ABCDEF()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~_df      !"#$%&'()*+,-./0123456789      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstvwxyz|}~      !"#$%&'()*+-./012456789:;<=o  SSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                  ! " # $ % & ' ( ) * + , - . / 0 1 2 3456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuOGvwxyz{|}~       !!!!!!!""""""""""""""""""""""""""""""""""""""""""""""""""""""######################$$$$$$$$$$$$$$$$$ $ $ $ $ $$$$$$$%%%%%%&&&&&& &!&"&#&$&%&&&'&(&)&*&+&,&-&.'/'0'1'2'3'f'g'h'i'j'k'4'l'm'n'o'p'q'5's'6'7'8'9':';'<'['''=''(>(A(@(E(D(?(I(H(G(F(@(A(B(C(D(E(F(G(H(I(J(K(L(M(N)O)O)P)Q*R*R*S*T+U+V,W,X,Y,Z,[,\,],^-_-`-a.b.b.c/d/d/e/f/g0h0i0j0k0l0m0n0o0p0q0r0s0t0u0v0w0x0y0z0{0|0}0~00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 0 0 0 0000000000000000000 0!0"0#0$0%0&1'1(1)2*2+2,2-2.2/20212223242526272,28292:2;2<22222222=222222>2?2@2A2B2C2D2E2F2G2H2I22222222)2+22J2K2L2M2N2O2P2Q2R2S2M2N2T2U2V2W2X2Y2Z22222222222 2 2 2 2[2 222222\2]2^2_2222`2222a22b2!2#2$2c2d2-2e2f2g2h2i2x2y3j3k3l3m3n3o3p3q3r3s3t3u3v3w3x3y3z3{3|3}3~344444444444444444444444444444444444444555555555555555555555555555555555555555555555555555555666666666666677777777777777777777777777777777888888888888 9 9 9 9 999999999:::::::::: :!:":#:$:%:&:':(;);*;+;,;-;.;/;0;1;2;3;4;5;6;7;8;9;:;;;<;=;>;?;@;A;B;C;D;E;F;G;H;I<J<K=L=M>N?v@OAPBQBLBOBNBMBRBSCTCUCVCWCXCYCZC[C\C]C^C_C`CaCbCcCdCeDfDgDhDiDjDkDlEmFnFoFpFqFrGsHHtHHuHvHwHxIyIzI{I|J}J~JJJJKKKKKKKKKKKKKKKKK$KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKLLLLLLLLLMMMMMMMMMMMMMMMMMMuMMMMNN                         ! " # $ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUV W X Y Z [ \  T ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w!x!y!V!z!{!|!}!~!!!!!`!<!=!?!B!!!!!!!!!!!!!!!!!!!!!!G!T!!!!![!\!]!_!`!!77777777777777888888<<<<<<<<<<<<<=====>>>>>>>>>?@@@@@@@@@@@@@@@@@AAAAAAAAAAB D D D D DDDDDDDDDDEEEEEEEE E!E"E#E$E%E&E'E(E)E*E+F,F-F.F/G0G0GG1G2G3G4G5G6G7G8G9G:H;HOH<J=J>M?MMMM@MAMBMCMDMEMFMGMHNINJK hxt-9.1.0!Text.XML.HXT.Parser.XmlCharParserText.XML.HXT.DTDValidation.RE!Text.XML.HXT.DOM.MimeTypeDefaultsText.XML.HXT.DOM.MimeTypesText.XML.HXT.DOM.UtilText.XML.HXT.DOM.XmlKeywords'Text.XML.HXT.Parser.ProtocolHandlerUtilText.XML.HXT.Version*Text.XML.HXT.XMLSchema.DataTypeLibW3CNamesText.XML.HXT.Parser.XmlEntities!Text.XML.HXT.Parser.XhtmlEntitiesText.XML.HXT.IO.GetFILEData.Function.Selector Data.AtomData.AssocListData.Tree.ClassControl.Arrow.ArrowStateData.Tree.NavigatableTree.Class#Data.Tree.NavigatableTree.XPathAxisControl.FlatSeqData.Tree.NTree.TypeDefsData.Tree.NTree.EditData.Tree.NTree.Zipper.TypeDefsText.XML.HXT.DOM.QualifiedNameText.XML.HXT.DOM.TypeDefsText.XML.HXT.DOM.XmlNode"Text.XML.HXT.Parser.XmlTokenParser%Text.XML.HXT.Parser.XmlDTDTokenParserText.XML.HXT.DOM.ShowXmlText.XML.HXT.DOM.FormatXmlTreeText.XML.HXT.Parser.XmlParsecText.XML.HXT.Parser.HtmlParsec Text.XML.HXT.Parser.XmlDTDParser Text.XML.HXT.Arrow.Pickle.SchemaText.XML.HXT.Arrow.Pickle.DTDControl.Arrow.ArrowListControl.Arrow.ArrowNFControl.Arrow.ArrowIf"Control.Arrow.ArrowNavigatableTreeControl.Arrow.ArrowTreeControl.Arrow.ListArrowControl.Arrow.StateListArrowControl.Arrow.NTreeEditControl.Arrow.ArrowIOControl.Arrow.ArrowExcControl.Arrow.IOListArrowControl.Arrow.IOStateListArrow$Text.XML.HXT.Arrow.XmlState.TypeDefs)Text.XML.HXT.Arrow.XmlState.MimeTypeTableText.XML.HXT.Arrow.XmlArrow)Text.XML.HXT.Arrow.XmlState.ErrorHandling(Text.XML.HXT.Arrow.XmlState.SystemConfigText.XML.HXT.Arrow.XmlOptions"Text.XML.HXT.Arrow.ParserInterfaceText.XML.HXT.Arrow.EditText.XML.HXT.Arrow.Namespace)Text.XML.HXT.Arrow.XmlState.TraceHandling'Text.XML.HXT.Arrow.XmlState.URIHandling#Text.XML.HXT.DTDValidation.TypeDefs3Text.XML.HXT.DTDValidation.AttributeValueValidation(Text.XML.HXT.DTDValidation.DTDValidation,Text.XML.HXT.DTDValidation.DocTransformation Text.XML.HXT.DTDValidation.XmlRE(Text.XML.HXT.DTDValidation.DocValidation'Text.XML.HXT.DTDValidation.IdValidation%Text.XML.HXT.DTDValidation.Validation+Text.XML.HXT.Arrow.XmlState.RunIOStateArrow Text.XML.HXT.Arrow.DocumentInput Text.XML.HXT.Arrow.DTDProcessing!Text.XML.HXT.Arrow.DocumentOutput,Text.XML.HXT.Arrow.GeneralEntitySubstitution"Text.XML.HXT.Arrow.ProcessDocument Text.XML.HXT.Arrow.WriteDocumentText.XML.HXT.Arrow.ReadDocumentText.XML.HXT.Arrow.Pickle.XmlText.XML.HXT.Arrow.PickleText.XML.HXT.Arrow.XmlRegexText.XML.HXT.Arrow.BinaryText.XML.HXT.DOM.InterfaceText.XML.HXT.Arrow.XmlStateControl.Arrow.ListArrowsText.XML.HXT.CoreXPStatexps_normalizeNewline xps_userState SimpleXParserXParserwithNormNewlinewithoutNormNewlinexmlChar xmlNameCharxmlNameStartChar xmlNCNameCharxmlNCNameStartChar xmlLetter xmlSpaceChar xmlCRLFCharRERE_ALTRE_SEQRE_OPTRE_PLUSRE_REPRE_DOTRE_SYMRE_UNITRE_ZEROre_zerore_unitre_symre_dotre_repre_plusre_optre_seqre_altnullablematchescheckREprintREmimeTypeDefaults MimeTypeTableapplication_xhtmlapplication_xml&application_xml_external_parsed_entityapplication_xml_dtd text_htmltext_pdf text_plain text_xdtdtext_xmltext_xml_external_parsed_entityisTextMimeTypeisHtmlMimeType isXmlMimeTypedefaultMimeTypeTableextensionToMimeTypereadMimeTypeTableparseMimeTypeTable stringTrim stringToUpper stringToLower stringAll stringFirst stringLastnormalizeNumbernormalizeWhitespacenormalizeBlanks escapeURIstringEscapeXml textEscapeXml attrEscapeXml stringToInthexStringToIntdecimalStringToIntstringToHexStringcharToHexStringintToHexStringdoublessingles noDoublesswappartitionEithertoMaybeuncurry3uncurry4t_xmlt_roota_columna_contentLength a_default a_encodinga_kinda_linea_module a_modifiera_namea_output_encodinga_perefa_source a_standalonea_statusa_typea_urla_value a_versiona_xmla_xmlnsv_yesv_nov_0v_1v_2v_any v_childrenv_choicev_emptyv_pcdatav_mixedv_seqv_nullv_optionv_starv_plusk_anyk_cdatak_emptyk_entity k_entitiesk_idk_idrefk_idrefs k_includek_ignore k_nmtoken k_nmtokensk_perefk_publick_system k_enumerationk_fixed k_impliedk_ndata k_notationk_pcdata k_required k_default dtdPrefixtransferPrefixtransferProtocoltransferVersiontransferMimeTypetransferEncodingtransferDefaultURItransferStatustransferMessage transferURI httpPrefixstringProtocol xmlNamespacexmlnsNamespacerelaxNamespaceparseContentType hxt_versionw3cNS xsd_stringxsd_normalizedString xsd_token xsd_language xsd_NMTOKEN xsd_NMTOKENSxsd_Name xsd_NCNamexsd_ID xsd_IDREF xsd_IDREFS xsd_ENTITY xsd_ENTITIES xsd_anyURI xsd_QName xsd_NOTATION xsd_hexBinaryxsd_base64Binary xsd_decimal xsd_integerxsd_nonPositiveIntegerxsd_negativeIntegerxsd_nonNegativeIntegerxsd_positiveIntegerxsd_longxsd_int xsd_shortxsd_bytexsd_unsignedLongxsd_unsignedIntxsd_unsignedShortxsd_unsignedByte xsd_length xsd_maxLength xsd_minLengthxsd_maxExclusivexsd_minExclusivexsd_maxInclusivexsd_minInclusivexsd_totalDigitsxsd_fractionDigits xsd_patternxsd_enumeration xmlEntities xhtmlEntities getStdinContgetContComp3comp3Comp2comp2Comp1comp1SelectorSgetSsetSchgSchgM mkSelectoridS.&&&.AtomnewAtomshare AssocList lookupDeflookup1hasEntryaddEntry addEntriesdelEntry delEntriesTreemkTreemkLeafisLeafisInnergetNode getChildren changeNodechangeChildrensetNode setChildrenfoldTree nodesTree depthTreecardTree formatTree formatNTree' ArrowState changeState accessStategetStatesetState nextStateNavigatableTreeModify addTreeLeft addTreeRight dropTreeLeft dropTreeRight substThisTreeNavigatableTreeToTreefromTreetoTreeNavigatableTreemvUpmvDownmvLeftmvRight maybeStar maybePlus parentAxis ancestorAxisancestorOrSelfAxis childAxisdescendantAxisdescendantOrSelfAxisrevDescendantOrSelfAxisfollowingSiblingAxisprecedingSiblingAxisselfAxis followingAxis precedingAxismvToRootisAtRootWNFDatarwnfrwnf2$!!flatseqrlnfNTreesNTreeeditNTreeBottomUp mapNTree'NTCrumbNTC NTBreadCrumbsNTZipperNTZntreecontext toNTZipper fromNTZipperupdown toTheRight toTheLeft addToTheLeft addToTheRightdropFromTheLeftdropFromTheRightisTopup1QName localPart' namePrefix' namespaceUri'NsEnvXNameunXN isNullXName namePrefix localPart namespaceUrisetNamespaceUri' setLocalPart'setNamePrefix' qualifiedNamequalifiedName' universalName universalUribuildUniversalNamemkQName'mkPrefixLocalPartmkNamemkQName mkSNsNamemkNsName equivQNameequivUri equalQNameBynormalizeNsUri setNamespaceisNCNameisWellformedQualifiedNameisWellformedQNameisWellformedNSDeclisWellformedNameSpaceNameisNameSpaceNameisDeclaredNamespacetoNsEnv nullXNamexmlnsNamespaceXName xmlnsXNamexmlNamespaceXNamexmlXNamexmlnsQNnewXNamenewQName ChildNodes XmlNodeSetXNSthisNode attrNodes childNodes AttributesBlobDTDElemPEREFNAMECONDSECTNOTATIONPENTITYENTITYATTLISTCONTENTELEMENTDOCTYPEXNodeXErrorXAttrXDTDXTagXPiXCdataXCmt XEntityRefXCharRefXBlobXText XmlNavTrees XmlNavTreeXmlTreesXmlTreerwnfAttributes blobToString stringToBlobc_okc_warnc_errc_fatalXmlNodeisTextisBlob isCharRef isEntityRefisCmtisCdataisPiisElemisRootisDTDisAttrisErrormkTextmkBlob mkCharRef mkEntityRefmkCmtmkCdatamkPimkErrorgetTextgetBlob getCharRef getEntityRefgetCmtgetCdata getPiName getPiContent getElemNamegetAttrl getDTDPart getDTDAttrl getAttrName getErrorLevel getErrorMsggetNamegetQualifiedNamegetUniversalNamegetUniversalUri getLocalPart getNamePrefixgetNamespaceUri changeText changeBlob changeCmt changeNamechangeElemName changeAttrlchangeAttrName changePiNamechangeDTDAttrlsetTextsetBlobsetCmtsetName setElemName setElemAttrl setAttrName setPiName setDTDAttrl mkElementNode mkAttrNode mkDTDNode mkElementmkRootmkAttr mkDTDElemaddAttr mergeAttrl mkElement'mkRoot'mkAttr'mkText' mkCharRef' mkEntityRef'mkCmt'mkCdata'mkPi'mkError' mkDTDElem'sPacesPace0skipSskipS0 asciiLetternamencNameqNamenmtokennamesnmtokens singleChar singleChars entityValue attrValueattrChar systemLiteral pubidLiteral referencecharRef entityRef peReferenceencName versionNumkeywordkeywordsquoteddqsqltgtsemiamp separatorbarcommaeqlparrpar checkStringallButallBut1concResmkListnameTnmtokenT entityValueT entityTokensT entityCharT attrValueT attrValueT' singleCharsT referenceTcharRefT entityRefT peReferenceTdtdDeclTokenizer dtdDeclStart dtdDeclEnddtdTokendtdCharspercentxshow xshowBlobxshow'xshow''formatXmlContents formatXmlTreecharData charData'commentpIcDSectdocument document'prologxMLDeclxMLDecl' versionInfomisc doctypedecl markupdeclsDDeclelementcontentcontentWithTextDecltextDecl encodingDeclxreadparseXmlContent parseXmlTextparseXmlDocumentremoveEncodingSpec parseXmlPartparseXmlDTDPartparseXmlEntityValueAsContentparseXmlEntityValueAsAttrValue parseNMToken parseNameparseXmlEncodingSpecparseXmlEntityEncodingSpecparseXmlDocEncodingSpec parseHtmlTextparseHtmlDocumentparseHtmlContentisEmptyHtmlTag emptyHtmlTagsisInnerHtmlTagOf closesHtmlTag elementDecl attlistDecl entityDecl notationDeclparseXmlDTDEntityValueparseXmlDTDdeclPartparseXmlDTDdecl DataTypeDescrDTDescrdtLibdtNamedtParamsSchemasNameSchemaCharDatasc_dtElemRef AttributeElementsc_nRepsc_lbsc_ubsc_1AltSeqsc_lAnyisScXsd isScFixedisScEnumisScElemisScAttr isScElemRef isScCharDataisScSAREisScListisScOptxsdParamscDTscDTxsdscString scString1scFixedscEnum scNmtoken scNmtokensscEmptyscSeqscSeqsscNullscAltscAltsscOptionscListscList1scOptscRepscElemscAttrDTDdescr dtdDescrToXmlcheckAttrModellcheckAMcheckAMCcheckContentModell scContToXmlscWrapscContscConts scAttrToXmlcheckErrfoundErrdtdDescrelementDeclarations elementDecs elemNameselemNameelemRefsattrDec remAttrDec ArrowListarr2arr3arr4arr2AarrLarr2LconstAconstLisA>>.>.listAunlistAthisnone withDefaultsingleapplyA$<$<<$<<<$<<<<$<$mergeAperformcatAseqAArrowWNFrwnfArwnf2AArrowNFrnfAstrictAIfThen:->ArrowIfifAifPnegwhenwhenPwhenNotwhenNotPguardsguardsPfilterA containing notContainingorElsechoiceAtagAspanA partitionAArrowNavigatableTreemoveUpmoveDownmoveLeft moveRightdescendantOrFollowingAxis moveToRootaddNavremNavwithNav withoutNav filterAxismoveOnchangeThisTree addToOneSide ArrowTreehasNodeprocessChildrenreplaceChildren/>//>Control.Category>>>GHC.Listspan Data.List partitionEntityRefTablecanonicalizeTree'canonicalizeNodes has2XTextcollapseXText'xmlEntityRefTablexhtmlEntityRefTablebuildEntityRefTable lookupRefremoveRootWhiteSpace indentRoot indentTreesinsertIndentation insertNothingcleanupNamespaces'processWithNsEnv1 attachEnvpropagateNamespaceEnvvalidateNamespaces1validate1Namespacesarrfirstapp|||loopleftApp^<<<<^>>^^>>returnA&&&***secondArrow runKleisliKleisli zeroArrow ArrowZero ArrowPlus+++rightleft ArrowChoice ArrowApply ArrowMonad ArrowLoop<<< checkValuecheckValueEnumerationcheckValueEntitycheckValueEntitiescheckValueNmtokencheckValueNmtokens checkValueIdcheckValueIdrefcheckValueIdrefs checkForNamecdataNormalizationotherNormalizationreduceWSSequences checkNamevalidateNotationsvalidateEntitiesvalidateElementsvalidateAttributesTransFctElemName TransEnvTable traverseTreebuildAllTransformationFunctionsbuildTransformationFunctionslexicographicAttributeOrdernormalizeAttributeValuessetDefaultAttributeValuesValFctValiEnv ValiEnvTablebuildAllValidationFunctionsbuildValidateRoot checkRegexbuildValidateFunctionsbuildContentValidationcreateREbuildAttributeValidationnoDoublicateAttributescheckRequiredAttributescheckFixedAttributescheckNotDeclardAttributescheckValuesOfAttributesIdFctIdEnv IdEnvTable getIdValuebuildIdCollectorFctsbuildIdrefValidationFctscheckForUniqueIdscheckIdReferencesgetDTDprotocolHandlersgetProtocolHandlergetUnsupportedgetStringContentsgetFileContentsgetStdinContents addMimeType addTxtContentgetHttpContentssetBaseURIFromDocGHC.BaseStringgetXmlContents' isMimeDoc isTextDoc isXmlHtmlDocPEEnv DTDStateArrowRecListDTDPartExternalInternal emptyPeEnv lookupPeEnv addPeEntry getPeValueaddPesubstParamEntitiessubstParamEntity predefDTDPartexternalDTDPartgetExternalDTDPartgetExternalParamEntityValuetraceDTDgetEncodingParamgetOutputEncoding isBinaryDocgetOutputEncoding'GEEnvGEArrow GESubstArrow GEContextReferenceInEntityValueReferenceInAttributeValueReferenceInContent emptyGeEnv lookupGeEnv addGeEntryprocessGeneralEntitycheckUndefinedEntityRefs transformDoc readDocument'readDocument''RngStarDotSymUnitZerormStardelta'splitXmlRegex' scanXmlRegex'decodeBinaryValueencodeBinaryValue