Source Edit

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

Imports

streams, parsexml, strtabs, xmltree, os

Types

  1. XmlError = object of ValueError
  2. errors*: seq[string] ## All detected parsing errors.

Exception that is raised for invalid XML. Source Edit

Procs

  1. proc loadXml(path: string; errors: var seq[string];
  2. options: set[XmlParseOption] = {reportComments}): XmlNode {.
  3. ...raises: [IOError, OSError, ValueError, Exception],
  4. tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}

Loads and parses XML from file specified by path, and returns a XmlNode. Every occurred parsing error is added to the errors sequence. Source Edit

  1. proc loadXml(path: string; options: set[XmlParseOption] = {reportComments}): XmlNode {.
  2. ...raises: [IOError, OSError, ValueError, Exception, XmlError],
  3. tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}

Loads and parses XML from file specified by path, and returns a XmlNode. All parsing errors are turned into an XmlError exception. Source Edit

  1. proc parseXml(s: Stream; filename: string; errors: var seq[string];
  2. options: set[XmlParseOption] = {reportComments}): XmlNode {.
  3. ...raises: [IOError, OSError, ValueError, Exception],
  4. tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}

Parses the XML from stream s and returns a XmlNode. Every occurred parsing error is added to the errors sequence. Source Edit

  1. proc parseXml(s: Stream; options: set[XmlParseOption] = {reportComments}): XmlNode {.
  2. ...raises: [IOError, OSError, ValueError, Exception, XmlError],
  3. tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}

Parses the XML from stream s and returns a XmlNode. All parsing errors are turned into an XmlError exception. Source Edit

  1. proc parseXml(str: string; options: set[XmlParseOption] = {reportComments}): XmlNode {.
  2. ...raises: [IOError, OSError, ValueError, Exception, XmlError],
  3. tags: [ReadIOEffect, RootEffect, WriteIOEffect], forbids: [].}

Parses the XML from string str and returns a XmlNode. All parsing errors are turned into an XmlError exception. Source Edit