Class DOMIT_Parser
Invokes a SAX parser to parse XML text, catches the SAX events, and builds the DOMIT_Document. Called by DOMIT_Document.

isPublic? no
isAbstract? no

Inheritance tree:

DOMIT_Parser (top level class)

Known subclasses:

None

Source file: xml_domit_parser.php

Includes: xml_saxy_parser.php




Constructor
Default constructor.

Signature: DOMIT_Parser()

isPublic? no




Public Constants



Private Constants



Public Fields



Private Fields
xmlDoc
A reference to DOMIT_Document into which the xml is to be parsed.

Type: DOMIT_Document

currentNode
A reference to the node currently being parsed and appended by the parsing engine.

Type: DOMIT_Node

lastChild
A reference to the last child node that was appended by the parsing engine.

Type: DOMIT_Node

inCDATASection
True if Expat is parsing a CDATASection node.

Type: boolean

inTextNode
True if Expat is parsing a TextNode.

Type: boolean

preserveCDATA
True if CDATASection nodes are to be preserved, false if they are to be converted into TextNodes.

Type: boolean

parseContainer
Temporary container for storing strings that are built across a series of SAX events.

Type: String

parseItem
Specifies the current target of the parseContainer (e.g. "doctype"). An empty string if no target is current.

Type: String

namespaceURIMap
An array of namespacesURIs mapped to prefixes.

Type: array




Public Methods



Private Methods
parse
Invokes the Expat parser and parses the specified $xmlText into $myXMLDoc.

Signature: parse (& $myXMLDoc, $xmlText, $preserveCDATA = true)

Parameters:

DOMIT_Document myXMLDoc - The DOMIT_Document to be populated.

String xmlText - The xml string to be parsed.

boolean preserveCDATA - True if CDATASection tags are to be preserved, false if they are to be converted to Text nodes.

Returns:

boolean - True if the text is valid XML, false if invalid.

parseSAXY
Invokes the SAXY parser and parses the specified $xmlText into $myXMLDoc.

Signature: parseSAXY(& $myXMLDoc, $xmlText, $preserveCDATA)

Parameters:

DOMIT_Document myXMLDoc - The DOMIT_Document to be populated.

String xmlText - The xml string to be parsed.

boolean preserveCDATA - True if CDATASection tags are to be preserved, false if they are to be converted to Text nodes.

Returns:

boolean - True if the text is valid XML, false if invalid.

dumpTextNode
Generates and appends a new text node from the parseContainer text.

Signature: dumpTextNode()

startElement
Captures the tag name and attributes of an xml element, then builds the element and appends it to the current DOMIT_Document.

Signature: startElement(&$parser, $name, $attrs)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String name - The name of the current element tag.

array attributes - An associative array containing the names / values of the element's attributes.

startElementNS
Catches a start element event (namespace aware) and processes the data.

Signature: startElementNS(&$parser, $name, $attrs)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String name - The name of the current element tag.

array attributes - An associative array containing the names / values of the element's attributes.

endElement
Captures the end element event.

Signature: endElement(&$parser, $name)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String name - The name of the current element tag.

dataElement
Captures the text data from TextNodes (and CDATASection nodes, if requested) and builds these nodes and adds them to the DOMIT_Document.

Signature: dataElement(&$parser, $data)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String data - The textual data of the node.

cdataElement
Captures the text data from CDATASection node, builds these nodes, and adds them to the DOMIT_Document.

Signature: cdataElement(&$parser, $data)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String data - The textual data of the node.

defaultDataElement
For Expat parsing, captures any xml data that is not explicitly trapped for (such as CDATASection tags).

Signature: defaultDataElement(&$parser, $data)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String data - The textual data of the node.

doctypeElement
Captures the text data from the doctype (if one exists) and adds it to the DOMIT_Document (not present in DOMIT! Lite).

Signature: doctypeElement(&$parser, $data)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String data - The textual data of the doctype node.

commentElement
Captures the comment text from comment nodes, builds these nodes, and adds them to the DOMIT_Document (not present in DOMIT! Lite).

Signature: commentElement(&$parser, $data)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String data - The textual data of the comment node.

processingInstructionElement
Captures the text of the target and data for the processing instruction node, builds these nodes, and adds them to the DOMIT_Document (not present in DOMIT! Lite).

Signature: processingInstructionElement(&$parser, $target, $data)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String target - The target of the node.

String data - The textual data of the node.

startNamespaceDeclaration
Catches a start namespace declaration event and processes the data.

Signature: startNamespaceDeclaration(&$parser, $prefix, $uri)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String prefix - The prefix of the current namespace.

String uri - The uri of the current namespace.

endNamespaceDeclaration
Catches an end namespace declaration event.

Signature: endNamespaceDeclaration(&$parser, $prefix)

Parameters:

Object parser - The instance of the XML parser doing the parsing.

String prefix - The prefix of the current namespace.


Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.