eZDOMNode encapsulates XML DOM nodes More...
Public Member Functions | |
| append_child (&$node) | |
| appendAttribute (&$node) | |
| appendAttributes ($attributeValues, $attributeDefinitions, $includeEmptyValues=false) | |
| appendChild (&$node) | |
| attributeCount () | |
| & | attributes () |
| & | attributesNS ($namespaceURI) |
| attributeValue ($attributeName) | |
| attributeValueNS ($attributeName, $namespaceURI) | |
| attributeValues ($attributeDefinitions=false, $defaultValue=null) | |
| & | children () |
| childrenCount () | |
| cleanup (&$node) | |
| clone () | |
| collectTextContent (&$element) | |
| & | content () |
| debugNode (&$node, $showAttributes, $showParent) | |
| dump_mem ($format, $charset=false) | |
| elementAttributeValueByName ($name, $attributeName) | |
| & | elementByAttributeValue ($attr, $value) |
| & | elementByName ($name) |
| & | elementChildrenByName ($name) |
| & | elementFirstChildByName ($name) |
| & | elementsByName ($name) |
| & | elementsTextContentByName ($name) |
| elementTextContentByName ($name) | |
| eZDOMNode () | |
| first_child () | |
| & | firstChild () |
| get_attribute ($attributeName) | |
| get_elements_by_tagname ($name) | |
| getAttribute ($attributeName) | |
| getAttributeNS ($namespaceURI, $localName) | |
| hasAttributes () | |
| hasChildNodes () | |
| hasChildren () | |
| insertBefore (&$newNode, &$refNode) | |
| & | lastChild () |
| localName () | |
| name () | |
| namespaceURI () | |
| & | nextSibling () |
| node_value () | |
| prefix () | |
| & | previousSibling () |
| remove_attribute ($name) | |
| removeAttribute ($name) | |
| removeAttributeNS ($namespaceURI, $localName) | |
| removeAttributes () | |
| removeChild (&$childToRemove) | |
| removeChildren () | |
| removeLastChild () | |
| removeNamedAttribute ($name) | |
| removeNamedChildren ($name) | |
| replaceChild (&$newChild, &$oldChild) | |
| set_attribute ($name, $value) | |
| setAttribute ($name, $value) | |
| setAttributeNS ($namespaceURI, $qualifiedName, $value) | |
| setContent ($content) | |
| setName ($name) | |
| setNamespaceURI ($uri) | |
| setPrefix ($value) | |
| setType ($type) | |
| textContent () | |
| toString ($level, $charset=false, $convertSpecialChars=true) | |
| type () | |
| writeDebug (&$node, $text, $showAttributes=false, $showParent=false) | |
| writeDebugStr (&$node, $text) | |
Private Attributes | |
| $Attributes = array() | |
| Attributes. | |
| $Children = array() | |
| Subnodes. | |
| $Content = "" | |
| $content = "" | |
| Content of the node. | |
| $flag = false | |
| $LocalName = false | |
| The local part of a name. E.g: book:title, title is the local part. | |
| $Name = false | |
| $NamespaceURI = false | |
| Contains the namespace URI. E.g. xmlns="http://ez.no/article/", http://ez.no/article/ would be the namespace URI. | |
| $nodeName = null | |
| DOM W3C compatibility. | |
| $parentNode = false | |
| $Prefix = false | |
| contains the namespace prefix. E.g: book:title, book is the prefix | |
| $tagname = null | |
| tagname, added for DOM XML compatibility. | |
| $Type = EZ_XML_NODE_ELEMENT | |
| $type | |
| Type of the DOM node. ElementNode=1, AttributeNode=2, TextNode=3, CDATASectionNode=4. | |
| $value = '' | |
eZDOMNode encapsulates XML DOM nodes
The following node types are supported:
1 2 3 4 Definition at line 66 of file ezdomnode.php.
| eZDOMNode::append_child | ( | &$ | node | ) |
Alias for libXML compatibility
Definition at line 652 of file ezdomnode.php.
| eZDOMNode::appendAttribute | ( | &$ | node | ) |
Appends the attribute node $node as an attribute of the current node.
false if it failed to insert an attribute.Definition at line 664 of file ezdomnode.php.
Referenced by set_attribute(), setAttribute(), and setAttributeNS().
| eZDOMNode::appendAttributes | ( | $ | attributeValues, | |
| $ | attributeDefinitions, | |||
| $ | includeEmptyValues = false | |||
| ) |
Appends multiple attributes and attribute values.
| $attributeValues | An associative array containing the attribute values to insert, it maps from lookup name to attribute value. | |
| $attributeDefinitions | An associative array defining how lookup names maps to attribute names, the array key is the attribute name and the array value the lookup name. | |
| $includeEmptyValues | If true it will set attribute values even though they don't exist in $attributeValues |
$definition = array( 'name' => 'song_name', 'track' => 'track_name' ); $values = array( 'song_name' => 'Shine On You Crazy Diamond', 'track_number' => '1' ); $node->appendAttributes( $values, $definition ); \encode The node will then look like. \code <song name="Shine On You Crazy Diamond" track="1" />
This method and attributeValues() work together, the returned result of attributeValues() can be inserted with this method.
Definition at line 708 of file ezdomnode.php.
| eZDOMNode::appendChild | ( | &$ | node | ) |
Appends the node $node as a child of the current node.
false if it failed to insert a node.Definition at line 636 of file ezdomnode.php.
Referenced by append_child().
| eZDOMNode::attributeCount | ( | ) |
Definition at line 272 of file ezdomnode.php.
| & eZDOMNode::attributes | ( | ) |
Definition at line 230 of file ezdomnode.php.
| & eZDOMNode::attributesNS | ( | $ | namespaceURI | ) |
Definition at line 240 of file ezdomnode.php.
| eZDOMNode::attributeValue | ( | $ | attributeName | ) |
false is returned.Definition at line 497 of file ezdomnode.php.
Referenced by get_attribute().
| eZDOMNode::attributeValueNS | ( | $ | attributeName, | |
| $ | namespaceURI | |||
| ) |
false is returned.Definition at line 610 of file ezdomnode.php.
| eZDOMNode::attributeValues | ( | $ | attributeDefinitions = false, |
|
| $ | defaultValue = null | |||
| ) |
Goes trough all attributes of the node and matches the attribute names with the parameter $attributeDefinitions.
| $attributeDefinitions | An associative array which maps from matching attribute name to lookup name. | |
| $defaultValue | If other value than null it will be set as value for all lookup names that didn't match |
The matching attribute name in the will be matched against the attributes of the node. When a match is found the attribute value will be fetched and placed in the returned associative array using lookup name as key.
A code example will explain this, the variable $songNode contains the following xml
<song name="Shine On You Crazy Diamond" track="1" />
The PHP code is.
$def = array( 'name' => 'song_name', 'track' => 'track_number' ); $values = $songNode->attributeValues( $def ); \encode \a $values will now contain. \code array( 'song_name' => 'Shine On You Crazy Diamond', 'track_number => '1' )
This method and appendAttributes() work together, the values inserted with appendAttributes() can be extracted with this method.
Definition at line 569 of file ezdomnode.php.
| & eZDOMNode::children | ( | ) |
Definition at line 282 of file ezdomnode.php.
| eZDOMNode::childrenCount | ( | ) |
Definition at line 302 of file ezdomnode.php.
| eZDOMNode::cleanup | ( | &$ | node | ) |
Subtree destructor. Needed to clean memory properly.
Definition at line 100 of file ezdomnode.php.
| eZDOMNode::clone | ( | ) |
Makes a copy of the current node and returns a reference to it.
Definition at line 83 of file ezdomnode.php.
| eZDOMNode::collectTextContent | ( | &$ | element | ) |
Definition at line 863 of file ezdomnode.php.
Referenced by textContent().
| & eZDOMNode::content | ( | ) |
false if it does not contain any content.Definition at line 210 of file ezdomnode.php.
Referenced by eZDOMNode().
| eZDOMNode::debugNode | ( | &$ | node, | |
| $ | showAttributes, | |||
| $ | showParent | |||
| ) |
Definition at line 1333 of file ezdomnode.php.
Referenced by writeDebug().
| eZDOMNode::dump_mem | ( | $ | format, | |
| $ | charset = false | |||
| ) |
Alias for libxml compatibility
Definition at line 1026 of file ezdomnode.php.
| eZDOMNode::elementAttributeValueByName | ( | $ | name, | |
| $ | attributeName | |||
| ) |
Finds the first element named $name and returns the value of the attribute named $attributeName. If no element node is found or no attribute with the given name exists it returns false.
false is returned. Definition at line 525 of file ezdomnode.php.
| & eZDOMNode::elementByAttributeValue | ( | $ | attr, | |
| $ | value | |||
| ) |
| attribute | name | |
| attribute | value |
Definition at line 432 of file ezdomnode.php.
| & eZDOMNode::elementByName | ( | $ | name | ) |
false is returned.Definition at line 372 of file ezdomnode.php.
Referenced by elementAttributeValueByName(), elementChildrenByName(), elementFirstChildByName(), and elementTextContentByName().
| & eZDOMNode::elementChildrenByName | ( | $ | name | ) |
Finds the first element named $name and returns the children of that node. If no element node is found it returns false.
false is returned. Definition at line 335 of file ezdomnode.php.
| & eZDOMNode::elementFirstChildByName | ( | $ | name | ) |
Finds the first element named $name and returns the first child of that node. If no element node is found or there are not children it returns false.
false is returned. Definition at line 354 of file ezdomnode.php.
| & eZDOMNode::elementsByName | ( | $ | name | ) |
Definition at line 454 of file ezdomnode.php.
| & eZDOMNode::elementsTextContentByName | ( | $ | name | ) |
Definition at line 474 of file ezdomnode.php.
| eZDOMNode::elementTextContentByName | ( | $ | name | ) |
Finds the first element named $name and returns the text content of that node. If no element node is found or no text content exists it returns false.
false is returned. Definition at line 415 of file ezdomnode.php.
| eZDOMNode::eZDOMNode | ( | ) |
| eZDOMNode::first_child | ( | ) |
Definition at line 312 of file ezdomnode.php.
| & eZDOMNode::firstChild | ( | ) |
false if there are no children.Definition at line 1147 of file ezdomnode.php.
| eZDOMNode::get_attribute | ( | $ | attributeName | ) |
Alias for libxml compatibility
Definition at line 512 of file ezdomnode.php.
| eZDOMNode::get_elements_by_tagname | ( | $ | name | ) |
Alias for libxml compatibility
Definition at line 394 of file ezdomnode.php.
| eZDOMNode::getAttribute | ( | $ | attributeName | ) |
Definition at line 1075 of file ezdomnode.php.
| eZDOMNode::getAttributeNS | ( | $ | namespaceURI, | |
| $ | localName | |||
| ) |
Definition at line 1088 of file ezdomnode.php.
| eZDOMNode::hasAttributes | ( | ) |
true if the node has any attributes.Definition at line 262 of file ezdomnode.php.
| eZDOMNode::hasChildNodes | ( | ) |
Definition at line 1135 of file ezdomnode.php.
| eZDOMNode::hasChildren | ( | ) |
true if the node has children.Definition at line 292 of file ezdomnode.php.
| eZDOMNode::insertBefore | ( | &$ | newNode, | |
| &$ | refNode | |||
| ) |
Replaces child by the new one given.
Definition at line 1222 of file ezdomnode.php.
| & eZDOMNode::lastChild | ( | ) |
false if there are no children.Definition at line 1167 of file ezdomnode.php.
| eZDOMNode::localName | ( | ) |
Returns the local name of the node if the node uses namespaces. If not false is returned.
Definition at line 156 of file ezdomnode.php.
| eZDOMNode::name | ( | ) |
For element and attributes nodes this will the name supplied when creating the node, for text nodes it returns text and CDATA returns cdata-section
Definition at line 123 of file ezdomnode.php.
Referenced by removeAttribute(), removeNamedAttribute(), and removeNamedChildren().
| eZDOMNode::namespaceURI | ( | ) |
false if no URI Definition at line 140 of file ezdomnode.php.
Referenced by toString().
| & eZDOMNode::nextSibling | ( | ) |
Definition at line 1249 of file ezdomnode.php.
| eZDOMNode::node_value | ( | ) |
Definition at line 322 of file ezdomnode.php.
| eZDOMNode::prefix | ( | ) |
Definition at line 164 of file ezdomnode.php.
Referenced by toString().
| & eZDOMNode::previousSibling | ( | ) |
Definition at line 1282 of file ezdomnode.php.
| eZDOMNode::remove_attribute | ( | $ | name | ) |
Alias for libxml compatibility
Definition at line 750 of file ezdomnode.php.
| eZDOMNode::removeAttribute | ( | $ | name | ) |
Definition at line 1102 of file ezdomnode.php.
| eZDOMNode::removeAttributeNS | ( | $ | namespaceURI, | |
| $ | localName | |||
| ) |
Definition at line 1117 of file ezdomnode.php.
| eZDOMNode::removeAttributes | ( | ) |
Removes all attribute from the node.
Definition at line 760 of file ezdomnode.php.
| eZDOMNode::removeChild | ( | &$ | childToRemove | ) |
Removes child by the given child object.
Definition at line 832 of file ezdomnode.php.
| eZDOMNode::removeChildren | ( | ) |
Removes all child nodes from the current node.
Definition at line 795 of file ezdomnode.php.
| eZDOMNode::removeLastChild | ( | ) |
Removes the last child node of the current node.
Definition at line 814 of file ezdomnode.php.
| eZDOMNode::removeNamedAttribute | ( | $ | name | ) |
Removes the attribute node named $name.
false if no such node exists.Definition at line 733 of file ezdomnode.php.
Referenced by remove_attribute(), and set_attribute().
| eZDOMNode::removeNamedChildren | ( | $ | name | ) |
Removes all child nodes that matches the name $name.
true if it removed any nodes, otherwise false.Definition at line 771 of file ezdomnode.php.
| eZDOMNode::replaceChild | ( | &$ | newChild, | |
| &$ | oldChild | |||
| ) |
Replaces child by the new one given.
Definition at line 1186 of file ezdomnode.php.
| eZDOMNode::set_attribute | ( | $ | name, | |
| $ | value | |||
| ) |
Definition at line 674 of file ezdomnode.php.
| eZDOMNode::setAttribute | ( | $ | name, | |
| $ | value | |||
| ) |
Definition at line 1037 of file ezdomnode.php.
| eZDOMNode::setAttributeNS | ( | $ | namespaceURI, | |
| $ | qualifiedName, | |||
| $ | value | |||
| ) |
Definition at line 1055 of file ezdomnode.php.
| eZDOMNode::setContent | ( | $ | content | ) |
Sets the content of the node to the $content.
Definition at line 220 of file ezdomnode.php.
| eZDOMNode::setName | ( | $ | name | ) |
Sets the current name to $name.
Definition at line 131 of file ezdomnode.php.
| eZDOMNode::setNamespaceURI | ( | $ | uri | ) |
Sets the namespace URI of the node to $uri.
Definition at line 148 of file ezdomnode.php.
| eZDOMNode::setPrefix | ( | $ | value | ) |
Sets the namespace prefix for this node to $value.
Definition at line 172 of file ezdomnode.php.
| eZDOMNode::setType | ( | $ | type | ) |
Sets the node type to $type.
Use one of the following defines for the type:
Definition at line 200 of file ezdomnode.php.
| eZDOMNode::textContent | ( | ) |
false if there are no children.Definition at line 858 of file ezdomnode.php.
| eZDOMNode::toString | ( | $ | level, | |
| $ | charset = false, |
|||
| $ | convertSpecialChars = true | |||
| ) |
| $level | The current tab level, starts at 0 and is increased by 1 for each recursion | |
| $charset | Which charset the text will be encoded in, currently not used |
Example strings.
'<song name="Shine On You Crazy Diamond" track="1" />' 'This & that "wrapped" in <div> tags' '<![CDATA[This & that "wrapped" in <div> tags'
Definition at line 904 of file ezdomnode.php.
Referenced by dump_mem().
| eZDOMNode::type | ( | ) |
The type is one of:
Definition at line 186 of file ezdomnode.php.
Referenced by eZDOMNode().
| eZDOMNode::writeDebug | ( | &$ | node, | |
| $ | text, | |||
| $ | showAttributes = false, |
|||
| $ | showParent = false | |||
| ) |
Outputs DOM subtree to the debug output in the easy readable form.
| node | subtree root node |
Definition at line 1312 of file ezdomnode.php.
Referenced by writeDebugStr().
| eZDOMNode::writeDebugStr | ( | &$ | node, | |
| $ | text | |||
| ) |
Outputs XML from DOM as a string.
| node | subtree root node |
Definition at line 1370 of file ezdomnode.php.
eZDOMNode::$Attributes = array() [private] |
Attributes.
Definition at line 1402 of file ezdomnode.php.
eZDOMNode::$Children = array() [private] |
Subnodes.
Definition at line 1399 of file ezdomnode.php.
eZDOMNode::$Content = "" [private] |
Definition at line 1395 of file ezdomnode.php.
eZDOMNode::$content = "" [private] |
eZDOMNode::$flag = false [private] |
Definition at line 1419 of file ezdomnode.php.
eZDOMNode::$LocalName = false [private] |
The local part of a name. E.g: book:title, title is the local part.
Definition at line 1408 of file ezdomnode.php.
eZDOMNode::$Name = false [private] |
Name of the node
Definition at line 1381 of file ezdomnode.php.
eZDOMNode::$NamespaceURI = false [private] |
Contains the namespace URI. E.g. xmlns="http://ez.no/article/", http://ez.no/article/ would be the namespace URI.
Definition at line 1405 of file ezdomnode.php.
eZDOMNode::$nodeName = null [private] |
DOM W3C compatibility.
Definition at line 1387 of file ezdomnode.php.
eZDOMNode::$parentNode = false [private] |
Reference to the parent node. Available only if Document has been created with parameter $setParentNode = true or parsed with eZXML::domTree function with $params["SetParentNode"] = true
Definition at line 1416 of file ezdomnode.php.
eZDOMNode::$Prefix = false [private] |
contains the namespace prefix. E.g: book:title, book is the prefix
Definition at line 1411 of file ezdomnode.php.
eZDOMNode::$tagname = null [private] |
tagname, added for DOM XML compatibility.
Definition at line 1384 of file ezdomnode.php.
eZDOMNode::$Type = EZ_XML_NODE_ELEMENT [private] |
Definition at line 1391 of file ezdomnode.php.
eZDOMNode::$type [private] |
Type of the DOM node. ElementNode=1, AttributeNode=2, TextNode=3, CDATASectionNode=4.
Definition at line 1390 of file ezdomnode.php.
Referenced by setType().
eZDOMNode::$value = '' [private] |
Definition at line 1396 of file ezdomnode.php.
Referenced by appendAttributes(), elementByAttributeValue(), set_attribute(), setAttribute(), setAttributeNS(), and setPrefix().
1.6.3