p       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!""""""" # # # # ##$$$$$$$$$$$$$$$$$ $!$"$#$$$%$&$'$($)$*$+%,%-%.%/%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(g(h(i(j(k(l(m(n(o(p(q(r(s(t(u(v(w(x(y(z({(|(}(~())))))))))))))))**+++++++++++++++++,,,,,,,,---................../////////////////////00000000000000000000000000000000000000000000000000000 0 0 0 0 0000000000000000000 0!0"0#0$0%0&0'0(0)0*0+0,0-0.0/000102030405060708090:0;0<0=0>0?0@0A0B0C0D0E0F0G0H0I0J0K0L0M0N0O0P0Q0R0S0T0U0V1W1X1Y1Z1[1\1]1^1_1`1a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x2y2z2{2|2}2~2222223333333333333334444444444444444444444444444444445566789:;;;;;;;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< < < < < <<<<<<<<<<<<<<<<<<< <!<"<#<$<%<&<'<(<)<*<+<,<-<.</<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<g<h<i<j<k<l<m<n<o<p<q<r<s<t<u<v<w<x<y<z<{<|<}<~<<<<<<<<<<<<<<<<<<<<<<<<<<<======================>>>??????????????????????????????????????????@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ @ @ @ @@@@@@@@@AAAAAAAAAA A!A"A#B$B%B&B'B(B)B*B+B,B-B.B/B0B1B2B3B4B5B6B7C8C9C:C;C<C=C>C?C@CACBCCCDCECFCGCHCIDJDKDLDMDNDOEPEQFRGSGTGUGVGWGXGYHZH[H\H]H^H_H`HaIbIcIdIeIfIgIhIiIjIkIlImInIoIpIqIrIsItIuIvIwIxIyIzI{I|J}J~KKKKKLLLLMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNN NR#Copyright (C) 2005-2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableSafe09;<=?0Namespace of the W3C XML schema datatype library9  !"#$%&'()*+,-./0123456789  !"#$%&'()*+,-./0123456789  !"#$%&'()*+,-./0123456789  !"#$%&'()*+,-./012345678Safe09;<=?9999Safe09;<=?:<list of predefined XML entity names and their unicode values::::Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableSafe09;<=?C parse a single Unicode characterDparse a XML name characterE parse a XML name start characterFparse a XML NCName characterG"parse a XML NCName start characterHparse a XML letter characterIWhite Space (2.3)8end of line handling (2.11) will be done before or with J parserJWhite Space NormalizationAend of line handling (2.11) #x0D and #x0D#x0A are mapped to #x0A;<=>?@ABCDEFGHIJ;<=>?@ABCDEFGHIJ@?;<=>ABCDEFGHIJ ;<=>?@ABCDEFGHIJSafe09;<=?KAtable with all XHTML entity refs and corresponding unicode valuesKKKKCopyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableSafe09;<=?L"Data type for regular expressions.V1Constructs a regular expression for an empty set.#1.parameter errMsg : error message-returns : regular expression for an empty setW6Constructs a regular expression for an empty sequence.2returns : regular expression for an empty sequenceX6Constructs a regular expression for accepting a symbol,1.parameter sym : the symbol to be accepted3returns : regular expression for accepting a symbolY?Constructs a regular expression for accepting any singel symbol<returns : regular expression for accepting any singel symbolZ=Constructs an optional repetition (*) of a regular expression41.parameter re_a : regular expression to be repeted returns : new regular expression remove redundant nested *'s in RE theoretically this is unneccessary, but without this simplification the runtime can increase exponentally when computing deltas, e.g. for a** or (a|b*)* which is the same as (a|b)*[3Constructs a repetition (+) of a regular expression41.parameter re_a : regular expression to be repeted returns : new regular expression\0Constructs an option (?) of a regular expression51.parameter re_a : regular expression to be optional returns : new regular expression]4Constructs a sequence (,) of two regular expressions81.parameter re_a : first regular expression in sequence92.parameter re_b : second regular expression in sequence returns : new regular expression^8Constructs 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)GThis check indicates if a regular expression fits to a sentence or not.21.parameter re : regular expression to be checked`returns : true if regular expression matches the empty sequence, otherwise false 8Derives a regular expression with respect to one symbol.L(delta e x) = x L(e)21.parameter re : regular expression to be derivedH2.parameter sym : the symbol on which the regular expression is applied(returns : the derived regular expression`8Derives a regular expression with respect to a sentence.$1.parameter re : regular expressionD2.parameter s : sentence to which the regular expression is applied(returns : the derived regular expressiona^Checks if an input matched a regular expression. The function should be called after matches.Was the sentence used in matchesA in the language of the regular expression? -> matches e s == s `in` L(e)?01.parameter re : the derived regular expressionureturns : empty String if input matched the regular expression, otherwise an error message is returnedb;Constructs a string representation of a regular expression.&1.parameter re : a regular expression=returns : the string representation of the regular expressionLMNOPQRSTUVWXYZ [\]^_ `abLMNOPQRSTUVWXYZ[\]^_`abLMNOPQRSTUWVXZ[\]^Ya`_bL MNOPQRSTUVWXYZ [\]^_ `abCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableSafe09;<=?Lthe predefined namespace uri for xml: "http://www.w3.org/XML/1998/namespace"Gthe predefined namespace uri for xmlns: "http://www.w3.org/2000/xmlns/"Relax NG namespaceLfghijklmnopqrstuvwxyz{|}~Lfghijklmnopqrstuvwxyz{|}~Lfgjihklmnopqrsutvwxyz{~|}Lfghijklmnopqrstuvwxyz{|}~Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableSafe09;<=? icheck whether file exists, if not try to unescape filename and check again return the existing filename  Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableSafe09;<=?Nremove leading and trailing whitespace with standard Haskell predicate isSpaceBconvert string to uppercase with standard Haskell toUpper functionBconvert string to lowercase with standard Haskell toLower function>find all positions where a string occurs within another string4find the position of the first occurence of a string3find the position of the last occurence of a string8Removes leading / trailing whitespaces and leading zeros2Reduce whitespace sequences to a single whitespace&replace all whitespace chars by blanks9Escape all disallowed characters in URI references (see  )http://www.w3.org/TR/xlink/#link-locators)bescape XML chars &lt;, &gt;, &quot;, and ampercent by transforming them into character references see also : qescape XML chars &lt; and ampercent by transforming them into character references, used for escaping text nodes see also : iescape XML chars in attribute values, same as stringEscapeXml, but none blank whitespace is also escaped see also : 2convert a string of hexadecimal digits into an Int&convert a string of digits into an IntCconvert a string into a hexadecimal string applying charToHexString see also : 7convert a char (byte) into a 2-digit hexadecimal string see also : , 5convert a none negative Int into a hexadecimal string see also : |take all elements of a list which occur more than once. The result does not contain doubles. (doubles . doubles == doubles)9drop all elements from a list which occur more than once.remove duplicates from list(mothers little helpers for to much curry   Safe09;<=?ZTry to extract charset spec from Content-Type header e.g. "text/html; charset=ISO-8859-1"JSometimes the server deliver the charset spec in quotes these are removed Safe09;<=?Bthe table with the mapping from file name extensions to mime types Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableSafe09;<=? Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?#Edit operation on navigatable treesrThere 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 tree9add an ordinary tree behind of the given navigatable tree?drop the direct left sibling tree of the given navigatable tree@drop the direct right sibling tree of the given navigatable tree)change the tree but remain the navigation/Conversion between trees and navigatable trees,rThere is only a single navigatable tree implementation for a given tree allowed (see the functional dependencies)construct a navigatable treeremove navigation#The interface for navigatable treesmove one step towards the root&descend one step to the leftmost childmove to the left neighbourmove to the right neighbourCopyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?Icollect all trees by moving into one direction, starting tree is includedMcollect all trees by moving into one direction, starting tree is not includedXPath axis: parentXPath axis: ancestorXPath axis: ancestor or selfXPath axis: childXPath axis: descendantXPath axis: descendant or selfYnot an official XPath axis but useful: reverse descendant or self, used in preceding axisXPath axis: following siblingXPath axis: preceeding siblingXPath axis: selfXPath axis: followingXPath axis: precedingmove to the rootCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?The interface for treesWtree construction: a new tree is constructed by a node attribute and a list of children0leaf 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 attributeselect childrenedit 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 treedepth of a treenumber of nodes in a tree%format tree for readable trace outputa  graphical* representation of the tree in text format<convert a tree into a pseudo graphical string representation                    Safe09;<=?XSelectors for pairs and 3-tuples: comp1, comp2, comp3, this can be extended to n-tupleswA Selector is a pair of an access function and a modifying function for reading and updating parts of a composite typeAlias for constructor S !"#$%& & %$#"! !"#$%& 3Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimental non-portableNone09;<=?"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.'()*+,-.'()'() '()*+,-.Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableSafe09;<=?0lookup with default value16lookup with empty list (empty string) as default value2test for existence of a key3kadd an entry, remove an existing entry before adding the new one at the top of the list, addEntry is strict4!add a whole list of entries with 35#delete an entry, delEntry is strict6delete a list of entries with 5/0123456/0123456/0123456/0123456Copyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?7cA class of types that can be partially evaluated, but evaluation can be propagated deeper than WHNF8%Default for rwnf is reduction to WHNF9Default for rwnf2 is rwnf789:;<=>?@ABCDEFGHIJKL789:;<:;<789LKJIHGFEDCBA@?>=789:;<=>?@ABCDEFGHIJKL:0#Copyright (C) 2005-2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de)stableportableSafe09;<=?M&shortcut for a sequence of n-ary treesNn-ary ordered tree (rose trees)a 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 ReadPImplementation of Data.Tree.Class interface for rose treesQ!NTree implements class TaversableRNTree implements class FoldableSNTree implements class Functor MNOPQRSTUVMNO NOMVUTSRQP MNOPQRSTUVMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?[9editNTreeBottomUp is a space optimized tree edit functionThe nodes in a tree are visited bottom up. An edit function is applied to all nodes. A Nothing result of the editing function indicates no changes. This is used to share the input tree within the resulting tree.The following law holds: *editNTreeBottomUp (const Nothing) t == [t]In this case the resulting tree does not only represent the same value but it is the same machine value (relative to some evaluations of closures during the tree walkYWith 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[\[\[\[\Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de)stableportableSafe09;<=?]UOne 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`Zipper for rose treesQA zipper consist of the current tree and the branches on the way back to the rootd6Conversion of a rose tree into a navigatable rose treeeAConversion of a navigatable rose tree into an ordinary rose tree.The context, the parts for moving up to the root are just removed from the tree. 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]^_`abcdefghijklmnopqrstu]^_`abcdefghijklmno`abc_]^defghijklmnoutsrqp]^_`abcdefghijklmnopqrstuCopyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?x2Namespace support for element and attribute names.A qualified name consists of a name prefix, a local name and a namespace uri. All modules, which are not namespace aware, use only the R component. When dealing with namespaces, the document tree must be processed by 2Oe to split names of structure "prefix:localPart" and label the name with the apropriate namespace uri|\Type for the namespace association list, used when propagating namespaces by modifying the x values in a tree}XML names are represented by Strings, but these strings do not mix up with normal strings. Names are always reduced to normal form, and they are stored internally in a name cache for sharing equal names by the same data structureset name prefixset local partset name prefixabuilds the full name "prefix:localPart", if prefix is not null, else the local part is the result6functional list version of qualifiedName used in xshowbuilds the "universal" name, that is the namespace uri surrounded with "{" and "}" followed by the local part (specialisation of )builds an "universal" uri, that is the namespace uri followed by the local part. This is usefull for RDF applications, where the subject, predicate and object often are concatenated from namespace uri and local part (specialisation of )builds a string from the namespace uri and the local part. If the namespace uri is empty, the local part is returned, else namespace uri and local part are combined with the combining function given by the first parameterPconstructs a simple name, with prefix and localPart but without a namespace uri. see also , @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.*constructs a complete qualified name with ,  and x. 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  and not with mkName. old name for mconstructs a simple, namespace aware name, with prefix:localPart as first parameter, namspace uri as second. see also , nEquivalent QNames are defined as follows: The URIs are normalized before comparison. Comparison is done with  and .Comparison of normalized namespace URIs using *Sometimes a weaker equality relation than  equalQName is appropriate, e.g no case significance in names, ... a name normalization function can be applied to the strings before comparing. Called by  equalQName and lNormalization of URIs: Normalization is done by conversion into lowercase letters. A trailing "/" is ignoredCCompute the name prefix and the namespace uri for a qualified name.This function does not test whether the name is a wellformed qualified name. see Namespaces in XML Rule [6] to [8]. Error checking is done with separate functions, see  and  for error checking.3test for wellformed NCName, rule [4] XML NamespacesPtest for wellformed QName, rule [6] XML Namespaces predicate is used in filter valdateNamespaces.test for wellformed QName values. 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.test whether an attribute name is a namesapce declaration name. If this is not the case True is the result, else 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.+test for a namespace name to be well formed=test whether a name is a namespace declaration attribute namepredicate is used in filter valdateNamespaces.0the internal cache for QNames (and name strings)Two QNames are equal if (1. case) namespaces are both empty and the qualified names (prefix:localpart) are the same or (2. case) namespaces are set and namespaces and local parts are equalNxyz{|}~ !"#$%&'().x{yz|}~1xyz{}~|zy{Cxyz{|}~ !"#$%&'()#Copyright (C) 2008-2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?&=data type for representing a set of nodes as a tree structurethis structure is e.g. used to repesent the result of an XPath query such that the selected nodes can be processed or selected later in processing a document treeis this node part of the set ?the set of attribute nodes=the set of child nodes, a list of pairs of index and node setAttribute list7used for storing option lists and features of DTD parts4Binary large object implemented as a lazy bytestringRepresents a DTD element9attr: name, system, public, XDTD elems as childrenattr: name, kindname: element name4kind: "EMPTY" | "ANY" | "#PCDATA" | children | mixedelement contentattr: kind, modifiermodifier: "" | "?" | "*" | "+"kind: seq | choice$attributes: name - name of elementvalue - name of attributeCtype: "CDATA" | "ID" | "IDREF" | "IDREFS" | "ENTITY" | "ENTITIES" |/"NMTOKEN" | "NMTOKENS" |"NOTATION" | "ENUMTYPE"kind: "REQUIRED\" | \"IMPLIED" | "DEFAULT"for entity declarations!for parameter entity declarations for notations,for INCLUDEs, IGNOREs and peRefs: attr: typetype = INCLUDE, IGNORE or %...; attr: nameEfor lists of names in notation types or nmtokens in enumeration types'for Parameter Entity References in DTDsRepresents elements:ordinary text (leaf):text represented more space efficient as bytestring (leaf):character reference (leaf):entity reference (leaf):comment (leaf):CDATA section (leaf)Processing Instr with qualified name (leaf) with list of attributes. If tag name is xml, attributes are "version", "encoding", "standalone", else attribute list is empty, content is a text child nodeCtag with qualified name and list of attributes (inner node or leaf)4DTD element with assoc list for dtd element featuresHattribute with qualified name, the attribute value is stored in children!error message with level and text-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 stringsno error, everything is ok$Error level for XError, type warning"Error level for XError, type error(Error level for XError, type fatal error0`/0123456xzy{|}~0  Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?.The datatype for modelling the structure of an,test: is schema a simple XML Schema datatype*test: is type a fixed value attribute type 0access an attribute of a descr of an atomic type7      6     <      %      PCopyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?*+,-./0123456789:;<=>?@fghijklmnopqrstuvwxyz{|}~/0123456xzy{|}~Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?j(weak normalform versions of constructorsV$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyh     MNO$D%(<.9CTEB-&')*+,/012345678:;=>?@AFGHIJKLMNOPQRSUVWXYZ[\]^_`abcdefghijklmnopqrstuvwV$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`yabcxdefghijklmnopqrstuvw$<%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?|!convert a DTD descr into XmlTrees)convert a pickler schema into a DTD descrz{|}~z{|}~z{|}~z{|}~ Copyright (C) 2008-9 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?%convert a list of trees into a string see also : xmlTreesToText for filter version, !Q for the inverse operation=convert an XML tree into a binary large object (a bytestring)$convert a list of trees into a blob.Apply a quoting function for XML quoting of content, a 2. quoting funtion for attribute values and an encoding function after tree conversionABCDEFGHIJKLMNOPQRSTABCDEFGHIJKLMNOPQRSTCopyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?UVWXUVWXCopyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?@YZ[\]^_99@YZ[\]^_Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=? Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?parse a tokenized DTD declaration represented by a DTD tree. The content is represented by the children containing text and parameter entity reference nodes. The parameter entity reference nodes contain their value in the children list, consisting of text and possibly again parameter entity reference nodes. This structure is build by the parameter entity substitution. Output is again a DTD declaration node, but this time completely parsed and ready for further DTD processing`collect the tokens of a DTD declaration body and build a string ready for parsing. The structure of the parameter entity values is stll stored in this string for checking the scope of the parameter values:abcdefghijklmnopqrstuvwxyz{|}~`:abcdefghijklmnopqrstuvwxyz{|}~`!Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=? the inverse function to , (for XML content).=the string parameter is parsed with the XML content parser. result is the list of trees or in case of an error a single element list with the error message as node. No entity or character subtitution is done here, but the XML parser can do this for the predefined XML or the char references for performance reasons see also: the filter version of a more general version of <. The parser to be used and the context are extra parameter;general parser for parsing arbitray parts of a XML documentParser for parts of a DTDParser for general entites6Parser for entity substitution within attribute valuesParser for NMTOKENsParser for XML names!try to parse a xml encoding spec.81.parameter encParse : the parser for the encoding decl#2.parameter root : a document rootreturns : the same tree, but with an additional attribute "encoding" in the root node in case of a valid encoding spec else the unchanged tree6##6"Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?++#Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimental=multi parameter classes and functional depenedencies requiredSafe09;<=? =The interface for accessing and changing the state component.AMulti parameter classes and functional dependencies are required. change 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 _access 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) 4change state (and ignore input) and return new stateFconvenience function, usefull for generating e.g. unique identifiers:"example with SLA state list arrows newId :: SLA Int b String newId = nextState (+1) >>> arr (('#':) . show) runSLA 0 (newId <+> newId <+> newId) undefined = ["#1", "#2", "#3"]                    $Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?The interface for list arrowsOnly mkA, + '(>>.)' don't have default implementationsIconstruction of a 2 argument arrow from a binary function | | example:  a1 &&& a2 >>> arr2 f Hconstruction of a 3 argument arrow from a 3-ary function | | example:  a1 &&& a2 &&& a3 >>> arr3 f Hconstruction 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 arrowBconstructor for a list arrow from a function with a list as result-constructor for a list arrow with 2 argumentsconstructor 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 listFcombinator for converting the result of a list arrow into another list example:  foo >>. reverse  reverses the the result of foo example:  foo >>. take 1 J constructs a deterministic version of foo by deleting all further resultsMcombinator for converting the result of an arrow into a single element resultrcombinator 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 collectAndSort collect = listA collect >>> arrL sortthe inverse of   listA af >>> unlistA = afunlistA is defined as  arrL id %the identity arrow, alias for returnA#the zero arrow, alias for zeroArrowDconverts an arrow, that may fail, into an arrow that always succeeds example:  withDefault none "abc"  is equivalent to  constA "abc"  Dmakes a list arrow deterministic, the number of results is at most 1 definition single f = f >>. take 1examples with strings: runLA ( single none ) "x" == [] runLA ( single this ) "x" == ["x"] runLA ( single (constA "y" <+> this ) ) "x" == ["y"]!Acompute an arrow from the input and apply the arrow to this input definition:  (f &&& this) >>> app in 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 inputapplyA coresponds to:  apply f x = let g = f x in g x  see also: ", #, $, %, &"compute 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 g4 is deterministic, the whole arrow computes n values-examples with simple list arrows with strings prefixString :: String -> a String String prefixString s = arr (s++) runLA ( prefixString $< none ) "x" == [] runLA ( prefixString $< constA "y" ) "x" == ["yx"] runLA ( prefixString $< this ) "x" == ["xx"] runLA ( prefixString $< constA "y" <+> constA "z" ) "x" == ["yx","zx"] runLA ( prefixString $< constA "y" <+> this <+> constA "z" ) "x" == ["yx","xx","zx"] see also: !, #, $, %, &#binary version of ",example with simple list arrows with strings dinfixString :: String -> String -> a String String infixString s1 s2 = arr (\ s -> s1 ++ s ++ s2) runLA ( infixString $<< constA "y" &&& constA "z" ) "x" = ["yxz"] runLA ( infixString $<< this &&& this ) "x" = ["xxx"] runLA ( infixString $<< constA "y" &&& (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 $<$ gf# computes the extra parameters for g from the input of type b and g` is applied with this parameter to the input. This allows programming in a point wise style in gC, which becomes neccessary, when a value is needed more than once.[this 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 stepif g2 is deterministic (computes exactly one result),  g $<$ f == g $< f  holdsif 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++) runLA ( prefixString $<$ none ) "x" == ["x"] runLA ( prefixString $<$ constA "y" ) "x" == ["yx"] runLA ( prefixString $<$ constA "y" <+> constA "z" ) "x" == ["zyx"] runLA ( prefixString $<$ constA "y" <+> this <+> constA "z" ) "x" == ["zxyx"] example with two extra parameter kg1 :: 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@examples with simple list arrows working on strings and XmlTrees 9 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>"] runLA (a1 >>> mergeA (+=) >>> xshow this) "42" == ["<foo>42<bar>420</bar></foo>"] see also: !, " and += in class RS(yuseful 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  !"#$%&'()*"#$%& !*'() !"#$%&'()* !"#$%&'()*88"2#2$2%2&2%Copyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimental non-portableSafe09;<=?+,partial evaluation of an arrow result using TUmThere are tow arrows with force the partial evaluation. By convention the 2. should be less lazy than the 1.These arrows are sometimes useful for preventing space leaks, especially when parsing complex data structures. In many cases the evaluated AST is more space efficient than the unevaluaded with a lot of closures.0-complete evaluation of an arrow result using TVthis is sometimes useful for preventing space leaks, especially after reading and validation of a document, all DTD stuff is not longer in use and can be recycled by the GC.+,-./0+,-./00./+,-+,-./0&Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?1an auxiliary data type for A3)The interface for arrows as conditionals.ZRequires list arrows because False is represented as empty list, True as none empty lists.Only 4 and @# don't have default implementations4if lifted to arrows5 shortcut:  ifP p = ifA (isA p) 6 negation:  neg f = ifA f none this 7 f `when` g J : when the predicate g holds, f is applied, else the identity filter this8 shortcut:  f `whenP` p = f `when` (isA p) 9 f `whenNot` g R : when the predicate g does not hold, f is applied, else the identity filter this:like 8; g `guards` f 6 : when the predicate g holds, f is applied, else none<like 8= shortcut for  f ; this > f `containing` g 3 : 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 V : directional choice: if f succeeds, the result of f is the result, else g is appliedAgeneralisation of @1 for multi way branches like in case expressions.An auxiliary data type 1 with an infix constructor 2' is used for writing multi way branches example: 4 choiceA [ p1 :-> e1, p2 :-> e2, this :-> default ] B`tag a value with Left or Right, if arrow has success, input is tagged with Left, else with RightC\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 resultD/partition a list of values into a pair of listsThis is the arrow Version of 123456789:;<=>?@ABCD1237@64589:;<=>?ABCD3456789:;<=>?@ABCD12123456789:;<=>?@ABCD'Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?E)The interface for navigatable tree arrows*all functions have default implementationsKXPath axis: ancestorLXPath axis: ancestor or selfMXPath axis: childNXPath axis: descendantOXPath axis: descendant or selfP5not an XPath axis but useful: descendant or followingQYnot an official XPath axis but useful: reverse descendant or self, used in preceding axisRXPath axis: following siblingSXPath axis: preceeding siblingTXPath axis: selfUXPath axis: followingVXPath axis: precedingWmove to the rootY.Conversion from a tree into a navigatable treeZ8Conversion from a navigatable tree into an ordinary tree[7apply an operation using navigation to an ordinary tree<This root and all children may be visited in arbitrary order\Happly a simple operation without use of navigation to a navigatable treeDThis enables to apply arbitrary tree operations to navigatable trees].Filter an axis with an ordinary tree predicateZExample: In a tree of Ints find all nodes in the subtrees (in preorder) that have label 42 /descendantAxis >>> filterAxis (hasNode (== 42))YExample: In an XML Tree find the following nodes of a node with attribute id and value 42 LdescendantAxis >>> filterAxis (hasAttrValue "id" (=="42")) >>> followingAxis^:Move to the next tree on a given axis. Deterministic arrowUExample: Move to the next node in a preorder visit: next child or else next following  moveOn descendantOrFollowingAxis_1Change the current subtree of a navigatable tree.]The arrow for computing the changes should be deterministic. If it fails nothing is changed.`DSubstitute the current subtree of a navigatable tree by a given treeazapply an ordinary arrow to the current subtree of a navigatabe tree and add the result trees in front of the current tree.cIf this arrow is applied to the root, it will fail, because we want a tree as result, not a forest.buapply an ordinary arrow to the current subtree of a navigatabe tree and add the result trees behind the current tree.cIf this arrow is applied to the root, it will fail, because we want a tree as result, not a forest.c$addToOneSide does the real work for a and bd?drop the direct left sibling tree of the given navigatable treeiIf this arrow is applied to the root or a leftmost tree, it will fail, because there is nothing to removee?drop the direct left sibling tree of the given navigatable treejIf this arrow is applied to the root or a rightmost tree, it will fail, because there is nothing to remove!EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde!EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde!EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdeEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde(Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de)stableportableSafe09;<=?fThe interface for tree arrows*all functions have default implementationsgconstruct a leafhconstruct an inner nodei)select the children of the root of a treej*select the node info of the root of a treek*select the attribute of the root of a treel-substitute the children of the root of a treem.substitute the attribute of the root of a treen'edit the children of the root of a treeo(edit the attribute of the root of a treepapply an arrow element wise to all children of the root of a tree collect these results and substitute the children with this result example:  processChildren isText 5 deletes all subtrees, for which isText does not hold example: % processChildren (none `when` isCmt) , removes all children, for which isCmt holdsqasimilar to processChildren, but the new children are computed by processing the whole input tree example:  replaceChildren (deep isText) t selects all subtrees for which isText holds and substitutes the children component of the root node with this listr&pronounced "slash", meaning g inside f defined as " f /> g = f >>> getChildren >>> g  example: 2 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"s>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. Attention: This does not correspond to the XPath selection path "html//table". The latter on matches all table elements even nested ones, but //>3 gives in many cases the appropriate functionality.t+pronounced "outside" meaning f containing g defined as - f </ g = f `containing` (getChildren >>> g) urecursively 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 list. The tree found is not further examined for any subtress, for which the predicate also could hold. See w for this kind of search. example:  deep isHtmlTable  selects all top level table elements in a document (with an appropriate definition for isHtmlTable) but no tables occuring within a table cell.vorecursively searches a whole tree for subrees, for which a predicate holds. The search is performed bottom up. example:  deepest isHtmlTable b selects all innermost table elements in a document but no table elements containing tables. See u and w for other search strategies.wrecursively searches a whole tree for subtrees, for which a predicate holds. The search is performed top down. All nodes of the tree are searched, even within the subtrees of trees for which the predicate holds. example:  multi isHtmlTable . selects all table elements, even nested ones.xrecursively transforms a whole tree by applying an arrow to all subtrees, this is done bottom up depth first, leaves first, root as last tree example: 1 processBottomUp (getChildren `when` isHtmlFont) k removes all font tags in a HTML document, even nested ones (with an appropriate definition of isHtmlFont)y similar to x, but recursively transforms a whole tree by applying an arrow to all subtrees with a top down depth first traversal strategie. In many cases x and y give same results.zrecursively transforms a whole tree by applying an arrow to all subtrees, but transformation stops when a predicte does not hold for a subtree, leaves are transformed first{recursively transforms a whole tree by applying an arrow to all subtrees, 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 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 and copies theses in front of the existing children} similar to |9, but the insertion position is searched with a predicate~an arrow for inserting a whole subtree with some holes in it (a template) into a document. The holes can be filled with contents from the input.Example insertTreeTemplateTest :: ArrowXml a => a b XmlTree insertTreeTemplateTest = doc >>> insertTreeTemplate template pattern where doc -- the input data = constA "<x><y>The Title</y><z>The content</z></x>" >>> xread template -- the output template with 2 holes: xxx and yyy = 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 ) ]0computes the XML tree for the following document U"<html><head><title>The Title</title></head><body><h1>The content</h1></body></html>"fghijklmnopqrstuvwxyz{|}~fuhilgjonmrstkpqvwxyz{|}~fghijklmnopqrstuvwxyz{|}~fghijklmnopqrstuvwxyz{|}~r5s5t5)Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?pure list arrow data typeLconversion of pure list arrows into other possibly more complex list arrows*Copyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?Edit parts of a rose treesThe subtrees to be modified are selected by the first part of the IfThen pairs The modification by the second part+Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=? list arrow combined with a stateAconversion of state list arrows into arbitray other list arrows.7allows running a state list arrow within another arrow:example: :... >>> fromSLA 0 (... setState ... getState ... ) >>> ...Uruns a state arrow with initial state 0 (e..g. an Int) within another arrow sequence,Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?>the interface for converting an IO predicate into a list arrow$builds an arrow from an IO predicatekif the predicate holds, the single list containing the input is returned, else the empty list, similar to $W7the 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 parameterJconstruction of a 2 argument arrow from a binary IO action | | example:  a1 &&& a2 >>> arr2 f Iconstruction of a 3 argument arrow from a 3-ary IO action | | example:  a1 &&& a2 &&& a3 >>> arr3 f Iconstruction of a 4 argument arrow from a 4-ary IO action | | example: $ a1 &&& a2 &&& a3 &&& a4 >>> arr4 f -Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimental not portableSafe09;<=?.Copyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?!list arrow combined with IO monad/ Copyright (C) 2005-8 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?1list arrow combined with a state and the IO monadIlift the state of an IOSLA arrow to a state with an additional component.~This is uesful, when running predefined IO arrows, e.g. for document input, in a context with a more complex state component.run an arrow with augmented state in the context of a simple state arrow. An initial value for the new state component is needed.oThis is useful, when running an arrow with an extra environment component, e.g. for namespace handling in XML.0Copyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?gDocument Type Definition arrowsThese are separated, because they are not needed for document processing, only 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 XsWThese arrows can be grouped into predicates, selectors, constructors, and transformers. All predicates (tests) act like &Y for failure and &Z- 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 , will fail when applied to a none text node.zEdit arrows will remain the input unchanged, when applied to wrong argument, e.g. editing the content of a text node with 7C 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 parsingtest for comment+test for CDATA section, used during parsingtest for processing instruction*test for processing instruction <?xml ...>test for element&test for DTD part, used during parsingtest for attribute treetest 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"))2 check for text nodes with only whitespace content)test for text nodes with only white spaceimplemented with hasTestOtest whether a node (element, attribute, pi) has a name with a special propertystest whether a node (element, attribute, pi) has a specific qualified name useful only after namespace propagation{test whether a node has a specific name (prefix:localPart or localPart), generally useful, even without namespace handling_test whether a node has a specific name as local part, useful only after namespace propagationXtest whether a node has a specific name prefix, useful only after namespace propagationYtest whether a node has a specific namespace URI useful only after namespace propagationGtest whether an element node has an attribute node with a specific nameQtest whether an element node has an attribute node with a specific qualified nameCtest whether an element node has an attribute with a specific valueXtest whether an element node has an attribute with a qualified name and a specific valuetext node construction arrowblob node construction arrow=char reference construction arrow, useful for document output?entity reference construction arrow, useful for document output5comment node construction, useful for document output.CDATA construction, useful for document output/error node construction, useful only internallytelement construction: | the attributes and the content of the element are computed by applying arrows to the input aattribute node construction: | the attribute value is computed by applying an arrow to the input processing instruction construction: | the content of the processing instruction is computed by applying an arrow to the input Gconvenient arrow for element construction, more comfortable variant of example for simplifying  : 4mkElement qn (a1 <+> ... <+> ai) (c1 <+> ... <+> cj)equals "mkqelem qn [a1,...,ai] [c1,...,cj] mconvenient arrow for element construction with strings instead of qualified names as element names, see also  and   `convenient arrow for element constrution with attributes but without content, simple variant of   and Vconvenient arrow for simple element constrution without attributes, simple variant of   and Yconvenient arrow for constrution of empty elements without attributes, simple variant of   and @construction of an element node with name "/" for document roots alias for  >convenient arrow for attribute constrution, simple variant of  constant arrow for text nodesconstant arrow for blob nodes'constant arrow for char reference nodes)constant arrow for entity reference nodesconstant arrow for commentconstant arrow for warningconstant arrow for errorsconstant arrow for fatal errors7constant arrow for simple processing instructions, see  hconstant arrow for attribute nodes, attribute name is a qualified name and value is a text, | see also  , , ]constant arrow for attribute nodes, attribute name and value are | given by parameters, see  select the text of a text node$select the value of a char reference *select the name of a entity reference node!$select the comment of a comment node""select the content of a CDATA node#+select the name of a processing instruction$.select the content of a processing instruction%"select the name of an element node&,select the attribute list of an element node'!select the DTD type of a DTD node('select the DTD attributes of a DTD node)select the name of an attribute*Bselect the error level (c_warn, c_err, c_fatal) from an error node++select the error message from an error node,:select the qualified name from an element, attribute or pi-Iselect the prefix:localPart or localPart from an element, attribute or pi.7select the univeral name ({namespace URI} ++ localPart)/5select the univeral name (namespace URI ++ localPart)0select the local part1select the name prefix2select the namespace URI3kselect the value of an attribute of an element node, always succeeds with empty string as default value ""4like 3+, but fails if the attribute does not exist5like 3x, but select the value of an attribute given by a qualified name, always succeeds with empty string as default value ""6like 5', but fails if attribute does not exist7edit the string of a text node8edit the blob of a blob node9)edit the comment string of a comment node:(edit an element-, attribute- or pi- name;edit an element name<edit an attribute name=edit a pi name>edit an attribute value?)edit an attribute list of an element node@(replace an element, attribute or pi nameAreplace an element nameBreplace an attribute nameCreplace an element nameD+replace an atribute list of an element nodeE&add a list of attributes to an elementFadd (or replace) an attributeGremove an attributeH)remove an attribute with a qualified nameI7process the attributes of an element node with an arrowJJprocess a whole tree inclusive attribute list of element nodes see also: yK9convenient op for adding attributes or children to a nodeusage:  tf += cf the tf; arrow computes an element node, and all trees computed by cf are 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 K is implemented by ++ examples: Ueelem "a" += sattr "href" "page.html" += sattr "name" "here" += txt "look here"is the same as bmkelem [ sattr "href" "page.html" , sattr "name" "here" ] [ txt "look here" ]Nand results in the XML fragment: <a href="page.html" name="here">look here</a>advantage of the KS operator is, that attributes and content can be added any time step by step. if tf computes a whole list of trees, e.g. a list of "td" or "tr" elements, the attributes or content is added to all trees. useful for adding "class" or "style" attributes to table elements.L\apply an arrow to the input and convert the resulting XML trees into a string representationM\apply an arrow to the input and convert the resulting XML trees into a string representation      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUzLM( '?)& !"#$%*+-./012789;<=ABC FK,   3456:>@DEGIHJ      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMUTSRQPON f      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUK71Copyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?Kescape XmlText, transform all special XML chars into char- or entity- refs6Applies some "Canonical XML" rules to a document tree.MThe rules differ slightly for canonical XML and XPath in handling of commentsNote: This is not the whole canonicalization as it is specified by the W3C Recommendation. Adding attribute defaults or sorting attributes in lexicographic order is done by the  transform function of module !Text.XML.HXT.Validator.ValidationG. Replacing entities or line feed normalization is done by the parser.Not implemented yet:2Whitespace within start and end tags is normalizedaSpecial characters in attribute values and character content are replaced by character referencessee V and WV6Applies some "Canonical XML" rules to a document tree.LThe rule differ slightly for canonical XML and XPath in handling of commentsNote: This is not the whole canonicalization as it is specified by the W3C Recommendation. Adding attribute defaults or sorting attributes in lexicographic order is done by the  transform function of module !Text.XML.HXT.Validator.ValidationG. Replacing entities or line feed normalization is done by the parser.qRules: remove DTD parts, processing instructions, comments and substitute char refs in attribute values and textNot implemented yet:2Whitespace within start and end tags is normalizedaSpecial characters in attribute values and character content are replaced by character referencesW$Canonicalize a tree for XPath Like V" but comment nodes are not removedsee VX'Canonicalize the contents of a documentsubstitutes all char refs in text and attribute values, removes CDATA section and combines all sequences of resulting text nodes into a single text nodesee VYCollects sequences of text nodes in the list of children of a node into one single text node. This is useful, e.g. after char and entity reference substitutionZ"Applies collapseXText recursively. see also : Y[Zapply an arrow to the input and convert the resulting XML trees into an XML escaped stringfThis is a save variant for converting a tree into an XML string representation that is parsable with R[. It is implemented with LB, but xshow does no XML escaping. The XML escaping is done with 1\ before xshow is applied.So the following law holds xshowEscapeXml f >>> xread == fa=convert a document into a Haskell representation (with show).3Useful for debugging and trace output. see also : c, bbOconvert a document into a text and add line numbers to the text representation.lResult is a root node with a single text node as child. Useful for debugging and trace output. see also : a, cc;convert a document into a text representation in tree form.3Useful for debugging and trace output. see also : a, beremove a Comment nodef)remove all comments in a tree recursivelyg&simple filter for removing whitespace.Hno check on sigificant whitespace, e.g. in HTML <pre>-elements, is done. see also : h, ih4simple recursive filter for removing all whitespace.Aremoves all text nodes in a tree that consist only of whitespace. see also : g, ii3filter for removing all not significant whitespace.the tree traversed for removing whitespace between elements, 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 | preservehinput is root node of the document to be cleaned up, output the semantically equivalent simplified tree see also : j, hj9filter for indenting a document tree for pretty printing.Cthe tree is traversed for inserting whitespace for tag indentation.whitespace is only inserted or changed at places, where it isn't significant, is's 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.oinput is a complete document tree or a document fragment result is the semantically equivalent formatted tree. see also : ik/converts a CDATA section into normal text nodeslEconverts CDATA sections in whole document tree into normal text nodesm-converts a character reference to normal textn<recursively converts all character references to normal textrNadd an <?xml version="1.0"?> processing instruction if it's not already theresHadd an encoding spec to the <?xml version="1.0"?> processing instructiont5add an XHTML strict doctype declaration to a document5add an XHTML strict doctype declaration to a documentu;add an XHTML transitional doctype declaration to a document5add an XHTML strict doctype declaration to a documentv7add an XHTML frameset doctype declaration to a document5add an XHTML strict doctype declaration to a documentw'add a doctype declaration to a documentHThe arguments are the root element name, the PUBLIC id and the SYSTEM id2VWXYZ[\]^_`abcdefghijklmnopqrstuvw"VWXYZ[\]^_`abcdefghijklmnopqrstuvw"VWXZY[^_acdjb`efghiklmn]\opqrswtuv2VWXYZ[\]^_`abcdefghijklmnopqrstuvw2#Copyright (C) 2005-2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?xDtest whether an attribute node contains an XML Namespace declarationykget the namespace prefix and the namespace URI out of an attribute tree with a namespace declaration (see x') for all other nodes this arrow failsz:collect all namespace declarations contained in a documentapply y to a whole XmlTree{8collect all (namePrefix, namespaceUri) pairs from a treeall qualified names are inspected, whether a namespace uri is defined, for these uris the prefix and uri is returned. This arrow is useful for namespace cleanup, e.g. for documents generated with XSLT. It can be used together with z to ~|generate unique namespaces and add all namespace declarations to all top nodes containing a namespace declaration Usually the top node containing namespace declarations is the root node, but this isn't mandatory.Calls ~ with z}mgenerate unique namespaces and add all namespace declarations for all prefix-uri pairs in all qualified names@useful for cleanup of namespaces in generated documents. Calls ~ with 0 collectNamespaceDecl <+> collectPrefixUriPairs ~)does the real work for namespace cleanup.TThe parameter is used for collecting namespace uris and prefixes from the input tree;auxiliary arrow for processing with a namespace environmentprocess a document tree with an arrow, containing always the valid namespace environment as extra parameter. The namespace environment is implemented as a ]D. Processing of attributes can be controlled by a boolean parametermprocess a document tree with an arrow, containing always the valid namespace environment as extra parameter..The namespace environment is implemented as a ]process all element nodes of a document tree with an arrow, containing always the valid namespace environment as extra parameter. Attribute lists are not processed. See also: Oattach all valid namespace declarations to the attribute list of element nodes.This arrow is useful for document processing, that requires access to all namespace declarations at any element node, but which cannot be done with a simple .epropagate all namespace declarations "xmlns:ns=..." to all element and attribute nodes of a document.SThis arrow does not check for illegal use of namespaces. The real work is done by .2The arrow may be applied repeatedly if neccessary.hattaches the namespace info given by the namespace table to a tag node and its attributes and children.3validate the namespace constraints in a whole tree.@Result is the list of errors concerning namespaces. Predicates , ,  and 8 are applied to the appropriate elements and attributes.'a single node for namespace constrains.xyz{|}~ xyz{|}~ ~z{xy|}xyz{|}~3Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?4Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?7infix operator for applying an arrow to a list of trees1.parameter f : the arrow#2.parameter ts : the list of treesreturns : list of resultscreate an error message!*+,-./0123456789:;<=>?@fghijklmnopqrstuvwxyz{|}~/0123456xzy{|}~     "#$%& !*'()1237@64589:;<=>?ABCDfuhilgjonmrstkpqvwxyz{|}~LM( '?)& !"#$%*+-./012789;<=ABC FK,   3456:>@DEGIHJ!!05Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?HChecks if the attribute value meets the lexical constraints of its type.+1.parameter dtdPart : the children of the DOCTYPE nodeE2.parameter attrDecl : the declaration of the attribute from the DTDreturns : a function which takes an element (XTag or XDTD ATTLIST), checks if the attribute value meets the lexical constraints of its type and returns a list of errors4Dispatches the attibute check by the attribute type.%1.parameter typ : the attribute type+2.parameter dtdPart : the children of the DOCTYPE nodeE3.parameter attrValue : the normalized attribute value to be checkedE4.parameter attrDecl : the declaration of the attribute from the DTDreturns : a functions which takes an element (XTag or XDTD ATTLIST), checks if the attribute value meets the lexical constraints of its type and returns a list of errorsGChecks the value of Enumeration attribute types. (3.3.1 / p.27 in Spec)E1.parameter attrDecl : the declaration of the attribute from the DTDE2.parameter attrValue : the normalized attribute value to be checkedBChecks the value of ENTITY attribute types. (3.3.1 / p.26 in Spec)+1.parameter dtdPart : the children of the DOCTYPEB node, to get the unparsed entity declarationsE2.parameter attrDecl : the declaration of the attribute from the DTDE3.parameter attrValue : the normalized attribute value to be checkedDChecks the value of ENTITIES attribute types. (3.3.1 / p.26 in Spec)+1.parameter dtdPart : the children of the DOCTYPEB node, to get the unparsed entity declarationsE2.parameter attrDecl : the declaration of the attribute from the DTDE3.parameter attrValue : the normalized attribute value to be checkedCChecks the value of NMTOKEN attribute types. (3.3.1 / p.26 in Spec)E1.parameter attrDecl : the declaration of the attribute from the DTDE2.parameter attrValue : the normalized attribute value to be checkedDChecks the value of NMTOKENS attribute types. (3.3.1 / p.26 in Spec)E1.parameter attrDecl : the declaration of the attribute from the DTDE2.parameter attrValue : the normalized attribute value to be checked>Checks the value of ID attribute types. (3.3.1 / p.25 in Spec)E1.parameter attrDecl : the declaration of the attribute from the DTDE2.parameter attrValue : the normalized attribute value to be checked AChecks the value of IDREF attribute types. (3.3.1 / p.26 in Spec)E1.parameter attrDecl : the declaration of the attribute from the DTDE2.parameter attrValue : the normalized attribute value to be checked BChecks the value of IDREFS attribute types. (3.3.1 / p.26 in Spec)E1.parameter attrDecl : the declaration of the attribute from the DTDE2.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"E2.parameter attrDecl : the declaration of the attribute from the DTDE3.parameter attrValue : the normalized attribute value to be checkedNNormalizes an attribute value with respect to its type. (3.3.3 / p.29 in Spec)1.parameter attrDecl : the declaration of the attribute from the DTD. Expected is a list. If the list is empty, no declaration exists.92.parameter value : the attribute value to be normalizedreturns : the normalized value vNormalization of CDATA attribute values. is already done when parsing during entity substituion for attribute values 3Normalization of attribute values other than CDATA.3Reduce whitespace sequences to a single whitespace.          6Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09:;<=?Validate a DTD.returns : a functions which takes the DTD subset of the XmlTree, checks if the DTD is valid and returns a list of errorsValidation of Notations, checks if all notation names are unique. Validity constraint: Unique Notation Name (4.7 / p.44 in Spec)+1.parameter dtdPart : the children of the DOCTYPE nodereturns : a list of errorsValidation of Entities. 9Issues 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 nodeK2.parameter notationNames : list of all notation names declared in the DTDreturns : a list of errors#Validation of Element declarations. 9Validates that an element is not declared multiple times.IValidity constraint: Unique Element Type Declaration (3.2 / p.21 in Spec) PValidates that an element name only appears once in a mixed-content declaration.<Validity constraint: No Duplicate Types (3.2 / p.21 in Spec) [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 nodeF2.parameter elemNames : list of all element names declared in the DTDreturns : a list of errors%Validation of Attribute declarations. XIssues a warning if an attribute is declared for an element type not itself decared.&Optinal warning: (3.3 / p. 24 in Spec) Issues a warning if more than one definition is provided for the same attribute of a given element type. Fist declaration is binding, later definitions are ignored.&Optional warning: (3.3 / p.24 in Spec) wIssues 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) JValidates that an element type has not more than one ID attribute defined.CValidity constraint: One ID per Element Type (3.3.1 / p.26 in Spec) PValidates that an element type has not more than one NOTATION attribute defined.IValidity constraint: One Notation per Element Type (3.3.1 / p.27 in Spec) -Validates that an ID attributes has the type  IMPLIED or  REQUIRED.@Validity constraint: ID Attribute Default (3.3.1 / p.26 in Spec) 5Validates that all referenced notations are declared.?Validity constraint: Notation Attributes (3.3.1 / p.27 in Spec) =Validates that notations are not declared for EMPTY elements.GValidity constraint: No Notation on Empty Element (3.3.1 /p.27 in Spec) NValidates that the default value matches the lexical constraints of it's type.CValidity constraint: Attribute default legal (3.3.2 / p.28 in Spec)+1.parameter dtdPart : the children of the DOCTYPE nodeF2.parameter elemNames : list of all element names declared in the DTDK3.parameter notationNames : list of all notation names declared in the DTDreturns : a list of errorsRemoves doublicate declarations from the DTD, which first declaration is binding. This is the case for ATTLIST and ENTITY declarations.returns : A function that replaces the children of DOCTYPE nodes by a list where all multiple declarations are removed.7Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?uLookup-table which maps element names to their transformation functions. The transformation functions are XmlArrows.%filter for transforming the document.,1.parameter dtdPart : the DTD subset (Node DOCTYPE) of the XmlTree52.parameter doc : the document subset of the XmlTreereturns : a list of errors!Traverse the XmlTree in preorder._1.parameter transEnv : lookup-table which maps element names to their transformation functions(returns : the whole transformed document#Build all transformation functions.C1.parameter dtdPart : the DTD subset, root node should be of type DOCTYPEQreturns : lookup-table which maps element names to their transformation functions.Build transformation functions for an element.+1.parameter dtdPart : the children of the DOCTYPE nodel1.parameter nd : element declaration for which the transformation functions are created$returns : entry for the lookup-table9Sort the attributes of an element in lexicographic order.returns : a function which takes an element (XTag), sorts its attributes in lexicographic order and returns the changed elementNormalize attribute values.returns : a function which takes an element (XTag), normalizes its attribute values and returns the changed element1Set default attribute values if they are not set.returns : a function which takes an element (XTag), adds missing attribute defaults and returns the changed element  8Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?nLookup-table which maps element names to their validation functions. The validation functions are XmlFilters. Perform the validation of the IDIDREFIDREFS constraints.,1.parameter dtdPart : the DTD subset (Node DOCTYPE) of the XmlTree52.parameter doc : the document subset of the XmlTreereturns : a list of errors!Traverse the XmlTree in preorder.X1.parameter idEnv : lookup-table which maps element names to their validation functionsreturns : list of errorskReturns the value of an element's ID attribute. The attribute name has to be retrieved first from the DTD.D1.parameter dtdPart : list of ID attribute definitions from the DTDD2.parameter n : element which ID attribute value should be returned.returns : normalized value of the ID attribute VBuild collector functions which return XTag nodes with ID attributes from a document.+1.parameter dtdPart : the children of the DOCTYPE nodeKreturns : lookup-table which maps element names to their collector function!dBuild validation functions for checking if IDREF/IDREFS values match a value of some ID attributes.+1.parameter dtdPart : the children of the DOCTYPE nodeC2.parameter idNodeList : list of all XTag nodes with ID attributesLreturns : lookup-table which maps element names to their validation function"iValidate that all ID values are unique within a document. Validity constraint: ID (3.3.1 /p. 25 in Spec)C1.parameter idNodeList : list of all XTag nodes with ID attributes+2.parameter dtdPart : the children of the DOCTYPE nodereturns : a list of errors#~Validate that all IDREF/IDREFS values match the value of some ID attribute. Validity constraint: IDREF (3.3.1 / p.26 in Spec)Z1.parameter idRefEnv : lookup-table which maps element names to their validation function+2.parameter doc : the document to validatereturns : a list of errors $%& !"# $%& !"#9Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?@Derives a regular expression with respect to a list of elements.$1.parameter re : regular expressionO2.parameter list : list of elements to which the regular expression is applied(returns : the derived regular expression'9Derives a regular expression with respect to one element.L(delta e x) = x L(e)21.parameter re : regular expression to be derivedH2.parameter el : the element on which the regular expression is applied(returns : the derived regular expression' LVWXYZ[\]^ab LabWVXZ[\]^Y':Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?(mLookup-table which maps element names to their validation functions. The validation functions are XmlArrows.Validate a document.,1.parameter dtdPart : the DTD subset (Node DOCTYPE) of the XmlTree52.parameter doc : the document subset of the XmlTreereturns : a list of errors)!Traverse the XmlTree in preorder.Z1.parameter valiEnv : lookup-table which maps element names to their validation functionsreturns : list of errors*Build all validation functions.?1.parameter dtdPart : DTD subset, root node should be of type DOCTYPEMreturns : 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 nodeg2.parameter nd : element declaration for which the validation functions are created$returns : entry for the lookup-table-vBuild validation functions for the content model of an element. Validity constraint: Element Valid (3 / p.18 in Spec)l1.parameter nd : element declaration for which the content validation functions are builtreturns : a function which takes an element (XTag), checks if its children match its content model and returns a list of errors.kBuild a regular expression from the content model. The regular expression is provided by the module XmlRE.71.parameter nd : node of the content model. Expected: CONTENT or NAME1returns : regular expression of the content model/<Build validation functions for the attributes of an element.+1.parameter dtdPart : the children of the DOCTYPE nodep2.parameter nd : element declaration for which the attribute validation functions are createdreturns : a function which takes an element (XTag), checks if its attributes are valid and returns a list of errors0vValidate that all attributes of an element are unique. Well-formdness constraint: Unique AttSpec (3.1 / p.19 in Spec)returns : a function which takes an element (XTag), checks if its attributes are unique and returns a list of errors1uValidate that all #REQUIRED attributes are provided. Validity constraint: Required Attributes (3.3.2 / p.28 in Spec)+1.parameter dtdPart : the children of the DOCTYPE nodeI2.parameter nd : element declaration which attributes have to be checkedreturns : a function which takes an element (XTag), checks if all required attributes are provided and returns a list of errors2}Validate that #FIXED attributes match the default value. Validity constraint: Fixed Attribute Default (3.3.2 / p.28 in Spec)+1.parameter dtdPart : the children of the DOCTYPE nodeI2.parameter nd : element declaration which attributes have to be checkedreturns : a function which takes an element (XTag), checks if all fixed attributes match the default value and returns a list of errors3Validate that an element has no attributes which are not declared. Validity constraint: Attribute Value Type (3.1 / p.19 in Spec)+1.parameter dtdPart : the children of the DOCTYPE nodeI2.parameter nd : element declaration which attributes have to be checkedreturns : a function which takes an element (XTag), checks if all attributes are declared and returns a list of errors4Validate 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 nodeI2.parameter nd : element declaration which attributes have to be checkedreturns : a function which takes an element (XTag), checks if all attributes meet the lexical constraints and returns a list of errors567()*+8,-./01234567()*+8,-./01234;Copyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?DMain validation filter. Check if the DTD and the document are valid.returns : a function which expects a complete document as XmlTree input and returns a list of all errors found.Check if the DTD is valid.returns : a function which expects an XmlTree from the parser as input and returns a list of all errors found in the DTD.3Check if the document corresponds to the given DTD.returns : a function which expects a complete document as XmlTree input and returns a list of all errors found in the content part.Afilter for transforming a document with respect to the given DTD.Validating parsers are expected to normalize attribute values and add default values. This function should be called after a successful validation.sreturns : a function which expects a complete XML document tree and returns the transformed XmlTreeRemoves doublicate declarations from the DTD which first declaration is binding. This is the case for ATTLIST and ENTITY declarations.returns : A function that replaces the children of DOCTYPE nodes by a list where all multiple declarations are removed.99<Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?'ppredefined system state data type with all components for the system functions, like trace, error handling, ...+8The arrow for stateful arrows with no user defined state,"The arrow type for stateful arrows-Wstate datatype consists of a system state and a user state the user state is not fixed1'read the user defined part of the state2)change the user defined part of the state3&set the user defined part of the state4extend user state Run an arrow with an extended user state component, The old component is stored together with a new one in a pair, the arrow is executed with this extended state, and the augmented state component is removed form the state when the arrow has finished its execution5change the type of user stateThis conversion is useful, when running a state arrow with another 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      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~-./0,+123456'()* !"#$%&     789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ y        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~=Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?reset global error variableset global error variable read current global error status=raise the global error status level to that of the input treeDset the error message handler and the flag for collecting the errors*error message handler for output to stderr9the default error message handler: error output to stderr+error message handler for collecting errors9error message handler for output to stderr and collecting)error message handler for ignoring errorsif error messages are collected by the error handler for processing these messages by the calling application, this arrow reads the stored messages and clears the error message store7filter error messages from input trees and issue errorsgenerate a warnig messagegenerate an error message7generate a fatal error message, e.g. document not found@Default exception handler: issue a fatal error message and fail.<The parameter can be used to specify where the error occuredadd the error level and the module where the error occured 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 errorcheck whether the error level attribute in the system state is set to error, in this case the children of the document root are removed and the module name where the error occured and the error level are added as attributes with  else nothing is changedUcheck whether tree is a document root and the status attribute has a value less than >Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?Jset the table mapping of file extensions to mime types in the system stateDefault table is defined in ^_[. This table is used when reading loacl files, (file: protocol) to determine the mime typeQset the table mapping of file extensions to mime types by an external config file/The config file must follow the conventions of etc8mime.types on a debian linux system, that means all empty lines and all lines starting with a # are ignored. The other lines must consist of a mime type followed by a possible empty list of extensions. The list of extenstions and mime types overwrites the default list in the system state of the IOStateArrowread the system mimetype table?Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=? withTrace level- : system option, set the trace level, (0..4)withSysAttr key value4 : store an arbitrary key value pair in system state'Specify the set of accepted mime types.[All contents of documents for which the mime type is not found in this list are discarded.<Specify a content handler for documents of a given mime typewithMimeTypeFile filename. : input option, set the mime type table for file:z documents by given file. 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.YThe mime type for file access will then not be computed by looking into a mime.types filewithWarnings yes/noZ : 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/noe : 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. If the mime type is something else, no further processing is performed, the contents is given back to the application in form of a single text node. 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 against DTD, default is withSubstDTDEntities yes/noF: read option, substitute general entities defined in DTD, default is . switching this option and the validate option off can lead to faster parsing, because then there is no need to access the DTDwithSubstHTMLEntities yes/noK: read option, substitute general entities defined in HTML DTD, default is . switching this option on and the substDTDEntities and validate options off can lead to faster parsing because there is no need to access a DTD, but still the HTML general entities are substitutedwithCheckNamespaces yes/no,: read option, check namespaces, default is withCanonicalize yes/no2 : read option, canonicalize document, default is  withIgnoreNoneXmlContents yes/noE : 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 optionSet default document encoding (., @, 0, >, ... , 1, ...). Only XML, HTML and text documents are decoded, default decoding for XML/HTML is utf8, for text iso latin1 (no decoding).withDefaultBaseURI URI) , input option, set the default base URIThis option can be useful when parsing documents from stdin or contained in a string, and interpreting relative URIs within the documentwithRedirect yes/noB : input option, automatically follow redirected URIs, default is withProxy "host:port"G : input option, configure a proxy for HTTP access, e.g. www-cache:3128withIndent yes/no< : output option, indent document before output, default is withOutputEncoding encoding^ , output option, default is the default input encoding or utf8, if input encoding is not set withOutputXML! : output option, default writingDefault is writing XML: quote special XML chars >,<,",',& where neccessary, add XML processing instruction and encode document with respect to `Write XHTML: quote all special XML chars, use HTML entity refs or char refs for none ASCII charsWrite 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.  scriptsrc=... /script instead of  script src=... /+suppreses all char and entitiy substitutionConfigure compression and decompression for binary serialization/deserialization. First component is the compression function applied after serialization, second the decompression applied before deserialization./Strict input for deserialization of binary data****@Copyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?%commonly useful options for XML input5can be used for option definition with haskell getoptdefines options: , ,  a_use_curl, a_do_not_use_curl, a_options_curl, k, , , , , , , , , , , ,&commonly useful options for XML outputdefines options: , q,  and otherscommonly useful optionsdefines options: , defines y optiondebug output options<select options from a predefined list of option descriptions:     :     :     :     ACopyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=? set the global trace levelread the global trace level@set the global trace command. This command does the trace output"acces the command for trace output`run an arrow with a given trace level, the old trace level is restored after the arrow execution/apply a trace arrow and issue message to stderr;trace the current value transfered in a sequence of arrows.~The value is formated by a string conversion function. This is a substitute for the old and less general traceString functionan old alias for issue a string message as traceAissue 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 issue a message when trace level >= 1, issue document source if level >= 3, issue tree when level is >= 4  !"  !"  !"  !"BCopyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?# apply an + to an empty root node with % () as initial state6the 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 H` arrow.for usage see examples with La+if input has to be feed into the arrow use  like in  runIOSLA f emptyX inputDoc %@the default global state, used as initial state when running an + with  or ##$%&'()*+,-./0123456#$%&'()*+,-./0123456#$%&'()*+,-./0123456#$%&'()*+,-./0123456CCopyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?7zset the base URI of a document, used e.g. for reading includes, e.g. external entities, the input must be an absolute URI8(read the base URI from the globale state9change the base URI with a possibly relative URI, can be used for evaluating the xml:base attribute. Returns the new absolute base URI. Fails, if input is not parsable with parseURIReference see also: 7, @:Aset the default base URI, if parameter is null, the system base ( file:///<cwd>/ J) is used, else the parameter, must be called before any document is read;get the default base URI<`remember base uri, run an arrow and restore the base URI, used with external entity substitution=parse a URI reference, in case of a failure, try to escape unescaped chars, convert backslashes to slashes for windows paths, and try parsing again>6compute the absolut URI for a given URI and a base URI?arrow variant of > , fails if > returns Nothing@narrow for expanding an input URI into an absolute URI using global base URI, fails if input is not a legal URIAXarrow for selecting the scheme (protocol) of the URI, fails if input is not a legal URI."See Network.URI for URI componentsB\arrow for selecting the registered name (host) of the URI, fails if input is not a legal URICearrow for selecting the port number of the URI without leading ':', fails if input is not a legal URIDdarrow for selecting the user info of the URI without trailing '@', fails if input is not a legal URIESarrow for computing the path component of an URI, fails if input is not a legal URIFTarrow for computing the query component of an URI, fails if input is not a legal URIGWarrow for computing the fragment component of an URI, fails if input is not a legal URIHSarrow for computing the path component of an URI, fails if input is not a legal URI789:;<=>?@ABCDEFGH789:;<=>?@ABCDEFGH789:;<=>?@ABCDEFGH789:;<=>?@ABCDEFGHbCopyright (C) 2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?q'+,-123456 !#5789:;<>?@ABCDEFGq-',+132456#5 !789:;<>?@GECFBADDCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?JRead the content of a document.$This routine is usually called from Gc.0The input must be a root node (constructed with ), usually without children. The attribute list contains all input parameters, e.g. URI or source file name, encoding preferences, ... If the source name is empty, the input is read from standard input.The source is transformed into an absolute URI. If the source is a relative URI, or a file name, it is expanded into an absolute URI with respect to the current base URI. The default base URI is of protocol "file" and points to the current working directory.KThe currently supported protocols are "http", "file", "stdin" and "string".zThe latter two are internal protocols. An uri of the form "stdin:" stands for the content of the standard input stream.x"string:some text" means, that "some text" is taken as input. This internal protocol is used for reading from normal : values.;<=>?@IABCDEFJKGHIJLMNIJKLMNJKLMNI;<=>?@IABCDEFJKGHIJLMNECopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?Oa filter for DTD processingbinclusion of external parts of DTD, parameter entity substitution conditional section evaluationAinput tree must represent a complete document including root nodeKLMNOPQRSTUVOWXYZ[\]OOKLMNOPQRSTUVOWXYZ[\]FCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?Q substitution of general entities3input: a complete document tree including root node^_`abcdefghiQjQQ ^_`abcdefghiQjGCopyright (C) 2011 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?R XML parserInput tree must be a root tree with a text tree as child containing the document to be parsed. The parser generates from the input string a tree of a wellformed XML document, processes the DTD (parameter substitution, conditional DTD parts, ...) and substitutes all general entity references. Next step is character reference substitution. Last step is the document validation. Validation can be controlled by an extra parameter.Example: xparseXmlDocument True -- parse and validate document parseXmlDocument False -- only parse document, don't validateHThis parser is useful for applications processing correct XML documents.T HTML parserInput 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 errors occur, warnings are generated. The warnings can be issued, or suppressed. Example:  parseHtmlDocument True $ : parse document and issue warningsThis parser is useful for applications like web crawlers, where the pages may contain arbitray errors, but the application is only interested in parts of the document, e.g. the plain text.UDocument validationInput must be a complete document tree. The document is validated with respect to the DTD spec. Only useful for XML documents containing a DTD.If the document is valid, it is transformed with respect to the DTD, normalization of attribute values, adding default values, sorting attributes by name,...If no error was found, result is the normalized tree, else the error status is set in the list of attributes of the root node "/" and the document content is removed from the tree.VNamespace propagationInput must be a complete document tree. The namespace declarations are 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 definitionIf no error was found, result is the unchanged input tree, else the error status is set in the list of attributes of the root node "/" and the document content is removed from the tree.X^creates a new document root, adds all options as attributes to the document root and calls J.[If the document name is the empty string, the document will be read from standard input.For supported protocols see J RkSTUVWXlmRSTUVWXRSTUVWX RkSTUVWXlmdCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe\@fh-wedel.de) experimentalportableSafe09;<=?     "#$%& !*'()+,-./01237@64589:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefuhilgjonmrstkpqvwxyz{|}~H#Copyright (C) 2005-2013 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?Ythe main document input filterRthis filter can be configured by a list of configuration options, a value of type ef%for all available options see module bg withValidate yes/noW : switch on/off DTD validation. Only for XML parsed documents, not for HTML parsing.withSubstDTDEntities yes/nod : switch on/off entity substitution for general entities defined in DTD validation. Default is yes. Switching this option and the validation off can lead to faster parsing, in that case reading the DTD documents is not longer necessary. Only used with XML parsed documents, not with HTML parsing.withSubstHTMLEntities yes/noe : switch on/off entity substitution for general entities defined in HTML validation. Default is no. Switching this option on and the validation and substDTDEntities off can lead to faster parsing, in that case reading the DTD documents is not longer necessary, HTML general entities are still substituted. Only used with XML parsed documents, not with HTML parsing.withParseHTML yes/no : switch on HTML parsing.withParseByMimeType yes/nor : select XML/HTML parser by document mime type. text/xml and text/xhtml are parsed as XML, text/html as HTML.withCheckNamespaces yes/no5 : Switch on/off namespace propagation and checking!withInputEncoding <encoding-spec> : Set default encoding. withTagSoup : use light weight and lazy parser based on tagsoup lib. This is only available when package hxt-tagsoup is installed and the source contains an import Text.XML.HXT.TagSoup.withRelaxNG <schema.rng> : validate document with Relax NG, the parameter is for the schema URI. 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 the source contains an import Text.XML.HXT.Curl.withHTTP [<http-option>...] : Use the Haskell HTTP package for HTTP access. This is only available when package hxt-http is installed and the source contains an import Text.XML.HXT.HTTP. examples: readDocument [] "test.xml"greads 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 [] ] "http://localhost/test.php"reads document "test.php", parses it as HTML or XML depending on the mimetype given from the server, but without validation, default encoding @". HTTP access is done via libCurl. ereadDocument [ withParseHTML yes , withInputEncoding isoLatin1 ] ""hreads a HTML document from standard input, no validation is done when parsing HTML, default encoding is @, readDocument [ withInputEncoding isoLatin1 , withValidate no , withMimeTypeFile "/etc/mime.types" , withStrictInput yes ] "test.svg"}reads an SVG document from "test.svg", sets the mime type by looking in the system mimetype config file, default encoding is @, $... import Text.XML.HXT.Curl import Text.XML.HXT.TagSoup ... readDocument [ withParseHTML yes , withTagSoup , withProxy "www-cache:3128" , withCurl [] , withWarnings no ] "http://www.haskell.org/".reads Haskell homepage with HTML parser, ignoring any warnings (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/"read 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 readDocument [ withValidate no , withSubstDTDEntities no ... ] "http://www.w3c.org/"read w3c home page (xhtml), but without accessing the DTD given in that document. Only the predefined XML general entity refs are substituted. readDocument [ withValidate no , withSubstDTDEntities no , withSubstHTMLEntities yes ... ] "http://www.w3c.org/"Psame as above, but with substituion of all general entity refs defined in XHTML."for minimal complete examples see La and #3, the main starting point for running an XML arrow.Zthe arrow version of Y#, the arrow input is the source URI[9read a document that is stored in a normal Haskell Stringathe same function as readDocument, but the parameter forms the input. All options available for Y? are applicable for readString, except input encoding options.Encoding: No decoding is done, the String argument is taken as Unicode string All decoding must be done before calling readString, even if the XML document contains an encoding spec.\the arrow version of [#, the arrow input is the source URI]parse a string as HTML content, substitute all HTML entity refs and canonicalize tree. (substitute char refs, ...). Errors are ignored.RThis arrow delegates all work to the parseHtmlContent parser in module HtmlParser.This is a simpler version of \; without any options, but it does not run in the IO monad.^<like hread, but accepts a whole document, not a HTML content_parse a string as XML CONTENT, (no xml decl or doctype decls are allowed), substitute all predefined XML entity refs and canonicalize tree This xread arrow delegates all work to the xread parser function in module XmlParsec`a more general version of xread which parses a whole document including a prolog (xml decl, doctype decl) and processing instructions. Doctype decls remain uninterpreted, but are in the list of results trees. YnoZ[\]^_`YZ[\]^_`YZ[\]^_` YnoZ[\]^_`ICopyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?bDcheck whether a sequence of XmlTrees match an Xml regular expressionThe arrow for x.BThe expession is build up from simple arrows acting as predicate (i<) for an XmlTree and of the usual cobinators for sequence (n), repetition (k , mkRep', q) and choice (l, r)c9split the sequence of trees computed by the filter a intoThe arrow for y.a first part matching the regex and a rest, if a prefix of the input sequence does not match the regex, the arrow fails else the pair containing the result lists is returneddscan 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 regexThe arrow for z.xBmatch a sequence of XML trees with a regular expression over treesSIf the input matches, the result is Nothing, else Just an error message is returnedyKsplit a sequence of XML trees into a pair of a a matching prefix and a rest3If there is no matching prefix, Nothing is returnedzMscan a sequence of XML trees and split it into parts matching the given regexxIf the parts cannot be split because of a missing match, or because of the empty sequence as match, Nothing is returned+apqrstuvwxyzbcdefghijk{lmnopqrstu|vw}xy~z{abcdefghijklmnopqrstuvwxyzaefghijklmnopqrstuvwxyzbcd a pqrstuvwxyzbcdefghijk{lmnopqrstu|vw}xy~z{JCopyright (C) 2008 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?Read a serialied value from a file, optionally decompress it and decode the value In case of an error, the error message is issued and the arrow fails}Serialize a value, optionally compress it, and write it to a file. In case of an error, the error message is issued and the arrow fails|}|}|}|}K Copyright (C) 2005-9 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?~MWrite the contents of a document tree into an output stream (file or stdout).{If textMode is set, writing is done with Haskell string output, else (default) writing is done with lazy ByteString output5write the tree representation of a document to a file0write a document with indentaion and line numers ~~~ ~L Copyright (C) 2005-9 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=?%the main filter for writing documents5this filter can be configured by an option list like H`usage: & writeDocument optionList destination if  destination < is the empty string or "-", stdout is used as output devicefor available options see bg withOutputXML : (default) issue XML: quote special XML chars >,<,",',& where neccessary add XML processing instruction and encode document with respect to output encoding,withOutputHTML : 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.../a for HTML elements, that are allowed to contain a none empty body. Result is for the example is  script... /script9. The short form introduces trouble in various browsers.withOutputXHTML : same as withOutputHTML>, but all none ASCII chars are substituted by char references.withOutputPLAINw : 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  ?xmlversion=... encoding=... ?J processing instruction to the beginning of the document. Default is yes.withAddDefaultDTD : if the document to be written was build by reading another document containing a Document Type Declaration, 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; : show Haskell representaion of document (for debugging)Ka 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 ()an 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 ( configSysVars [ withTrace 1 -- set the defaults for all read-, , withCurl [] -- write- and other operations -- or withHTTP [] ] >>> readDocument [ withTrace 2 -- use these additional , withParseHTML yes -- options only for this read ] "http://www.haskell.org/" >>> writeDocument [ withOutputEncoding isoLatin1 ] "" -- output to stdout >>> getErrStatus ) exitWith ( if rc >= c_err then ExitFailure 1 else ExitSuccess )bConvert a document into a string. Formating is done the same way and with the same options as in . Default output encoding is no encoding, that means the result is a normal unicode encode haskell string. The default may be overwritten with the ?h. option. The XML PI can be suppressed by the ij option.This arrow fails, when the encoding scheme is not supported. 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 outputM#Copyright (C) 2005-2012 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?9The class for overloading , the default pickler Choice combinator for unpicklingZfirst 2 arguments are applied sequentially, but if the 1. one fails the 3. arg is applied,Lift a Maybe value into the Unpickler monad.(The 1. arg is the attached error message-Lift an Either value into the Unpickler monad'Format the context of an error message.;conversion of an arbitrary value into an XML document tree.xThe 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 typeThe inverse of *. This law should hold for all picklers: ' unpickle px . pickle px $ v == Just v . Not every possible combination of picklers does make sense. For reconverting a value from an XML tree, is becomes neccessary, to introduce "enough" markup for unpickling the valueULike unpickleDoc but with a (sometimes) useful error message, when unpickling failed.4The main entry for unpickling, called by unpickleDoc6Pickles a value, then writes the document to a string.The zero pickler/Encodes nothing, fails always during unpickling unit picklerCheck EOF pickler.zWhen pickling, this behaves like the unit pickler. The unpickler fails, when there is some unprocessed XML contents left.8Like xpCheckEmptyContents, but checks the attribute list9Composition of xpCheckEmptyContents and xpCheckAttributes Lift a Maybe value to a pickler.Nothing is mapped to the zero pickler, Just x is pickled with xpLift x."Combine two picklers sequentially.@If the first fails during unpickling, the whole unpickler fails4First apply a fixed pickler/unpickler, then a 2. oneIf the first fails during unpickling, the whole pickler fails. This can be used to check some properties of the input, e.g. whether a given fixed attribute or a namespace declaration exists (, G) or to filter the input, e.g. to ignore some elements or attributes (, ).When pickling, this can be used to insert some fixed XML pieces, e.g. namespace declarations, class attributes or other stuff."combine tow picklers with a choiceRun two picklers in sequence like with xpSeq. If during unpickling the first one fails, an alternative pickler (first argument) is applied. This pickler is only used as combinator for unpickling.5map 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 failsdMap a value into another domain. If the inverse mapping is undefined (Nothing), the unpickler fails>Deprecated: Use xpWrapEither, this gives better error messageslike >, but if the inverse mapping is undefined, the unpickler failsMap a value into another domain. If the inverse mapping is undefined, the unpickler fails with an error message in the Left component$pickle a pair of values sequentially[Used for pairs or together with wrap for pickling algebraic data types with two componentsLike  but for triplesLike  and  but for 4-tuplesLike  and  but for 5-tuplesLike  and  but for 6-tuplesLike  and  but for 7-tuples9Thanks to Tony Morris for doing xp7Tuple, ..., xp24Tuple."Hopefully no one needs a xp25Tuple%Pickle a string into an XML text nodeZOne of the most often used primitive picklers. Attention: For pickling empty strings use A. If the text has a more specific datatype than xsd:string, use %Pickle a string into an XML text nodevText pickler with a description of the structure of the text by a schema. A schema for a data type can be defined by  . In NkJ there are some more functions for creating simple datatype descriptions.0Pickle a possibly empty string into an XML node.QMust be used in all places, where empty strings are legal values. If the content of an element can be an empty string, this string disapears during storing the DOM into a document and reparse the document. So the empty text node becomes nothing, and the pickler must deliver an empty string, if there is no text node in the document.LPickle a possibly empty string with a datatype description into an XML node.Like 9 but with extra Parameter for datatype description as in .XPickle 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 Int#Pickle an XmlTree by just adding it?Usefull for components of type XmlTree in other data structuresiPickle 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.ePickle a string representing XML contents by inserting the tree representation into the XML document.4Unpickling is done by converting the contents with [ into a string, this function will escape all XML special chars, such that pickling the value back becomes save. Pickling is done with _Encoding of optional data by ignoring the Nothing case during pickling and relying on failure during unpickling to recompute the Nothing case#The default pickler for Maybe types&Optional conversion with default value{The default value is not encoded in the XML document, during unpickling the default value is inserted if the pickler failsCEncoding of list values by pickling all list elements sequentially.Unpickler relies on failure for detecting the end of the list. 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 valueskAttention: when calling this pickler with an empty list, an internal error "head of empty list is raised".Standard pickler for mapsThis pickler converts a map into a list of pairs. 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, the 3. arg is the pickler for the keys, the last one for the valuesPickler for sum data types.Every 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 taken8Pickler for wrapping/unwrapping data into an XML elementeExtra parameter is the element name given as a QName. THE pickler for constructing nested structuresExample: $xpElemQN (mkName "number") $ xpicklewill map an (42::Int) onto <number>42</number>convenient Pickler for xpElemQN xpElem n = xpElemQN (mkName n)Sconvenient Pickler for xpElemQN for pickling elements with respect to namespaces /xpElemNS ns px lp = xpElemQN (mkQName px lp ns)[Pickler for wrapping/unwrapping data into an XML element with an attribute with given valueTo make XML structures flexible but limit the number of different elements, it's sometimes useful to use a kind of generic element with a key value structureExample: _<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) ) $ xpTriple (xpElemWithAttrValue "attr" "name" "key1" $ xpickle) (xpElemWithAttrValue "attr" "name" "key2" $ xpText0) (xpElemWithAttrValue "attr" "name" "key3" $ xpickle)@Pickler for storing/retreiving data into/from an attribute valueHThe attribute is inserted in the surrounding element constructed by the  picklerconvenient Pickler for xpAttrQN xpAttr n = xpAttrQN (mkName n)convenient Pickler for xpAttrQN -xpAttr ns px lp = xpAttrQN (mkQName px lp ns)A text attribute.:Add an optional attribute for an optional value (Maybe a).*Add/Check an attribute with a fixed value.Add a namespace declaration.When generating XML the namespace decl is added, when reading a document, the unpickler checks whether there is a namespace declaration for the given namespace URI (2. arg)nWhen unpickling, filter the contents of the element currently processed, before applying the pickler argumentXMaybe useful to ignore some stuff in the input, or to do some cleanup before unpickling.Same as @ but for the attribute list of the element currently processed.oMaybe useful to ignore some stuff in the input, e.g. class attributes, or to do some cleanup before unpickling.ykylNCopyright (C) 2005 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de) experimentalportableNone09;<=? 4store an arbitray value in a persistent XML documentIThe pickler converts a value into an XML tree, this is written out with Ra. The option list is passed to Ra%An option evaluated by this arrow is . If  is set (?), 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 documentThe document is read with R`. Options are passed to R`8. The conversion from XmlTree is done with the pickler.> 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, the whitespace must be removed during unpickling.4Write out the DTD generated out of a pickler. Calls  xpicklerDTD1The arrow for generating the DTD out of a picklercA DTD is generated from a pickler and check for consistency. Errors concerning the DTD are issued.An arrow for checking picklers6A 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.@If 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  W W   l#Copyright (C) 2006-2010 Uwe SchmidtMITUwe Schmidt (uwe@fh-wedel.de)stableportableNone09;<=?p*+,-./0123456789:;<=>?@9fghijklmnopqrstuvwxyz{|}~/0123456xzy{|}~     "#$%& !*'()+,-./01237@64589:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefuhilgjonmrstkpqvwxyz{|}~LM( '?)& !"#$%*+-./012789;<=ABC FK,   3456:>@DEGIHJVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~'+,-123456      !#5789:;<>?@ABCDEFGIJKLMNQRSTUVWXYZ[\]^_`|}~ mnopqrstuvwxyz{|}~       ! " # $ % & ' ( ) * + , - . / 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 [ \]^_`abcdefghijklmnopqrstuvwxyz{|}~]      !"#$%&'()*+,-./0123456789:;<X=>?@ABCDEFGHIJKLMNOPQRSTUVWXYkZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789: ;< = > ? @ A B C!D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!Q!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${$W$|$}$~$$Z$Y$$$$$$$$$$$$%%%%%%&&&&&&&&&&&&&&&&&&&&''''''_'`'a'b'c'd''e'f'g'h'i'j''l''''''''T'''''((o(n(s(r((w(v(u(t((((((((((((((())))))))))))))))**+++++++++++++++++,,,,,,,,---..................//////// / / / / /////////0000000000 0!0"0#0$00%0&0'0(0S00000000)000000*0+0,0-0.0/0001020304050000000000060708090:0;0<0=0>0?000@0A0B0C0D0E0F000000000000000G0000000H0I0J0K0000L0000M00N0000O0P00Q0R0S0T0U000V0W0X0Y0Z0[0\0]1^1_1`1a1b1c1d1e1f1g1h1i1j1k1l1m1n1o1p1q1r1s1t1u1v1w1x1y1z1{1|1}1~122222222222O233^33X3e3d3\3B3C3A3_3`3334444444444444444444444444444444445566789:;;;;;;;<<f<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< < < < < <<<<<<<<<<<<<<<<<<< <!<"<#<$<$<%<&<'<(<)<*<+<,<-<.</<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<g<h<i<j<k<l<m<n<o<p<q<r<s<t<u<v<w<x<y<z<{<|<}<~<<<<<<<<<<<<<<<<======================>>>????????????????????????????h??????????????@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@j@@@@@@@@@@@@@@@@@@@@@@@ A A A A AAAAAAAAABBBBBBBBBB B!B"B#B$B%B&B'B(B)B*C+C,C-C.C/C0C1C2C3C4C5C6C7C8C9C:C;C<D=D>D?D@DADBECEDFEG[GFGgGGGHGIGcH`HJHKHLHHHQHXIMINIOIPIQIRISITIUIVIWIXIYIZI[I\I]I^I_I`IaIIbIcIdIeIfJgJhKiKjKkKlKmLaLnLoLpMqMrMsMtMuMvMwMxMyMyMzM{M|M}M}M~MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNb        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFG 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 g h  i j k l m   ! # $ n!o!p!q!r!s!t!u!v!w!x!y!z!{!|!}!i!~!!"""""""P"i""""""""""""""""""""""""""""111111111111111122222255555555555556666677777777788888888889b:::::::::: : : : : :::;DDDDDDDDDDDDDD D!D"E#E#E$E%E&E'E(E)E*E+E,E-E.E/E0E1E2E3E4F5F5F%F6F7F8F9F:F;F<F=F>F?G@GGAHBHCIDIEIFIGIHI\I[I]IIIJIKILIMINIOIPJQJRKSKTKUKVW#hxt-9.3.1.16-K8cCPyES1aM5rb8U4zfDxQ*Text.XML.HXT.XMLSchema.DataTypeLibW3CNamesText.XML.HXT.VersionText.XML.HXT.Parser.XmlEntities!Text.XML.HXT.Parser.XmlCharParser!Text.XML.HXT.Parser.XhtmlEntitiesText.XML.HXT.DTDValidation.REText.XML.HXT.DOM.XmlKeywordsText.XML.HXT.IO.GetFILEText.XML.HXT.DOM.Util'Text.XML.HXT.Parser.ProtocolHandlerUtil!Text.XML.HXT.DOM.MimeTypeDefaultsText.XML.HXT.DOM.MimeTypesData.Tree.NavigatableTree.Class#Data.Tree.NavigatableTree.XPathAxisData.Tree.ClassData.Function.Selector Data.AtomData.AssocListControl.FlatSeqData.Tree.NTree.TypeDefsData.Tree.NTree.EditData.Tree.NTree.Zipper.TypeDefsText.XML.HXT.DOM.QualifiedNameText.XML.HXT.DOM.TypeDefs Text.XML.HXT.Arrow.Pickle.SchemaText.XML.HXT.DOM.XmlNodeText.XML.HXT.Arrow.Pickle.DTDText.XML.HXT.DOM.ShowXmlText.XML.HXT.DOM.FormatXmlTree"Text.XML.HXT.Parser.XmlTokenParser%Text.XML.HXT.Parser.XmlDTDTokenParser Text.XML.HXT.Parser.XmlDTDParserText.XML.HXT.Parser.XmlParsecText.XML.HXT.Parser.HtmlParsecControl.Arrow.ArrowStateControl.Arrow.ArrowListControl.Arrow.ArrowNFControl.Arrow.ArrowIf"Control.Arrow.ArrowNavigatableTreeControl.Arrow.ArrowTreeControl.Arrow.ListArrowControl.Arrow.NTreeEditControl.Arrow.StateListArrowControl.Arrow.ArrowIOControl.Arrow.ArrowExcControl.Arrow.IOListArrowControl.Arrow.IOStateListArrowText.XML.HXT.Arrow.XmlArrowText.XML.HXT.Arrow.EditText.XML.HXT.Arrow.Namespace"Text.XML.HXT.Arrow.ParserInterface#Text.XML.HXT.DTDValidation.TypeDefs3Text.XML.HXT.DTDValidation.AttributeValueValidation(Text.XML.HXT.DTDValidation.DTDValidation,Text.XML.HXT.DTDValidation.DocTransformation'Text.XML.HXT.DTDValidation.IdValidation Text.XML.HXT.DTDValidation.XmlRE(Text.XML.HXT.DTDValidation.DocValidation%Text.XML.HXT.DTDValidation.Validation$Text.XML.HXT.Arrow.XmlState.TypeDefs)Text.XML.HXT.Arrow.XmlState.ErrorHandling)Text.XML.HXT.Arrow.XmlState.MimeTypeTable(Text.XML.HXT.Arrow.XmlState.SystemConfigText.XML.HXT.Arrow.XmlOptions)Text.XML.HXT.Arrow.XmlState.TraceHandling+Text.XML.HXT.Arrow.XmlState.RunIOStateArrow'Text.XML.HXT.Arrow.XmlState.URIHandling Text.XML.HXT.Arrow.DocumentInput Text.XML.HXT.Arrow.DTDProcessing,Text.XML.HXT.Arrow.GeneralEntitySubstitution"Text.XML.HXT.Arrow.ProcessDocumentText.XML.HXT.Arrow.ReadDocumentText.XML.HXT.Arrow.XmlRegexText.XML.HXT.Arrow.Binary!Text.XML.HXT.Arrow.DocumentOutput Text.XML.HXT.Arrow.WriteDocumentText.XML.HXT.Arrow.Pickle.XmlText.XML.HXT.Arrow.PicklepropagateNamespacesText.XML.HXT.DOM.InterfacexreadText.XML.HXT.ArrowArrowXmlControlFlatSeqDeepSeqisAXmlTreenonethis ReadDocument escapeXmlDoc AssocListText.XML.HXT.DOMMimeTypeDefaults readDocument writeDocumentText.XML.HXT.Arrow.XmlStategetDocumentContentsControl.Arrow.ListArrowsText.XML.HXT.XmlState.TypeDefs SysConfig SystemConfigwithOutputEncodingText.XML.HXT.XmlKeywords a_no_xml_piSchemaText.XML.HXT.Corew3cNS 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_boolean xsd_float xsd_doublexsd_time xsd_durationxsd_date xsd_dateTimexsd_gDay xsd_gMonth xsd_gMonthDay xsd_gYearxsd_gYearMonth xsd_length xsd_maxLength xsd_minLengthxsd_maxExclusivexsd_minExclusivexsd_maxInclusivexsd_minInclusivexsd_totalDigitsxsd_fractionDigits xsd_patternxsd_enumerationxsd_whiteSpace hxt_version xmlEntitiesXPStatexps_normalizeNewline xps_userState SimpleXParserXParserwithNormNewlinewithoutNormNewlinexmlChar xmlNameCharxmlNameStartChar xmlNCNameCharxmlNCNameStartChar xmlLetter xmlSpaceChar xmlCRLFChar xhtmlEntitiesRERE_ZERORE_UNITRE_SYMRE_DOTRE_REPRE_PLUSRE_OPTRE_SEQRE_ALTre_zerore_unitre_symre_dotre_repre_plusre_optre_seqre_altnullablematchescheckREprintRE$fShowRE$fEqRE$fOrdREt_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 xmlNamespacexmlnsNamespacerelaxNamespace getStdinContgetCont stringTrim stringToUpper stringToLower stringAll stringFirst stringLastnormalizeNumbernormalizeWhitespacenormalizeBlanks escapeURIstringEscapeXml textEscapeXml attrEscapeXml stringToInthexStringToIntdecimalStringToIntstringToHexStringcharToHexStringintToHexStringdoublessingles noDoublesswappartitionEithertoMaybeuncurry3uncurry4parseContentTypemimeTypeDefaults MimeTypeTableapplication_xhtmlapplication_xml&application_xml_external_parsed_entityapplication_xml_dtd text_htmltext_pdf text_plain text_xdtdtext_xmltext_xml_external_parsed_entityisTextMimeTypeisHtmlMimeType isXmlMimeTypedefaultMimeTypeTableextensionToMimeTypereadMimeTypeTableparseMimeTypeTableNavigatableTreeModify addTreeLeft addTreeRight dropTreeLeft dropTreeRight substThisTreeNavigatableTreeToTreefromTreetoTreeNavigatableTreemvUpmvDownmvLeftmvRight maybeStar maybePlus parentAxis ancestorAxisancestorOrSelfAxis childAxisdescendantAxisdescendantOrSelfAxisrevDescendantOrSelfAxisfollowingSiblingAxisprecedingSiblingAxisselfAxis followingAxis precedingAxismvToRootisAtRootTreemkTreemkLeafisLeafisInnergetNode getChildren changeNodechangeChildrensetNode setChildrenfoldTree nodesTree depthTreecardTree formatTree formatNTree'Comp3comp3Comp2comp2Comp1comp1SelectorSgetSsetSchgSchgM mkSelectoridS.&&&. $fComp3(,,)c $fComp2(,,)b $fComp1(,,)a $fComp2(,)b $fComp1(,)a$fCategoryTYPESelectorAtomnewAtomshare $fNFDataAtom $fShowAtom $fReadAtom $fOrdAtom$fEqAtom lookupDeflookup1hasEntryaddEntry addEntriesdelEntry delEntriesWNFDatarwnfrwnf2$!!flatseqrlnf$fWNFData(,,,) $fWNFData(,,) $fWNFData(,) $fWNFData[]$fWNFDataWord64$fWNFDataWord32$fWNFDataWord16$fWNFDataWord8 $fWNFDataWord $fWNFData() $fWNFDataBool $fWNFDataChar$fWNFDataDouble$fWNFDataFloat$fWNFDataInteger $fWNFDataIntNTreesNTree $fTreeNTree$fTraversableNTree$fFoldableNTree$fFunctorNTree $fBinaryNTree$fWNFDataNTree $fNFDataNTree $fEqNTree $fOrdNTree $fShowNTree $fReadNTreeeditNTreeBottomUp mapNTree'NTCrumbNTC NTBreadCrumbsNTZipperNTZntreecontext toNTZipper fromNTZipperupdown toTheRight toTheLeft addToTheLeft addToTheRightdropFromTheLeftdropFromTheRightisTopup1$$fNavigatableTreeModifyNTZipperNTree$$fNavigatableTreeToTreeNTZipperNTree$fNavigatableTreeNTZipper$fTreeNTZipper$fFunctorNTCrumb$fFunctorNTZipper $fShowNTCrumb$fShowNTZipperQName localPart' namePrefix' namespaceUri'NsEnvXNameunXN isNullXName namePrefix localPart namespaceUrisetNamespaceUri' setLocalPart'setNamePrefix' qualifiedNamequalifiedName' universalName universalUribuildUniversalNamemkQName'mkPrefixLocalPartmkNamemkQName mkSNsNamemkNsName equivQNameequivUri equalQNameBynormalizeNsUri setNamespaceisNCNameisWellformedQualifiedNameisWellformedQNameisWellformedNSDeclisWellformedNameSpaceNameisNameSpaceNameisDeclaredNamespacetoNsEnv nullXNamexmlnsNamespaceXName xmlnsXNamexmlNamespaceXNamexmlXNamexmlnsQNnewXNamenewQName $fBinaryQName $fShowQName$fWNFDataQName $fNFDataQName $fOrdQName $fEqQName $fBinaryXName$fWNFDataXName $fNFDataXName $fOrdXName $fEqXName ChildNodes XmlNodeSetXNSthisNode attrNodes childNodes AttributesBlobDTDElemDOCTYPEELEMENTCONTENTATTLISTENTITYPENTITYNOTATIONCONDSECTNAMEPEREFXNodeXTextXBlobXCharRef XEntityRefXCmtXCdataXPiXTagXDTDXAttrXError XmlNavTrees XmlNavTreeXmlTreesrwnfAttributes blobToString stringToBlobc_okc_warnc_errc_fatal$fBinaryDTDElem$fWNFDataDTDElem$fNFDataDTDElem $fBinaryXNode$fWNFDataXNode $fNFDataXNode $fEqDTDElem $fOrdDTDElem $fEnumDTDElem $fShowDTDElem $fReadDTDElem $fEqXNode $fShowXNode$fEqXmlNodeSet$fShowXmlNodeSet DataTypeDescrDTDescrdtLibdtNamedtParamsSchemasNameAnySeqAltRepElement AttributeElemRefCharDatasc_lsc_lbsc_ubsc_1sc_nsc_dtisScXsd isScFixedisScEnumisScElemisScAttr isScElemRef isScCharDataisScSAREisScListisScOptxsdParamscDTscDTxsdscString scString1scFixedscEnum scNmtoken scNmtokensscEmptyscSeqscSeqsscNullscAltscAltsscOptionscListscList1scOptscRepscElemscAttr$fEqDataTypeDescr$fShowDataTypeDescr $fEqSchema $fShowSchemaXmlNodeisTextisBlob 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'toTextconcText mergeText $fXmlNodet$fXmlNodeXNodeDTDdescr dtdDescrToXmlcheckAttrModellcheckAMcheckAMCcheckContentModell scContToXmlscWrapscContscConts scAttrToXmlcheckErrfoundErrdtdDescrelementDeclarations elementDecs elemNameselemNameelemRefsattrDec remAttrDec$fShowDTDdescrxshow xshowBlobxshow'xshow''formatXmlContents formatXmlTreesPacesPace0skipSskipS0 asciiLetternamencNameqNamenmtokennamesnmtokens singleChar singleChars entityValue attrValueattrChar systemLiteral pubidLiteral referencecharRef entityRef peReferenceencName versionNumkeywordkeywordsquoteddqsqltgtsemiamp separatorbarcommaeqlparrpar checkStringallButallBut1concResmkListnameTnmtokenT entityValueT entityTokensT entityCharT attrValueT attrValueT' singleCharsT referenceTcharRefT entityRefT peReferenceTmergeTextNodesdtdDeclTokenizer dtdDeclStart dtdDeclEnddtdTokendtdCharspercent elementDecl attlistDecl entityDecl notationDeclparseXmlDTDEntityValueparseXmlDTDdeclPartparseXmlDTDdeclcharData charData'commentpIcDSectdocument document'prologxMLDeclxMLDecl' versionInfomisc doctypedecl markupdeclsDDeclelementcontentcontentWithTextDecltextDecl encodingDeclxreadDocparseXmlContent parseXmlTextparseXmlDocumentremoveEncodingSpec parseXmlPartparseXmlDTDPartparseXmlEntityValueAsContentparseXmlEntityValueAsAttrValue parseNMToken parseNameparseXmlEncodingSpecparseXmlEntityEncodingSpecparseXmlDocEncodingSpec parseHtmlTextparseHtmlDocumentparseHtmlContentisEmptyHtmlTag emptyHtmlTagsisInnerHtmlTagOf closesHtmlTag ArrowState changeState accessStategetStatesetState nextState ArrowListarr2arr3arr4arr2AarrLarr2LconstAconstL>>.>.listAunlistA withDefaultsingleapplyA$<$<<$<<<$<<<<$<$mergeAperformcatAseqAArrowWNFrwnfArwnf2AArrowNFrnfAstrictAIfThen:->ArrowIfifAifPnegwhenwhenPwhenNotwhenNotPguardsguardsPfilterA containing notContainingorElsechoiceAtagAspanA partitionAArrowNavigatableTreemoveUpmoveDownmoveLeft moveRightdescendantOrFollowingAxis moveToRootaddNavremNavwithNav withoutNav filterAxismoveOnchangeThisTree addToOneSide ArrowTreehasNodeprocessChildrenreplaceChildren/>//>Control.Category>>>GHC.Listspan Data.OldList partitionEntityRefTablecanonicalizeTree'EntitySubstTablecanonicalizeNodes has2XTextcollapseXText'xmlEntityRefTablexhtmlEntityRefTablebuildEntityRefTablexhtmlEntitySubstTable lookupRefremoveRootWhiteSpace indentRoot indentTreesinsertIndentation insertNothingprocessWithNsEnv1propagateNamespaceEnvvalidate1NamespacescleanupNamespaces' attachEnvvalidateNamespaces1leftApp^<<<<^>>^^>>returnAArrowarrfirstsecond***&&&Kleisli runKleisli ArrowZero zeroArrow ArrowPlus ArrowChoice|||+++leftright ArrowApplyapp ArrowMonad ArrowLooploop<<< checkValuecheckValueEnumerationcheckValueEntitycheckValueEntitiescheckValueNmtokencheckValueNmtokens checkValueIdcheckValueIdrefcheckValueIdrefs checkForNamecdataNormalizationotherNormalizationreduceWSSequencesvalidateNotationsvalidateEntitiesvalidateElementsvalidateAttributes checkName TransEnvTable traverseTreebuildAllTransformationFunctionsbuildTransformationFunctionslexicographicAttributeOrdernormalizeAttributeValuessetDefaultAttributeValuesTransFctElemName IdEnvTable getIdValuebuildIdCollectorFctsbuildIdrefValidationFctscheckForUniqueIdscheckIdReferencesIdFctIdEnv ValiEnvTablebuildAllValidationFunctionsbuildValidateRootbuildValidateFunctionsbuildContentValidationcreateREbuildAttributeValidationnoDoublicateAttributescheckRequiredAttributescheckFixedAttributescheckNotDeclardAttributescheckValuesOfAttributesValFctValiEnv checkRegexgetDTDGHC.BaseStringprotocolHandlersgetProtocolHandlergetUnsupportedgetStringContentsgetFileContentsgetStdinContents addMimeType addTxtContentgetHttpContentsgetContentsFromStringgetContentsFromDocsetBaseURIFromDocgetXmlContents' isMimeDoc isTextDoc isXmlHtmlDocPEEnv DTDStateArrowRecListDTDPartInternalExternal emptyPeEnv lookupPeEnv addPeEntry getPeValueaddPesubstParamEntitiessubstParamEntity predefDTDPartexternalDTDPartgetExternalDTDPartgetExternalParamEntityValuetraceDTDGEEnvGEArrow GESubstArrow GEContextReferenceInContentReferenceInAttributeValueReferenceInEntityValue emptyGeEnv lookupGeEnv addGeEntryprocessGeneralEntitycheckUndefinedEntityRefs transformDoc readDocument'readDocument''ZeroUnitSymDotStarRngPermMergermStar unexpecteddelta'splitXmlRegex' scanXmlRegex'decodeBinaryValueencodeBinaryValuegetEncodingParamgetOutputEncoding isBinaryDocgetOutputEncoding'