Adds the specified node as the documentElement. |
Signature: appendChild(&$child) |
Parameters:
DOMIT_Node child - The node that is to be appended as documentElement. Only a single node can serve as documentElement, so an existing documentElement node will be overwritten.
|
Returns:
DOMIT_Node - The appended documentElement node.
|
Example:
The documentElement of a tree is assigned using appendChild: $mydoc->appendChild($elementNode); |
Creates a new instance of a DOMIT_Element. |
Signature: createElement($name) |
Parameters:
String name - The tagName of the DOMIT_Element to be created.
|
Returns:
DOMIT_Element - The newly created DOMIT_Element.
|
Example:
A new DOMIT_Element can be created in the following manner: $myBook = $xmldoc->createElement("book"); |
Creates a new instance of a DOMIT_TextNode. |
Signature: createTextNode($text) |
Parameters:
String text - The text of the DOMIT_TextNode to be created.
|
Returns:
DOMIT_TextNode - The newly created DOMIT_TextNode.
|
Example:
A new DOMIT_TextNode can be created in the following manner: $myBookCritique = $xmldoc->createTextNode("A really good read."); |
Creates a new instance of a DOMIT_CDATASection. |
Signature: createCDATASection($text) |
Parameters:
String text - The text of the DOMIT_CDATASection to be created.
|
Returns:
DOMIT_CDATASection - The newly created DOMIT_CDATASection.
|
Example:
A new DOMIT_CDataSection can be created in the following manner: $curseWord = $xmldoc->createCDATASection("&*^%$#@"); |
Generates an array of DOMIT_Elements with the specified $tagName that are present in the document. |
Signature: &getElementsByTagName($tagName) |
Parameters:
String tagName - The tag name of the DOMIT_Elements to be searched for.
|
Returns:
array - The array of found DOMIT_Elements.
|
Example:
Here, all elements named "poem" that fall under the $poems node are returned in an array: $poems =& $library->getElementsByTagName("poem"); |
Parses the xml string provided into a hierarchy of DOMIT_Nodes under the current DOMIT_Document. Either the Expat extension or the included SAXY_Parser class can be specified to perform the parsing. |
Signature: parseXML($xmlText, $useSAXY = false) |
Parameters:
String xmlText - The xml text to be parsed.
boolean useSAXY - false (or omitted) if the Expat parser is to be used, true if SAXY is used. Note that since SAXY is not a C extension as is Expat, there is no question as to its availability. It is also slightly faster than Expat, although possibly not as robust.
|
Example:
The xml string will be parsed using the SAXY parser: $xmldoc->parseXML("<book><title>Using DOMIT!</title><author>John Heinstein</author></book>", true); |
Generates an unformatted (single line, no whitespace) string representation of the document and all children. |
Signature: toString() |
Returns:
String - An unformatted (single line, no whitespace) string representation of the document and all children.
|
Example:
An unformatted string representation of the xml document will be printed here: echo (htmlentities($myDoc->toString()); |