/usr/share/doc/libghc-haxml-doc/html/Text-XML-HaXml-Parse.html is in libghc-haxml-doc 1:1.22.5-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Text.XML.HaXml.Parse</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Text-XML-HaXml-Parse.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Text-XML-HaXml-Parse.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">HaXml-1.22.5: Utilities for manipulating XML documents</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Safe-Infered</td></tr></table><p class="caption">Text.XML.HaXml.Parse</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Parse a whole document
</a></li><li><a href="#g:2">Parse just a DTD
</a></li><li><a href="#g:3">Parse a partial document
</a></li><li><a href="#g:4">Individual parsers for use with <em>xmlParseWith</em> and module SAX
</a></li><li><a href="#g:5">These general utility functions don't belong here
</a></li></ul></div><div id="description"><p class="caption">Description</p><div class="doc"><p>A non-validating XML parser. For the input grammar, see
<a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a>.
</p></div></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:xmlParse">xmlParse</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="Text-XML-HaXml-Types.html#t:Document">Document</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a></li><li class="src short"><a href="#v:xmlParse-39-">xmlParse'</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="Text-XML-HaXml-Types.html#t:Document">Document</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)</li><li class="src short"><a href="#v:dtdParse">dtdParse</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Text-XML-HaXml-Types.html#t:DocTypeDecl">DocTypeDecl</a></li><li class="src short"><a href="#v:dtdParse-39-">dtdParse'</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Text-XML-HaXml-Types.html#t:DocTypeDecl">DocTypeDecl</a>)</li><li class="src short"><a href="#v:xmlParseWith">xmlParseWith</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> a -> [(<a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>, <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a>)] -> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> a, [(<a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>, <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a>)])</li><li class="src short"><a href="#v:document">document</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> (<a href="Text-XML-HaXml-Types.html#t:Document">Document</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)</li><li class="src short"><a href="#v:element">element</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> (<a href="Text-XML-HaXml-Types.html#t:Element">Element</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)</li><li class="src short"><a href="#v:content">content</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> (<a href="Text-XML-HaXml-Types.html#t:Content">Content</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)</li><li class="src short"><a href="#v:comment">comment</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:Comment">Comment</a></li><li class="src short"><a href="#v:cdsect">cdsect</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:CDSect">CDSect</a></li><li class="src short"><a href="#v:chardata">chardata</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:CharData">CharData</a></li><li class="src short"><a href="#v:reference">reference</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:Reference">Reference</a></li><li class="src short"><a href="#v:doctypedecl">doctypedecl</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:DocTypeDecl">DocTypeDecl</a></li><li class="src short"><a href="#v:processinginstruction">processinginstruction</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:ProcessingInstruction">ProcessingInstruction</a></li><li class="src short"><a href="#v:elemtag">elemtag</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:ElemTag">ElemTag</a></li><li class="src short"><a href="#v:qname">qname</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:QName">QName</a></li><li class="src short"><a href="#v:name">name</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:Name">Name</a></li><li class="src short"><a href="#v:tok">tok</a> :: <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a> -> <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a></li><li class="src short"><a href="#v:elemOpenTag">elemOpenTag</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:ElemTag">ElemTag</a></li><li class="src short"><a href="#v:elemCloseTag">elemCloseTag</a> :: <a href="Text-XML-HaXml-Types.html#t:QName">QName</a> -> <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a></li><li class="src short"><a href="#v:emptySTs">emptySTs</a> :: SymTabs</li><li class="src short"><span class="keyword">type</span> <a href="#t:XParser">XParser</a> a = <a href="/usr/share/doc/libghc-polyparse-doc/html/Text-ParserCombinators-Poly-StateParser.html#t:Parser">Parser</a> SymTabs (<a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>, <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a>) a</li><li class="src short"><a href="#v:fst3">fst3</a> :: (a, b, c) -> a</li><li class="src short"><a href="#v:snd3">snd3</a> :: (a, b, c) -> b</li><li class="src short"><a href="#v:thd3">thd3</a> :: (a, b, c) -> c</li></ul></div><div id="interface"><h1 id="g:1">Parse a whole document
</h1><div class="top"><p class="src"><a name="v:xmlParse" class="def">xmlParse</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="Text-XML-HaXml-Types.html#t:Document">Document</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a><a href="src/Text-XML-HaXml-Parse.html#xmlParse" class="link">Source</a></p><div class="doc"><p>To parse a whole document, <code>xmlParse file content</code> takes a filename
(for generating error reports) and the string content of that file.
A parse error causes program failure, with message to stderr.
</p></div></div><div class="top"><p class="src"><a name="v:xmlParse-39-" class="def">xmlParse'</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="Text-XML-HaXml-Types.html#t:Document">Document</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)<a href="src/Text-XML-HaXml-Parse.html#xmlParse%27" class="link">Source</a></p><div class="doc"><p>To parse a whole document, <code>xmlParse' file content</code> takes a filename
(for generating error reports) and the string content of that file.
Any parse error message is passed back to the caller through the
<code>Either</code> type.
</p></div></div><h1 id="g:2">Parse just a DTD
</h1><div class="top"><p class="src"><a name="v:dtdParse" class="def">dtdParse</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Text-XML-HaXml-Types.html#t:DocTypeDecl">DocTypeDecl</a><a href="src/Text-XML-HaXml-Parse.html#dtdParse" class="link">Source</a></p><div class="doc"><p>To parse just a DTD, <code>dtdParse file content</code> takes a filename
(for generating error reports) and the string content of that
file. If no DTD was found, you get <code>Nothing</code> rather than an error.
However, if a DTD is found but contains errors, the program crashes.
</p></div></div><div class="top"><p class="src"><a name="v:dtdParse-39-" class="def">dtdParse'</a> :: <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> -> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="Text-XML-HaXml-Types.html#t:DocTypeDecl">DocTypeDecl</a>)<a href="src/Text-XML-HaXml-Parse.html#dtdParse%27" class="link">Source</a></p><div class="doc"><p>To parse just a DTD, <code>dtdParse' file content</code> takes a filename
(for generating error reports) and the string content of that
file. If no DTD was found, you get <code>Right Nothing</code>.
If a DTD was found but contains errors, you get a <code>Left message</code>.
</p></div></div><h1 id="g:3">Parse a partial document
</h1><div class="top"><p class="src"><a name="v:xmlParseWith" class="def">xmlParseWith</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> a -> [(<a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>, <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a>)] -> (<a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-Either.html#t:Either">Either</a> <a href="/usr/share/doc/ghc-doc/html/libraries/base-4.5.0.0/Data-String.html#t:String">String</a> a, [(<a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>, <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a>)])<a href="src/Text-XML-HaXml-Parse.html#xmlParseWith" class="link">Source</a></p><div class="doc"><p>To parse a partial document, e.g. from an XML-based stream protocol,
where you may later want to get more document elements from the same
stream. Arguments are: a parser for the item you want, and the
already-lexed input to parse from. Returns the item you wanted
(or an error message), plus the remainder of the input.
</p></div></div><h1 id="g:4">Individual parsers for use with <em>xmlParseWith</em> and module SAX
</h1><div class="top"><p class="src"><a name="v:document" class="def">document</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> (<a href="Text-XML-HaXml-Types.html#t:Document">Document</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)<a href="src/Text-XML-HaXml-Parse.html#document" class="link">Source</a></p><div class="doc"><p>Return an entire XML document including prolog and trailing junk.
</p></div></div><div class="top"><p class="src"><a name="v:element" class="def">element</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> (<a href="Text-XML-HaXml-Types.html#t:Element">Element</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)<a href="src/Text-XML-HaXml-Parse.html#element" class="link">Source</a></p><div class="doc"><p>Return a complete element including all its inner content.
</p></div></div><div class="top"><p class="src"><a name="v:content" class="def">content</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> (<a href="Text-XML-HaXml-Types.html#t:Content">Content</a> <a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>)<a href="src/Text-XML-HaXml-Parse.html#content" class="link">Source</a></p><div class="doc"><p>Return a content particle, e.g. text, element, reference, etc
</p></div></div><div class="top"><p class="src"><a name="v:comment" class="def">comment</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:Comment">Comment</a><a href="src/Text-XML-HaXml-Parse.html#comment" class="link">Source</a></p><div class="doc"><p>Return an XML comment.
</p></div></div><div class="top"><p class="src"><a name="v:cdsect" class="def">cdsect</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:CDSect">CDSect</a><a href="src/Text-XML-HaXml-Parse.html#cdsect" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:chardata" class="def">chardata</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:CharData">CharData</a><a href="src/Text-XML-HaXml-Parse.html#chardata" class="link">Source</a></p><div class="doc"><p>Return parsed freetext (i.e. until the next markup)
</p></div></div><div class="top"><p class="src"><a name="v:reference" class="def">reference</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:Reference">Reference</a><a href="src/Text-XML-HaXml-Parse.html#reference" class="link">Source</a></p><div class="doc"><p>Return either a general entity reference, or a character reference.
</p></div></div><div class="top"><p class="src"><a name="v:doctypedecl" class="def">doctypedecl</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:DocTypeDecl">DocTypeDecl</a><a href="src/Text-XML-HaXml-Parse.html#doctypedecl" class="link">Source</a></p><div class="doc"><p>Return a DOCTYPE decl, indicating a DTD.
</p></div></div><div class="top"><p class="src"><a name="v:processinginstruction" class="def">processinginstruction</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:ProcessingInstruction">ProcessingInstruction</a><a href="src/Text-XML-HaXml-Parse.html#processinginstruction" class="link">Source</a></p><div class="doc"><p>Parse a processing instruction.
</p></div></div><div class="top"><p class="src"><a name="v:elemtag" class="def">elemtag</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:ElemTag">ElemTag</a><a href="src/Text-XML-HaXml-Parse.html#elemtag" class="link">Source</a></p><div class="doc"><p>Parse only the parts between angle brackets in an element tag.
</p></div></div><div class="top"><p class="src"><a name="v:qname" class="def">qname</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:QName">QName</a><a href="src/Text-XML-HaXml-Parse.html#qname" class="link">Source</a></p><div class="doc"><p>Return a qualified name (although the namespace qualification is not
processed here; this is merely to get the correct type).
</p></div></div><div class="top"><p class="src"><a name="v:name" class="def">name</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:Name">Name</a><a href="src/Text-XML-HaXml-Parse.html#name" class="link">Source</a></p><div class="doc"><p>Return just a name, e.g. element name, attribute name.
</p></div></div><div class="top"><p class="src"><a name="v:tok" class="def">tok</a> :: <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a> -> <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a><a href="src/Text-XML-HaXml-Parse.html#tok" class="link">Source</a></p><div class="doc"><p>Return the next token from the input only if it matches the given token.
</p></div></div><div class="top"><p class="src"><a name="v:elemOpenTag" class="def">elemOpenTag</a> :: <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="Text-XML-HaXml-Types.html#t:ElemTag">ElemTag</a><a href="src/Text-XML-HaXml-Parse.html#elemOpenTag" class="link">Source</a></p><div class="doc"><p>For use with stream parsers - returns the complete opening element tag.
</p></div></div><div class="top"><p class="src"><a name="v:elemCloseTag" class="def">elemCloseTag</a> :: <a href="Text-XML-HaXml-Types.html#t:QName">QName</a> -> <a href="Text-XML-HaXml-Parse.html#t:XParser">XParser</a> <a href="/usr/share/doc/ghc-doc/html/libraries/ghc-prim-0.2.0.0/GHC-Tuple.html#t:-40--41-">()</a><a href="src/Text-XML-HaXml-Parse.html#elemCloseTag" class="link">Source</a></p><div class="doc"><p>For use with stream parsers - accepts a closing tag, provided it
matches the given element name.
</p></div></div><div class="top"><p class="src"><a name="v:emptySTs" class="def">emptySTs</a> :: SymTabs<a href="src/Text-XML-HaXml-Parse.html#emptySTs" class="link">Source</a></p><div class="doc"><p>Some empty symbol tables for GE and PE references.
</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:XParser" class="def">XParser</a> a = <a href="/usr/share/doc/libghc-polyparse-doc/html/Text-ParserCombinators-Poly-StateParser.html#t:Parser">Parser</a> SymTabs (<a href="Text-XML-HaXml-Posn.html#t:Posn">Posn</a>, <a href="Text-XML-HaXml-Lex.html#t:TokenT">TokenT</a>) a<a href="src/Text-XML-HaXml-Parse.html#XParser" class="link">Source</a></p><div class="doc"><p>XParser is just a specialisation of the PolyState parser.
</p></div></div><h1 id="g:5">These general utility functions don't belong here
</h1><div class="top"><p class="src"><a name="v:fst3" class="def">fst3</a> :: (a, b, c) -> a<a href="src/Text-XML-HaXml-Parse.html#fst3" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:snd3" class="def">snd3</a> :: (a, b, c) -> b<a href="src/Text-XML-HaXml-Parse.html#snd3" class="link">Source</a></p></div><div class="top"><p class="src"><a name="v:thd3" class="def">thd3</a> :: (a, b, c) -> c<a href="src/Text-XML-HaXml-Parse.html#thd3" class="link">Source</a></p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.10.0</p></div></body></html>
|