XML_XPath
[ class tree: XML_XPath ] [ index: XML_XPath ] [ all elements ]

Class: XML_XPath

Source Location: /XML_XPath-1.2.4/XPath.php

Class Overview

XML_XPath_common
   |
   --XML_XPath

The main "XML_XPath" class is simply a container class with some methods for creating DOM xml objects and preparing error codes


Author(s):

Version:

  • Revision: 1.1

Variables

Methods


Inherited Variables

Inherited Methods

Class: XML_XPath_common

XML_XPath_common::appendChild()
Adds the node or document fragment to the end of the list of children. If the node is already in the tree it is first removed (not sure if this works yet)
XML_XPath_common::appendData()
Will append data to end of text node.
XML_XPath_common::childNodes()
Retrieves the child nodes from the element node as an XML_XPath_result object
XML_XPath_common::cloneNode()
Clones the node and return the node as a result object
XML_XPath_common::deleteData()
Will delete data at offset and for count for a text node.
XML_XPath_common::documentElement()
Move to the document element
XML_XPath_common::dumpChildren()
Returns all the contents of an element node, regardless of type, as is.
XML_XPath_common::evaluate()
Evaluate the xpath expression on the loaded xml document.
XML_XPath_common::firstChild()
Moves the pointer to the first child of this node or returns the first node.
XML_XPath_common::getAttribute()
Retrieves an attribute value by name from the element node at the current pointer.
XML_XPath_common::getAttributes()
Return an associative array of attribute names as the keys and attribute values as the values. This is not a DOM function, but is a convenient addition.
XML_XPath_common::getElementsByTagName()
Create an XML_XPath_result object with the elements with the specified tagname
XML_XPath_common::getNodePath()
Resolve the xpath location of the current node
XML_XPath_common::getOne()
A quick version of the evaluate, where the results are returned immediately. This function is equivalent to xsl:value-of select in every way.
XML_XPath_common::getPointer()
Get the current pointer in the xml document.
XML_XPath_common::hasAttribute()
Returns true when an attribute with a given name is specified on this element false otherwise.
XML_XPath_common::hasAttributes()
Returns whether this node has any attributes.
XML_XPath_common::hasChildNodes()
Returns whether this node has any children.
XML_XPath_common::insertBefore()
Inserts the node before the current pointer.
XML_XPath_common::insertData()
Will insert data at offset for a text node.
XML_XPath_common::lastChild()
Moves the pointer to the last child of this node or returns the last child.
XML_XPath_common::nextSibling()
Moves the internal pointer to the next sibling of the current node, or returns the pointer.
XML_XPath_common::nodeName()
Return the name of this node, depending on its type, according to the DOM recommendation
XML_XPath_common::nodeType()
Returns the integer value constant corresponding to the DOM node type
XML_XPath_common::parentNode()
Moves the internal pointer to the parent of the current node or returns the pointer.
XML_XPath_common::previousSibling()
Moves the internal pointer to the previous sibling of the current node or returns the pointer.
XML_XPath_common::removeAttribute()
Remove the attribute by name.
XML_XPath_common::removeChild()
Removes the child node at the current pointer and returns it.
XML_XPath_common::replaceChild()
Replaces the old child with the new child. If the new child is already in the document, it is first removed (not implemented yet). If the new child is a document fragment, then all of the nodes are inserted in the location of the old child.
XML_XPath_common::replaceChildren()
Not in the DOM specification, but certainly a convenient function. Allows you to pass in an xml document fragment which will be parsed into an xml object and merged into the xml document, replacing all the previous children of the node. It does this by shallow cloning the node, restoring the attributes and then adding the parsed children.
XML_XPath_common::replaceData()
Will replace data at offset and for count with content
XML_XPath_common::setAttribute()
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter.
XML_XPath_common::setPointer()
Set the pointer in the xml document
XML_XPath_common::substringData()
Extracts a range of data from the node. Takes an offset and a count, which are optional and will default to retrieving the whole string. If an XML_ELEMENT_NODE provided, then it first concats all the adjacent text nodes recusively and works on those.
XML_XPath_common::toFile()
Exports the xml document to a file. Only works for the whole document right now.
XML_XPath_common::toString()
Export the xml document to a string, beginning from the pointer.

Class Details

[line 77]
The main "XML_XPath" class is simply a container class with some methods for creating DOM xml objects and preparing error codes
  • Author: Dan Allen <dan@mojavelinux.com>
  • Version: Revision: 1.1
  • Since: PHP 4.2.1
  • Access: public


[ Top ]


Class Variables

$ctx =

[line 84]

  • Var: context object for the xml data object

Type:   object xpath


[ Top ]

$error =  false

[line 93]

  • Var: error indicator

Type:   boolean


[ Top ]

$loaded =  false

[line 90]

  • Var: determines if we have loaded a document or not

Type:   boolean


[ Top ]

$pointer =

[line 87]

  • Var: location in the xml document

Type:   object current
Overrides:   Array


[ Top ]

$xml =

[line 81]

  • Var: data object

Type:   object xml


[ Top ]



Method Detail

errorMessage   [line 220]

string errorMessage( int $in_value)

Return a textual error message for an XML_XPath error code.
  • Return: error message, or false if not error code
  • Access: public

Parameters:

int   $in_value   —  error code

[ Top ]

free   [line 287]

void free( )

Kill the class object to free memory. Not really sure how necessary this is, but xml documents can be pretty big. This will kill everything, so only use it when you are done
  • Access: public

[ Top ]

isError   [line 198]

boolean isError( object $in_value)

Tell whether a result code from a XML_XPath method is an error.
  • Return: whether object is an error object
  • Access: public

Parameters:

object   $in_value   —  object in question

[ Top ]

load   [line 123]

void load( mixed $in_xml, [ $in_type = 'string'])

Load the xml document on which we will execute queries and modifications. This xml document can be loaded from a previously existing xmldom object, a string or a file.

On successful load of the xml document, a new xpath context is created so that queries can be done immediately.

  • Return: {or XML_XPath_Error exception}
  • Access: public

Parameters:

mixed   $in_xml   —  xml document, in one of 3 forms (object, string or file)
   $in_type   — 

[ Top ]

registerNamespace   [line 179]

void registerNamespace( array $in_namespaces)

This function is sort of temporary hack for registering namespace prefixes

The domxml functions should do this automatically when a domxml object is read in. For now, you can use this function.

  • Access: public

Parameters:

array   $in_namespaces   — 

[ Top ]

reset   [line 269]

void reset( )

Resets the object so it is possible to load another xml document.
  • Access: public

[ Top ]

XML_Xpath   [line 98]

void XML_Xpath( [ $in_xml = null], [ $in_type = 'string'])


Parameters:

   $in_xml   — 
   $in_type   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:44:42 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.