Libraries.Data.Formats.ExtensibleMarkupReader Documentation
The ExtensibleMarkupReader class reads in data files in what is known as the Extensible Markup Language (XML). This language is a standard format designed for processing a wide variety of types of data. There are different kinds of XML readers, predominately known as DOM (Document Object Model) and SAX (Simple API for XML). This library works like SAX, which means that users of this library must pass an object that will receive messages about the parse as it occurs.
Example Code
use Libraries.System.File
use Libraries.Data.Formats.ExtensibleMarkup
ExtensibleMarkupReader reader //first create the reader
File xml //then create a file
xml:SetPath("Data.xml") //set its path to a file we've created
reader:Read(xml) //read the xml file
Inherits from: Libraries.Language.Object
Summary
Actions Summary Table
Actions | Description |
---|---|
Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |
Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |
GetHashCode() | This action gets the hash code for an object. |
GetMarkupListener() | This action gets the markup listener used durring parsing. |
Read(Libraries.System.File file) | This action gets the data from the given file and parses the it as an XML document. |
Read(text xml) | This action parses the given text as an XML document |
SetMarkupListener(Libraries.Data.Formats.MarkupListener listener) | This action sets the markup listener to be used durring parsing. |
Actions Documentation
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Example Code
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Example Code
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
GetHashCode()
This action gets the hash code for an object.
Example Code
Object o
integer hash = o:GetHashCode()
Return
integer: The integer hash code of the object.
GetMarkupListener()
This action gets the markup listener used durring parsing.
Example Code
use Libraries.Data.Formats.ExtensibleMarkup
class main
action main
ExtensibleMarkupReader reader
MyMarkupListenerClass myListener
reader:SetMarkupListener(myListener)
MarkupListener listenter = reader:GetMarkupListener()
end
end
class MyMarkupListenerClass is MarkupListener
action StartElement(Element element)
end
action Value(text value)
end
action EndElement(Element element)
end
end
Return
Libraries.Data.Formats.MarkupListener: The MarkupListener used durring parsing.
Read(Libraries.System.File file)
This action gets the data from the given file and parses the it as an XML document.
Example Code
use Libraries.System.File
use Libraries.Data.Formats.ExtensibleMarkup
ExtensibleMarkupReader reader
//This file should be in the same folder as the executable for this script.
File xml
xml:SetPath("Data.xml")
reader:Read(xml)
Parameters
Read(text xml)
This action parses the given text as an XML document
Example Code
use Libraries.System.File
use Libraries.Data.Formats.ExtensibleMarkup
DocumentTypeDefinition MyDocumentTypeDefinition
MyDocumentTypeDefinition:Read("<root></root>")
Parameters
- text xml: The text representing the XML to be parsed.
SetMarkupListener(Libraries.Data.Formats.MarkupListener listener)
This action sets the markup listener to be used durring parsing.
Example Code
use Libraries.Data.Formats.ExtensibleMarkup
class main
action main
ExtensibleMarkupReader reader
MyMarkupListenerClass myListener
reader:SetMarkupListener(myListener)
end
end
class MyMarkupListenerClass is MarkupListener
action StartElement(Element element)
end
action Value(text value)
end
action EndElement(Element element)
end
end