Class XML

Description

Class for accessing XML data through the XPath language.

This class offers methods for accessing the nodes of a XML document using the XPath language. You can add or remove nodes, set or modify their content and their attributes. No additional PHP extensions like DOM XML or something similar are required to use these features.

Located in /base/include/class.xml.php (line 49)


	
			
Variable Summary
array $axes
array $entities
array $functions
array $ids
array $nodes
array $operators
string $path
int $position
string $root
string $xpath
Method Summary
XML XML ([string $file = ""], [mixed $debug = ""])
void add_attributes (string $path, array $attributes)
void add_content (string $path, string $value)
string add_node (mixed $context, string $name, string $content)
string afterstr (string $string, string $delimiter)
boolean check_node_test (string $context, string $node_test)
array check_predicates (array $nodes, array $predicates)
void display_error (string $message)
array evaluate (string $path, [string $context = ""])
mixed evaluate_function (string $function, string $arguments, string $node)
mixed evaluate_predicate (string $node, string $predicate)
array evaluate_step (string $context, array $steps)
void getInstance ([mixed $name = "defaultXML"])
void get_attribute (mixed $path, mixed $attribute)
array get_attributes (string $path)
array get_axis (string $step, string $node)
string get_content (string $path)
string get_file ([array $highlight = array()], [string $root = ""], int $level)
string get_name (string $path)
array handle_axis_ancestor (array $axis, string $context)
array handle_axis_ancestor_or_self (array $axis, string $context)
array handle_axis_attribute (array $axis, string $context)
array handle_axis_child (array $axis, string $context)
array handle_axis_descendant (array $axis, string $context)
array handle_axis_descendant_or_self (array $axis, string $context)
array handle_axis_following (array $axis, string $context)
array handle_axis_following_sibling (array $axis, string $context)
array handle_axis_namespace (array $axis, string $context)
array handle_axis_parent (array $axis, string $context)
array handle_axis_preceding (array $axis, string $context)
array handle_axis_preceding_sibling (array $axis, string $context)
array handle_axis_self (array $axis, string $context)
void handle_character_data (int $parser, string $text)
void handle_end_element (int $parser, string $name)
mixed handle_function_boolean (string $node, string $arguments)
mixed handle_function_ceiling (string $node, string $arguments)
mixed handle_function_concat (string $node, string $arguments)
mixed handle_function_contains (string $node, string $arguments)
mixed handle_function_count (string $node, string $arguments)
mixed handle_function_false (string $node, string $arguments)
mixed handle_function_floor (string $node, string $arguments)
mixed handle_function_id (string $node, string $arguments)
mixed handle_function_lang (string $node, string $arguments)
mixed handle_function_last (string $node, string $arguments)
mixed handle_function_name (string $node, string $arguments)
mixed handle_function_not (string $node, string $arguments)
mixed handle_function_number (string $node, string $arguments)
mixed handle_function_position (string $node, string $arguments)
mixed handle_function_round (string $node, string $arguments)
mixed handle_function_starts_with (string $node, string $arguments)
mixed handle_function_string (string $node, string $arguments)
mixed handle_function_string_length (string $node, string $arguments)
mixed handle_function_substring (string $node, string $arguments)
mixed handle_function_substring_after (string $node, string $arguments)
mixed handle_function_substring_before (string $node, string $arguments)
mixed handle_function_sum (string $node, string $arguments)
mixed handle_function_text (string $node, string $arguments)
mixed handle_function_translate (string $node, string $arguments)
mixed handle_function_true (string $node, string $arguments)
void handle_start_element (int $parser, string $name, array $attributes)
boolean is_function (string $expression)
void load_file (string $file)
string prestr (string $string, string $delimiter)
void remove_node (string $node)
int search_string (string $term, string $expression)
void set_attributes (string $path, array $attributes)
void set_content (string $path, string $value)
array split_paths (string $expression)
array split_steps (string $expression)
Variables
array $axes = array ( "child", "descendant", "parent", "ancestor",
"following-sibling", "preceding-sibling", "following", "preceding",
"attribute", "namespace", "self", "descendant-or-self",
"ancestor-or-self" )
(line 137)

List of supported XPath axes.

This array contains a list of all valid axes that can be evaluated in an XPath expression.

  • access: private
array $entities = array ( "&" => "&amp;", "<" => "&lt;", ">" => "&gt;",
"'" => "&apos", '"' => "&quot;" )
(line 125)

List of entities to be converted.

This array contains a list of entities to be converted when an XPath expression is evaluated.

  • access: private
array $functions = array ( "last", "position", "count", "id", "name",
"string", "concat", "starts-with", "contains", "substring-before",
"substring-after", "substring", "string-length", "translate",
"boolean", "not", "true", "false", "lang", "number", "sum", "floor",
"ceiling", "round", "text" )
(line 151)

List of supported XPath functions.

This array contains a list of all valid functions that can be evaluated in an XPath expression.

  • access: private
array $ids = array() (line 71)

List of document node IDs.

This array contains a list of all IDs of all document nodes that are used for counting when adding a new node.

  • access: private
array $nodes = array() (line 60)

List of all document nodes.

This array contains a list of all document nodes saved as an associative array.

  • access: private
array $operators = array( " or ", " and ", "=", "!=", "<=", "<", ">=", ">",
"+", "-", "*", " div ", " mod " )
(line 167)

List of supported XPath operators.

This array contains a list of all valid operators that can be evaluated in a predicate of an XPath expression. The list is ordered by the precedence of the operators (lowest precedence first).

  • access: private
string $path = "" (line 82)

Current document path.

This variable saves the current path while parsing a XML file and adding the nodes being read from the file.

  • access: private
int $position = 0 (line 93)

Current document position.

This variable counts the current document position while parsing a XML file and adding the nodes being read from the file.

  • access: private
string $root = "" (line 104)

Path of the document root.

This string contains the full path to the node that acts as the root node of the whole document.

  • access: private
string $xpath = "" (line 114)

Current XPath expression.

This string contains the full XPath expression being parsed currently.

  • access: private
Methods
Constructor XML (line 181)

Constructor of the class.

This constructor initializes the class and, when a filename is given, tries to read and parse the given file.

XML XML ([string $file = ""], [mixed $debug = ""])
  • string $file: Path and name of the file to read and parsed.
add_attributes (line 741)

Add attributes to a node.

This method adds attributes to a node. Existing attributes will not be overwritten.

void add_attributes (string $path, array $attributes)
  • string $path: Full document path of the node, the attributes should be added to.
  • array $attributes: Associative array containing the new attributes for the node.
add_content (line 624)

Add content to a node.

This method adds content to a node. If it's an attribute node, then the value of the attribute will be set, otherwise the character data of the node will be set. The content is appended to existing content, so nothing will be overwritten.

void add_content (string $path, string $value)
  • string $path: Full document path of the node.
  • string $value: String containing the content to be added.
add_node (line 442)

Adds a new node to the XML document.

This method adds a new node to the tree of nodes of the XML document being handled by this class. The new node is created according to the parameters passed to this method.

string add_node (mixed $context, string $name, string $content)
  • string $content: Full path of the parent, to which the new node should be added as a child.
  • string $name: Name of the new node.
afterstr (line 3351)

Retrieves a substring after a delimiter.

This method retrieves everything from a string after a given delimiter, not including the delimiter.

string afterstr (string $string, string $delimiter)
  • string $string: String, from which the substring should be extracted.
  • string $delimiter: String containing the delimiter to use.
check_node_test (line 1804)

Checks whether a node matches a node-test.

This method checks whether a node in the document matches a given node-test.

boolean check_node_test (string $context, string $node_test)
  • string $context: Full path of the node, which should be tested for matching the node-test.
  • string $node_test: String containing the node-test for the node.
check_predicates (line 1724)

Checks whether a node matches predicates.

This method checks whether a list of nodes passed to this method match a given list of predicates.

array check_predicates (array $nodes, array $predicates)
  • array $nodes: Array of full paths of all nodes to be tested.
  • array $predicates: Array of predicates to use.
display_error (line 3371)

Displays an error message.

This method displays an error messages and stops the execution of the script. This method is called exactly in the same way as the printf function. The first argument contains the message and additional arguments of various types may be passed to this method to be inserted into the message.

void display_error (string $message)
  • string $message: Error message to be displayed.
evaluate (line 830)

Evaluates an XPath expression.

This method tries to evaluate an XPath expression by parsing it. A XML document has to be read before this method is able to work.

  • return: The returned array contains a list of the full document paths of all nodes that match the evaluated XPath expression.
  • see: XML::$nodes, XML::$ids
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: public
array evaluate (string $path, [string $context = ""])
  • string $path: XPath expression to be evaluated.
  • string $context: Full path of a document node, starting from which the XPath expression should be evaluated.
evaluate_function (line 1413)

Evaluates an XPath function

This method evaluates a given XPath function with its arguments on a specific node of the document.

  • return: This method returns the result of the evaluation of the function. Depending on the function the type of the return value can be different.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed evaluate_function (string $function, string $arguments, string $node)
  • string $function: Name of the function to be evaluated.
  • string $arguments: String containing the arguments being passed to the function.
  • string $node: Full path to the document node on which the function should be evaluated.
evaluate_predicate (line 1452)

Evaluates a predicate on a node.

This method tries to evaluate a predicate on a given node.

  • return: This method is called recursively. The first call should return a boolean value, whether the node matches the predicate or not. Any call to the method being made during the recursion may also return other types for further processing.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed evaluate_predicate (string $node, string $predicate)
  • string $node: Full path of the node on which the predicate should be evaluated.
  • string $predicate: String containing the predicate expression to be evaluated.
evaluate_step (line 1310)

Evaluates a step of an XPath expression.

This method tries to evaluate a step from an XPath expression at a specific context.

  • return: This method returns an array containing all nodes that are the result of evaluating the given XPath step.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array evaluate_step (string $context, array $steps)
  • string $context: Full document path of the context from which starting the step should be evaluated.
  • array $steps: Array containing the remaining steps of the current XPath expression.
getInstance (line 193)
void getInstance ([mixed $name = "defaultXML"])
get_attribute (line 788)
void get_attribute (mixed $path, mixed $attribute)
get_attributes (line 782)

Retrieves a list of all attributes of a node.

This method retrieves a list of all attributes of the node specified in the argument.

array get_attributes (string $path)
  • string $path: Full document path of the node, from which the list of attributes should be retrieved.
get_axis (line 1064)

Retrieves axis information from an XPath expression step.

This method tries to extract the name of the axis and its node-test from a given step of an XPath expression at a given node.

array get_axis (string $step, string $node)
  • string $step: String containing a step of an XPath expression.
  • string $node: Full document path of the node on which the step is executed.
get_content (line 700)

Retrieves the content of a node.

This method retrieves the content of a node. If it's an attribute node, then the value of the attribute will be retrieved, otherwise it'll be the character data of the node.

string get_content (string $path)
  • string $path: Full document path of the node, from which the content should be retrieved.
get_file (line 283)

Generates a XML file with the content of the current document.

This method creates a string containing the XML data being read and modified by this class before. This string can be used to save a modified document back to a file or doing other nice things with it.

string get_file ([array $highlight = array()], [string $root = ""], int $level)
  • array $highlight: Array containing a list of full document paths of nodes to be highlighted by <font>...</font> tags in the generated XML string.
  • string $root: While doing a recursion with this method, this parameter is used for internal purpose.
  • int $level: While doing a recursion with this method, this parameter is used for internal purpose.
get_name (line 808)

Retrieves the name of a document node.

This method retrieves the name of document node specified in the argument.

string get_name (string $path)
  • string $path: Full document path of the node, from which the name should be retrieved.
handle_axis_ancestor (line 2124)

Handles the XPath ancestor axis.

This method handles the XPath ancestor axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_ancestor (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_ancestor_or_self (line 2447)

Handles the XPath ancestor-or-self axis.

This method handles the XPath ancestor-or-self axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_ancestor_or_self (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_attribute (line 1997)

Handles the XPath attribute axis.

This method handles the XPath attribute axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_attribute (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_child (line 1918)

Handles the XPath child axis.

This method handles the XPath child axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_child (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_descendant (line 2072)

Handles the XPath descendant axis.

This method handles the XPath descendant axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_descendant (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_descendant_or_self (line 2419)

Handles the XPath descendant-or-self axis.

This method handles the XPath descendant-or-self axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_descendant_or_self (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_following (line 2195)

Handles the XPath following axis.

This method handles the XPath following axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_following (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_following_sibling (line 2305)

Handles the XPath following-sibling axis.

This method handles the XPath following-sibling axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_following_sibling (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_namespace (line 2165)

Handles the XPath namespace axis.

This method handles the XPath namespace axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_namespace (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_parent (line 1966)

Handles the XPath parent axis.

This method handles the XPath parent axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_parent (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_preceding (line 2250)

Handles the XPath preceding axis.

This method handles the XPath preceding axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_preceding (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_preceding_sibling (line 2362)

Handles the XPath preceding-sibling axis.

This method handles the XPath preceding-sibling axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_preceding_sibling (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_axis_self (line 2042)

Handles the XPath self axis.

This method handles the XPath self axis.

  • return: This method returns an array containing all nodes that were found during the evaluation of the given axis.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array handle_axis_self (array $axis, string $context)
  • array $axis: Array containing information about the axis.
  • string $context: Node from which starting the axis should be processed.
handle_character_data (line 932)

Handles character data while parsing.

While parsing a XML document for each character data this method is called. It'll add the character data to the document tree.

void handle_character_data (int $parser, string $text)
  • int $parser: Handler for accessing the current XML parser.
  • string $text: Character data found in the document.
handle_end_element (line 914)

Handles closing XML tags while parsing.

While parsing a XML document for each closing tag this method is called.

void handle_end_element (int $parser, string $name)
  • int $parser: Handler for accessing the current XML parser.
  • string $name: Name of the closing tag found in the document.
handle_function_boolean (line 2950)

Handles the XPath function boolean.

This method handles the XPath function boolean.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_boolean (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_ceiling (line 3254)

Handles the XPath function ceiling.

This method handles the XPath function ceiling.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_ceiling (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_concat (line 2674)

Handles the XPath function concat.

This method handles the XPath function concat.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_concat (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_contains (line 2749)

Handles the XPath function contains.

This method handles the XPath function contains.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_contains (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_count (line 2523)

Handles the XPath function count.

This method handles the XPath function count.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_count (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_false (line 3058)

Handles the XPath function false.

This method handles the XPath function false.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_false (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_floor (line 3227)

Handles the XPath function floor.

This method handles the XPath function floor.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_floor (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_id (line 2545)

Handles the XPath function id.

This method handles the XPath function id.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_id (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_lang (line 3079)

Handles the XPath function lang.

This method handles the XPath function lang.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_lang (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_last (line 2476)

Handles the XPath function last.

This method handles the XPath function last.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_last (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_name (line 2589)

Handles the XPath function name.

This method handles the XPath function name.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_name (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_not (line 3013)

Handles the XPath function not.

This method handles the XPath function not.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_not (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_number (line 3147)

Handles the XPath function number.

This method handles the XPath function number.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_number (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_position (line 2502)

Handles the XPath function position.

This method handles the XPath function position.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_position (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_round (line 3281)

Handles the XPath function round.

This method handles the XPath function round.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_round (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_starts_with (line 2711)

Handles the XPath function starts-with.

This method handles the XPath function starts-with.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_starts_with (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_string (line 2610)

Handles the XPath function string.

This method handles the XPath function string.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_string (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_string_length (line 2889)

Handles the XPath function string-length.

This method handles the XPath function string-length.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_string_length (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_substring (line 2845)

Handles the XPath function substring.

This method handles the XPath function substring.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_substring (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_substring_after (line 2816)

Handles the XPath function substring-after.

This method handles the XPath function substring-after.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_substring_after (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_substring_before (line 2787)

Handles the XPath function substring-before.

This method handles the XPath function substring-before.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_substring_before (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_sum (line 3187)

Handles the XPath function sum.

This method handles the XPath function sum.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_sum (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_text (line 3308)

Handles the XPath function text.

This method handles the XPath function text.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_text (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_translate (line 2916)

Handles the XPath function translate.

This method handles the XPath function translate.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_translate (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_function_true (line 3037)

Handles the XPath function true.

This method handles the XPath function true.

  • return: Depending on the type of function being processed this method returns different types.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
mixed handle_function_true (string $node, string $arguments)
  • string $node: Full path of the node on which the function should be processed.
  • string $arguments: String containing the arguments that were passed to the function.
handle_start_element (line 893)

Handles opening XML tags while parsing.

While parsing a XML document for each opening tag this method is called. It'll add the tag found to the tree of document nodes.

void handle_start_element (int $parser, string $name, array $attributes)
  • int $parser: Handler for accessing the current XML parser.
  • string $name: Name of the opening tag found in the document.
  • array $attributes: Associative array containing a list of all attributes of the tag found in the document.
is_function (line 1279)

Checks for a valid function name.

This method check whether an expression contains a valid name of an XPath function.

  • return: This method returns true if the given name is a valid XPath function name, otherwise false.
  • see: XML::evaluate()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
boolean is_function (string $expression)
  • string $expression: Name of the function to be checked.
load_file (line 215)

Reads a file and parses the XML data.

This method reads the content of a XML file, tries to parse its content and upon success stores the information retrieved from the file into an array.

void load_file (string $file)
  • string $file: Path and name of the file to be read and parsed.
prestr (line 3329)

Retrieves a substring before a delimiter.

This method retrieves everything from a string before a given delimiter, not including the delimiter.

string prestr (string $string, string $delimiter)
  • string $string: String, from which the substring should be extracted.
  • string $delimiter: String containing the delimiter to use.
remove_node (line 506)

Removes a node from the XML document.

This method removes a node from the tree of nodes of the XML document. If the node is a document node, all children of the node and its character data will be removed. If the node is an attribute node, only this attribute will be removed, the node to which the attribute belongs as well as its children will remain unmodified.

void remove_node (string $node)
  • string $node: Full path of the node to be removed.
search_string (line 1220)

Looks for a string within another string.

This method looks for a string within another string. Brackets in the string the method is looking through will be respected, which means that only if the string the method is looking for is located outside of brackets, the search will be successful.

int search_string (string $term, string $expression)
  • string $term: String in which the search shall take place.
  • string $expression: String that should be searched.
set_attributes (line 762)

Sets the attributes of a node.

This method sets the attributes of a node and overwrites all existing attributes by doing this.

void set_attributes (string $path, array $attributes)
  • string $path: Full document path of the node, the attributes of which should be set.
  • array $attributes: Associative array containing the new attributes for the node.
set_content (line 661)

Set the content of a node.

This method sets the content of a node. If it's an attribute node, then the value of the attribute will be set, otherwise the character data of the node will be set. Existing content will be overwritten.

void set_content (string $path, string $value)
  • string $path: Full document path of the node.
  • string $value: String containing the content to be set.
split_paths (line 956)

Splits an XPath expression into its different expressions.

This method splits an XPath expression. Each expression can consists of list of expression being separated from each other by a | character.

  • return: The array returned from this method contains a list of all expressions found in the expression passed to this method as a parameter.
  • see: evalute()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array split_paths (string $expression)
  • string $expression: The complete expression to be splitted into its different expressions.
split_steps (line 1008)

Splits an XPath expression into its different steps.

This method splits an XPath expression. Each expression can consists of list of steps being separated from each other by a / character.

  • return: The array returned from this method contains a list of all steps found in the expression passed to this method as a parameter.
  • see: evalute()
  • author: Michael P. Mehl <mailto:mpm@phpxml.org>
  • access: private
array split_steps (string $expression)
  • string $expression: The complete expression to be splitted into its different steps.

Documentation generated on Thu, 27 Nov 2003 17:36:31 +0100 by phpDocumentor 1.2.3