Libraries.Data.Formats.DocumentTypeDefinition Documentation

The DocumentTypeDefinition class reads document type definition declarations defined within an XML document.

Example Code

use Libraries.System.File
use Libraries.Data.Formats

DocumentTypeDefinition reader //first create the reader
File dtd //then create a file
dtd:SetPath("Data.dtd") //set its path to a file we've created
reader:Read(dtd) //read the dtd 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.
GetEntityValue(text name)This action gets the entity value for the entity name passed to it.
GetExternalFileName()This action gets the external file for this document type definition.
GetHashCode()This action gets the hash code for an object.
GetRootElement()This action gets the name of the root element for this document type definition.
HasExternalFile()This action checks to see if there is an external file for this document type definition.
Read(text dtd)This action parses the given text as a document type definition
Read(Libraries.System.File file)This action gets the data from the given file and parses the document type definition in it.
SetSourceDirectory(text directory)This action sets the source directory for the document type definition.

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.

GetEntityValue(text name)

This action gets the entity value for the entity name passed to it.

Example Code

use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        MyDocumentTypeDefinition:Read("<!DOCTYPE note [<!ENTITY language "Quorum">]>")
        output MyDocumentTypeDefinition:GetEntityValue("language") // output will be Quorum

Parameters

Return

text: The value of the entity.

GetExternalFileName()

This action gets the external file for this document type definition.

Example Code

use Libraries.System.File
        use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        File dtd 
        dtd:SetPath("Data.dtd")
        MyDocumentTypeDefinition:Read(dtd)

        if MyDocumentTypeDefinition:HasExternalFile()
            output MyDocumentTypeDefinition:GetExternalFileName() // output will be "Data.dtd"
        end

Return

text: The name of the external file used durring parsing.

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.

GetRootElement()

This action gets the name of the root element for this document type definition.

Example Code

use Libraries.System.File
        use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        File dtd 
        dtd:SetPath("Data.dtd")
        MyDocumentTypeDefinition:Read(dtd)
        text value = MyDocumentTypeDefinition:GetRootElement()

Return

text: The name of the root element.

HasExternalFile()

This action checks to see if there is an external file for this document type definition.

Example Code

use Libraries.System.File
        use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        File dtd 
        dtd:SetPath("Data.dtd")
        MyDocumentTypeDefinition:Read(dtd)
        boolean value = MyDocumentTypeDefinition:HasExternalFile() // value will be true

Return

boolean: True if an external file was used when parsing the document type definition, false otherwise.

Read(text dtd)

This action parses the given text as a document type definition

Example Code

use Libraries.System.File
        use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        MyDocumentTypeDefinition:Read("<!DOCTYPE note [<!ENTITY language "Quorum">]>")

Parameters

Read(Libraries.System.File file)

This action gets the data from the given file and parses the document type definition in it.

Example Code

use Libraries.System.File
        use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        File dtd 
        dtd:SetPath("Data.dtd")
        MyDocumentTypeDefinition:Read(dtd)

Parameters

SetSourceDirectory(text directory)

This action sets the source directory for the document type definition. If the DTD uses external sources, they need to be in this directory.

Example Code

use Libraries.Data.Formats
        
        DocumentTypeDefinition MyDocumentTypeDefinition
        MyDocumentTypeDefinition:SetSourceDirectory("C:\")
        MyDocumentTypeDefinition:Read("<!DOCTYPE note SYSTEM "note.dtd">")

Parameters