Low-level class for creating parsers for url=https://en.wikipedia.org/wiki/XMLXML/url files.
    public class XMLParser : Reference

This class can serve as base to make custom XML parsers. Since XML is a very flexible standard, this interface is low-level so it can be applied to any possible schema.

Inheritance Chain

Constructors

    public XMLParser()

Methods

    public int GetAttributeCount()

Gets the amount of attributes in the current element.

    public string GetAttributeName(int idx)

Gets the name of the attribute specified by the index in idx argument.

    public string GetAttributeValue(int idx)

Gets the value of the attribute specified by the index in idx argument.

    public int GetCurrentLine()

Gets the current line in the parsed file (currently not implemented).

    public string GetNamedAttributeValue(string name)

Gets the value of a certain attribute of the current element by name. This will raise an error if the element has no such attribute.

    public string GetNamedAttributeValueSafe(string name)

Gets the value of a certain attribute of the current element by name. This will return an empty String if the attribute is not found.

    public string GetNodeData()

Gets the contents of a text node. This will raise an error in any other type of node.

    public string GetNodeName()

Gets the name of the current element node. This will raise an error if the current node type is neither [constant NODE_ELEMENT] nor [constant NODE_ELEMENT_END].

    public ulong GetNodeOffset()

    public NodeType GetNodeType()

Gets the type of the current node. Compare with NODE_* constants.

    public bool HasAttribute(string name)

Check whether the current element has a certain attribute.

    public bool IsEmpty()

Check whether the current element is empty (this only works for completely empty tags, e.g. <element \>).

    public Error Open(string file)

Opens an XML file for parsing. This returns an error code.

    public Error OpenBuffer(byte[] buffer)

Opens an XML raw buffer for parsing. This returns an error code.

    public Error Read()

Reads the next node of the file. This returns an error code.

    public Error Seek(ulong position)

    public void SkipSection()

Skips the current section. If the node contains other elements, they will be ignored and the cursor will go to the closing of the current element.

Inner Types

NodeType

Name Value Description
None 0 There’s no node (no file or buffer opened)
Element 1 Element (tag)
ElementEnd 2 End of element
Text 3 Text node
Comment 4 Comment node
Cdata 5 CDATA content
Unknown 6 Unknown node
Tags: