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

ActionsDescription
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
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 a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: 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

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

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

Parameters