Class DOMIT_DocumentFragment
A class representing the DOM DocumentFragment node (not present in DOMIT! Lite).

isPublic? yes
isAbstract? no

Inheritance tree:


DOMIT_Node
|
DOMIT_ChildNodes_Interface
|
DOMIT_DocumentFragment

Known subclasses:

None

Source file: xml_domit_parser.php




Constructor
Initializes DOMIT_DocumentFragment variables and those of the superclass.

Signature: &DOMIT_DocumentFragment()

isPublic? no




Public Constants



Private Constants



Public Fields
nodeName
The name of the current node. For DOMIT_DocumentFragment, nodeName is #document-fragment.

Type: String

nodeValue
The value of the current node. For DOMIT_DocumentFragment, this is null.

Type: String

nodeType
An integer representing the type of the current node. For DOMIT_DocumentFragment, nodeType is 11.

Type: int

parentNode
A reference to the node of which the current node is a child.

Type: DOMIT_Node

ownerDocument
A reference to the DOMIT_Document.

Type: DOMIT_Document




Private Fields
uid
A unique id assigned to each node. Note that this id is non-persistent.

Type: int




Public Methods
insertBefore
Inserts node $newChild before $refChild in the childNodes of $this. If $refChild does not exist, $newChild is appended to the node chain.

Signature: &insertBefore(&$newChild, &$refChild)

Parameters:

DOMIT_Node newChild - The new node to be added

DOMIT_Node refChild - The existing node before which the new node will be added

Returns:

DOMIT_Node - A reference to the new node being added.

Example:

The following example inserts a "Book" node named $goodNovel before another named $okNovel in a DocumentFragment node named $booksFrag.

$booksFrag->insertBefore($goodNovel, $okNovel);

replaceChild
Replaces node $oldChild with $newChild.

Signature: replaceChild(&$newChild, &$oldChild)

Parameters:

DOMIT_Node newChild - The new node that is to replace the old node.

DOMIT_Node oldChild - The old node that is to be replaced by the new node.

Returns:

DOMIT_Node - The new node $newChild, or false if $oldChild does not exist.

Example:

An old $userProfile node is replaced by a new node:

$userProfileFrag->replaceChild($newProfile, $oldProfile);

removeChild
Removes the specified node from the document.

Signature: &removeChild(&$oldChild)

Parameters:

DOMIT_Node oldChild - The node that is to be removed.

Returns:

DOMIT_Node - The deleted node $oldChild, or false if $oldChild does not exist.

Example:

Node $unpopularNovel is removed from the $bestSellers parent node.

$bestSellers->removeNode($unpopularNovel);

appendChild
Appends the specified node to the childNodes list.

Signature: appendChild(&$child)

Parameters:

DOMIT_Node child - The node that is to be appended.

Returns:

DOMIT_Node - The appended node.

Example:

A new node, $brocolli, is appended to $myGroceryListFrag.

$myGroceryListFrag->appendChild($brocolli);

hasChildNodes
Determines whether a node has any children.

Signature: hasChildNodes()

Returns:

boolean - True if the node has children, false if not.

Example:

The following example checks the $cookieJar node to see if it has any children (cookies!).

$isCookieJarEmpty = $cookieJar->hasChildNodes();

cloneNode
Returns a copy of the specified node, and if $deep is set to true, all nodes below it in the hierarchy.

Signature: &cloneNode($deep)

Parameters:

boolean deep - True if the children below the cloned node are also to be cloned.

Returns:

DOMIT_Node - The cloned node, with a clone of all subnodes if $deep is set to true.

Example:

In the following example, a node named $styleTemplate is cloned, presumably so the user can create a new style based on the characteristics of the original node.

$newStyle =& styleTemplate->cloneNode(false);

toString
Generates an unformatted (single line, no whitespace) string representation of the comment.

Signature: toString($htmlSafe = false, $subEntities = false)

Parameters:

boolean htmlSafe - If true, returns an html formatted representation of the string.

boolean subEntities - True if illegal xml characters should be converted to entities.

Returns:

String - A string representation of the comment.




Private Methods
toArray
Returns an array representation of the Document Fragment.

Signature: toArray()

Returns:

array - An array representation of the Document Fragment.


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