W3cubDocs

/Nim

Module xmlparser

This module parses an XML document and creates its XML tree representation.

Imports

streams, parsexml, strtabs, xmltree, os

Types

XmlError = object of ValueError
  errors*: seq[string]         ## all detected parsing errors
exception that is raised for invalid XML

Procs

proc parseXml(s: Stream; filename: string; errors: var seq[string]): XmlNode {.
    raises: [Exception, ValueError], tags: [ReadIOEffect, RootEffect].}
parses the XML from stream s and returns a PXmlNode. Every occurred parsing error is added to the errors sequence.
proc parseXml(s: Stream): XmlNode {.raises: [Exception, ValueError, XmlError],
                                tags: [ReadIOEffect, RootEffect].}
parses the XTML from stream s and returns a PXmlNode. All parsing errors are turned into an EInvalidXML exception.
proc loadXml(path: string; errors: var seq[string]): XmlNode {.
    raises: [IOError, Exception, ValueError], tags: [ReadIOEffect, RootEffect].}
Loads and parses XML from file specified by path, and returns a PXmlNode. Every occurred parsing error is added to the errors sequence.
proc loadXml(path: string): XmlNode {.raises: [IOError, Exception, ValueError, XmlError],
                                  tags: [ReadIOEffect, RootEffect].}
Loads and parses XML from file specified by path, and returns a PXmlNode. All parsing errors are turned into an EInvalidXML exception.

© 2006–2017 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/xmlparser.html