The DOMParser Package provides an interface to the Document Object Model (DOM) XML parser. The DOM parser provides the ability to validate an XML document according to a Document Type Definition (DTD), to validate for well-formedness, support for namespaces. A set of methods configure various options for parsing and the ability to retrieve the DOMDocument node that represents the root node of the document.


Class Attributes Index

 o INDEX_SIZE_ERR
If index or size is negative, or greater than the allowed value
 o DOMSTRING_SIZE_ERR
If the specified range of text does not fit into a DOMString
 o HIERARCHY_REQUEST_ERR
If any node is inserted somewhere it doesn't belong
 o WRONG_DOCUMENT_ERR
If a node is used in a different document than the one that created it (that doesn't support it)
 o INVALID_CHARACTER_ERR
If an invalid character is specified, such as in a name
 o NO_DATA_ALLOWED_ERR
If data is specified for a node which does not support data
 o NO_MODIFICATION_ALLOWED_ERR
If an attempt is made to modify an object where modifications are not allowed
 o NOT_FOUND_ERR
If an attempt was made to reference a node in a context where it does not exist
 o NOT_SUPPORTED_ERR
If the implementation does not support the type of object requested
 o INUSE_ATTRIBUTE_ERR
If an attempt is made to add an attribute that is already inuse elsewhere
 o INVALID_STATE_ERR
Introduced in DOM Level 2. If an attempt is made to use an object that is not, or no longer, usable
 o SYNTAX_ERR
Introduced in DOM Level 2. If an invalid or illegal string is specified.
 o INVALID_MODIFICATION_ERR
Introduced in DOM Level 2. If an attempt is made to modify the type of the underlying object.
 o NAMESPACE_ERR
Introduced in DOM Level 2. If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
 o INVALID_ACCESS_ERR
Introduced in DOM Level 2. If a parameter or an operation is not supported by the underlying object.
 o UNKNOWN_EXCEPTION
Exception thrown that does not correspond to any of the known DOM exceptions.
 o Message
Informational status or message.
 o Warning
Warning message.
 o Error
Recoverable error.
 o FatalError
Error that will stop processing.
 o Val_Never
Validation scheme - never validate.
 o Val_Always
Validation scheme - always validate.
 o Val_Auto
Validation scheme - automatically validate (default).

Class Methods Index

 o New()
Create a new DOMParser instance.

Instance Methods Index

 o Parse( String xmlFile )
Parse an XML file into a DOM representation.
 o ParseBytes( Bytes xmlData )
Parse an XML bytes array into a DOM representation.
 o GetDocument()
Retrieves the Document node of the parsed document.
 o GetErrorCount()
Retrieves the error count for the parsed document.
 o SetDoValidation( Boolean arg1 )
Determines whether the XML document should be validated against the Document Type Definition (DTD).
 o GetDoNamespaces( )
Return whether support for XML Namespaces should be enabled.
 o SetDoNamespaces( Boolean arg1 )
Determines whether support for XML Namespaces should be enabled.
 o SetExpandEntityReferences( Boolean arg1 )
Determines whether Entities should be expanded when parsed.
 o SetEntityResolver( Dynamic objref, Dynamic entryName )
Sets the object reference and entry point name for the resolve entity reference callback.
 o GetExitOnFirstFatalError( )
Return whether parsing should exit with the first fatal error.
 o SetExitOnFirstFatalError( Boolean arg1 )
Determines whether parsing should exit with the first fatal error.
 o GetValidationConstraintFatal( )
Return whether the parser will treat a validation constraint error as a fatal error.
 o SetValidationConstraintFatal( Boolean arg1 )
Determines whether the parser will treat a validation constraint error as a fatal error.
 o GetCreateEntityReferenceNodes( )
Return whether the parser will create entity reference nodes.
 o SetCreateEntityReferenceNodes( Boolean arg1 )
Determines whether the parser will create entity reference nodes.
 o GetIncludeIgnorableWhitespace( )
Return whether the parser should include ignorable whitespace.
 o SetIncludeIgnorableWhitespace( Boolean arg1 )
Determines whether the parser should include ignorable whitespace.
 o GetValidationScheme( )
Return the parser validation scheme.
 o SetValidationScheme( Integer arg1 )
Determines the parser validation scheme.
 o GetDoSchema( )
Return whether the parser will process schema.
 o SetDoSchema( Boolean arg1 )
Determines whether the parser will process schema.
 o GetValidationSchemaFullChecking( )
Return whether the parser will perform full schema validation.
 o SetValidationSchemaFullChecking( Boolean arg1 )
Determines whether the parser will perform full schema validation.
 o GetExternalSchemaLocation( )
Return the location for external schema.
 o SetExternalSchemaLocation( String arg1 )
Provide the location for external schema.
 o GetExternalNoNamespaceSchemaLocation( )
Return the location for external no namespace schema.
 o SetExternalNoNamespaceSchemaLocation( String arg1 )
Provide the location for external no namespace schema.
 o GetLoadExternalDTD( )
Return whether the parser will try and load external DTD.
 o SetLoadExternalDTD( Boolean arg1 )
Determines whether the parser will try and load external DTD.
 o GetCreateCommentNodes( )
Return whether the parser will create comment nodes.
 o SetCreateCommentNodes( Boolean arg1 )
Determines whether the parser will create comment nodes.

Class Attributes

 o INDEX_SIZE_ERR
 Integer INDEX_SIZE_ERR

If index or size is negative, or greater than the allowed value

 o DOMSTRING_SIZE_ERR
 Integer DOMSTRING_SIZE_ERR

If the specified range of text does not fit into a DOMString

 o HIERARCHY_REQUEST_ERR
 Integer HIERARCHY_REQUEST_ERR

If any node is inserted somewhere it doesn't belong

 o WRONG_DOCUMENT_ERR
 Integer WRONG_DOCUMENT_ERR

If a node is used in a different document than the one that created it (that doesn't support it)

 o INVALID_CHARACTER_ERR
 Integer INVALID_CHARACTER_ERR

If an invalid character is specified, such as in a name

 o NO_DATA_ALLOWED_ERR
 Integer NO_DATA_ALLOWED_ERR

If data is specified for a node which does not support data

 o NO_MODIFICATION_ALLOWED_ERR
 Integer NO_MODIFICATION_ALLOWED_ERR

If an attempt is made to modify an object where modifications are not allowed

 o NOT_FOUND_ERR
 Integer NOT_FOUND_ERR

If an attempt was made to reference a node in a context where it does not exist

 o NOT_SUPPORTED_ERR
 Integer NOT_SUPPORTED_ERR

If the implementation does not support the type of object requested

 o INUSE_ATTRIBUTE_ERR
 Integer INUSE_ATTRIBUTE_ERR

If an attempt is made to add an attribute that is already inuse elsewhere

 o INVALID_STATE_ERR
 Integer INVALID_STATE_ERR

Introduced in DOM Level 2. If an attempt is made to use an object that is not, or no longer, usable

 o SYNTAX_ERR
 Integer SYNTAX_ERR

Introduced in DOM Level 2. If an invalid or illegal string is specified.

 o INVALID_MODIFICATION_ERR
 Integer INVALID_MODIFICATION_ERR

Introduced in DOM Level 2. If an attempt is made to modify the type of the underlying object.

 o NAMESPACE_ERR
 Integer NAMESPACE_ERR

Introduced in DOM Level 2. If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

 o INVALID_ACCESS_ERR
 Integer INVALID_ACCESS_ERR

Introduced in DOM Level 2. If a parameter or an operation is not supported by the underlying object.

 o UNKNOWN_EXCEPTION
 Integer UNKNOWN_EXCEPTION

Exception thrown that does not correspond to any of the known DOM exceptions.

 o Message
 Integer Message

Informational status or message.

 o Warning
 Integer Warning

Warning message.

 o Error
 Integer Error

Recoverable error.

 o FatalError
 Integer FatalError

Error that will stop processing.

 o Val_Never
 Integer Val_Never

Validation scheme - never validate. See SetValidationScheme.

 o Val_Always
 Integer Val_Always

Validation scheme - always validate. See SetValidationScheme.

 o Val_Auto
 Integer Val_Auto

Validation scheme - automatically validate (default). See SetValidationScheme.

Class Methods

 o New
 DOMParser New()

Create a new DOMParser instance.

Returns:
A new DOMParser.

Instance Methods

 o Parse
 Assoc Parse(
          String xmlFile )

Parse an XML file into a DOM representation.

Parameters:
xmlFile  -  XML file to be parsed.
Returns:
An Assoc that contains:
Boolean   OK  -  Status of the parse.
RecArray   Error  -  Errors that occurred during parsing.
 
If the status of the parse is false, then the error RecArray contains:
String   ErrType  -  The type of error: warning, error or fatal.
String   ErrMsg  -  Parser generated error message.
String   PublicID  -  Public Identifier of the XML file, filename in this instance.
String   SystemId  -  System Identifier of the XML file, usually empty.
Integer   LineNumber  -  Line number in the file in which the error occurred.
Integer   ColumnNumber  -  Column number in the file in which the error occurred.
 
 
 o ParseBytes
 Assoc ParseBytes(
          Bytes xmlData )

Parse an XML bytes array into a DOM representation.

Parameters:
xmlData  -  XML bytes array to be parsed.
Returns:
An Assoc that contains:
Boolean   OK  -  Status of the parse.
RecArray   Error  -  Errors that occurred during parsing.
 
If the status of the parse is false, then the error RecArray contains information like that described in the Parse instance method.
 
 
 o GetDocument
 DOMDocument GetDocument()

Retrieves the Document node of the parsed document.

Returns:
The Document node.
 o GetErrorCount
 Integer GetErrorCount()

Retrieves the number of parse errors associated with the parsed document.

Returns:
An Integer of the number of errors.
 o SetDoValidation
 Void SetDoValidation(
              Boolean newState )

Determines whether the XML document should be validated against the Document Type Definition (DTD). This method has been DEPRECATED and is replaced with SetValidationScheme

Parameters:
newState  -  TRUE if the XML document should be validated against the DTD.
 
 o GetDoNamespaces
 Boolean GetDoNamespaces()

Returns whether parser support for XML Namespaces is enabled.

Returns:
Returns TRUE if parser support for XML Namespaces is enabled, FALSE otherwise.
 o SetDoNamespaces
 Void SetDoNamespaces(
              Boolean newState )

Determines whether support for XML Namespaces should be enabled.

Parameters:
newState  -  TRUE if namespaces should be enabled.
 
 o SetExpandEntityReferences
 Void SetExpandEntityReferences(
                   Boolean newState )

Determines whether Entities should be expanded when parsed. This method has been DEPRECATED, and is replaced with SetCreateEntityReferenceNodes

Parameters:
newState  -  TRUE if entities should be expanded when parsed.
 
 o SetEntityResolver
 Void SetEntityResolver(
             Dynamic objref,
             Dynamic entryName )

Sets the object reference and entry point name for the resolve entity callback.

The callback script prototype is:

String ResolveEntity(  String publicID,  String systemID )

The return value is a string to the resolved entity. An undefined return value indicates to the parser that it should use its default internal entity resolution.

Parameters:
objref  -  The reference to the object that has the script to be used in the callback.
entryName  -  The script name of the callback that will be executed on callback.
 
 o GetExitOnFirstFatalError
 Boolean GetExitOnFirstFatalError()

Returns whether parsing should exit with the first fatal error.

Returns:
Returns TRUE if parser should exit parsing when it encounters the the first fatal error, FALSE otherwise.
 o SetExitOnFirstFatalError
 Void SetExitOnFirstFatalError(
                   Boolean newState )

Determines whether parsing should exit with the first fatal error.

Parameters:
newState  -  TRUE if parsing should exit with the first fatal error.
 
 o GetValidationConstraintFatal
 Boolean GetValidationConstraintFatal()

Returns whether the parser will consider validation constraint errors as fatal.

Returns:
Returns TRUE, if the parser is currently configured to consider validation constraint errors as fatal, FALSE otherwise.
 o SetValidationConstraintFatal
 Void SetValidationConstraintFatal(
                   Boolean newState )

Determines whether the parser should consider validation constraint errors as fatal errors.

Parameters:
newState  -  TRUE, if the parser should consider validation constraint errors as fatal errors, FALSE otherwise.
 
 o GetCreateEntityReferenceNodes
 Boolean GetCreateEntityReferenceNodes()

Returns whether the parser will expand/create entity references when parsed.

Returns:
Returns TRUE, if the parser will expand/create entities, FALSE otherwise.
 o SetCreateEntityReferenceNodes
 Void SetCreateEntityReferenceNodes(
                   Boolean newState )

Determines whether the parser should expand/create entity references.

Parameters:
newState  -  TRUE, if the parser should expand/create entity references, FALSE otherwise.
 
 o GetIncludeIgnorableWhitespace
 Boolean GetIncludeIgnorableWhitespace()

Returns whether parsed text nodes that can be considered ignorable whitespace are included in the DOM tree.

Returns:
Returns TRUE, if the parser will create text nodes for ignorable whitespace, FALSE otherwise.
 o SetIncludeIgnorableWhitespace
 Void SetIncludeIgnorableWhitespace(
                   Boolean newState )

Determines whether the parser will create text nodes for ignorable whitespace.

Parameters:
newState  -  TRUE, if the parser will create text nodes for ignorable whitespace, FALSE otherwise.
 
 o GetValidationScheme
 Integer GetValidationScheme()

Returns the parser validation scheme.

Returns:
Returns an Integer with one of the defined constant values: Val_Never or Val_Always or Val_Auto.
 o SetValidationScheme
 Void SetValidationScheme(
                   Integer scheme )

Determines parser validation scheme.

Parameters:
scheme  - 

Val_Never The parser does not report validation errors.

Val_Always The parser will always report validation errors.

Val_Auto The parser will report validation errors only if a grammar is specified.

 
 o GetDoSchema
 Boolean GetDoSchema()

Returns whether the parser's schema support is enabled.

Returns:
Returns TRUE, if the parser's schema support is enabled, FALSE otherwise.
 o SetDoSchema
 Void SetDoSchema(
                   Boolean newState )

Determines whether the parser's schema support is enabled.

Parameters:
newState  -  TRUE, to enable the parser's schema support. FALSE, to disable the parser's schema support.
 
 o GetValidationSchemaFullChecking
 Boolean GetValidationSchemaFullChecking()

Returns whether the parser will perform full schema constraint checking.

Returns:
Returns TRUE, if the parser will perform full schema constraint checking, FALSE otherwise.
 o SetValidationSchemaFullChecking
 Void SetValidationSchemaFullChecking(
                   Boolean newState )

Determines whether the parser will perform checks on the schema grammar itself for additional errors. These additional checks could be time-consuming or memory intensive. The default is FALSE.

Parameters:
newState  - 

TRUE, enable full schema constraint checking.

FALSE, disable full schema constraint checking.

 
 o GetExternalSchemaLocation
 String GetExternalSchemaLocation()

Returns the previously specified list of schemas to use.

Returns:
Returns a string containing the list of schemas to use that was previously set with SetExternalSchemaLocation.
 o SetExternalSchemaLocation
 Void SetExternalSchemaLocation(
                   String schemaList )

Set a list of schemas to use. The targetNamespace of a schema specified in this list will override the internal schema location in the instance document for both the schemaLocation attribute, or the "import" element.

Parameters:
schemaList  - 

The syntax is the same as for schemaLocation attributes in an instance document: e.g, "http://www.schemas.com sample.xsd". The user can specify more than one XML schema in the list.

 
 o GetExternalNoNamespaceSchemaLocation
 String GetExternalNoNamespaceSchemaLocation()

Returns the previously specified no target namespace XML schema location.

Returns:
Returns a string containing the no target namespace XML schema location that was previously set with SetExternalNoNamespaceSchemaLocation.
 o SetExternalSchemaLocation
 Void SetExternalSchemaLocation(
                   String location )

Provide the no target namespace XML schema location.

Parameters:
location  - 

The syntax is the same as for the noNamespaceSchemaLocation attribute in an instance document: e.g, "sample.xsd".

 
 o GetLoadExternalDTD
 Boolean GetLoadExternalDTD()

Returns whether the parser will load external DTD when the validation scheme is Val_Never.

Returns:
Returns TRUE, if the loading of external DTD is enabled, FALSE otherwise.
 o SetLoadExternalDTD
 Void SetLoadExternalDTD(
                   Boolean newState )

Determines whether the parser will load external DTD when the validation scheme is Val_Never. This flag is ignored if the validation scheme is set (see SetValidationScheme) to Val_Always or Val_Auto.

Parameters:
newState  -  FALSE, parser will ignore any external DTD completely when the validation scheme is Val_Never. TRUE, otherwise (default).
 
 o GetCreateCommentNodes
 Boolean GetCreateCommentNodes()

Returns whether the parser will create comment nodes in the DOM tree.

Returns:
Returns TRUE, the parser will create comment nodes in the DOM tree, FALSE otherwise.
 o SetCreateCommentNodes
 Void SetCreateCommentNodes(
                   Boolean newState )

Determines whether the parser will create comment nodes in the DOM tree.

Parameters:
newState  -  TRUE, enables the creation of comment nodes in the DOM tree.

FALSE, disables the creation of comment nodes in the DOM tree.