[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/phpgwapi/inc/ -> class.xml.inc.php (sommaire)

(pas de description)

Poids: 3385 lignes (119 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

XML:: (67 méthodes):
  XML()
  load_file()
  get_file()
  add_node()
  remove_node()
  add_content()
  set_content()
  get_content()
  add_attributes()
  set_attributes()
  get_attributes()
  get_name()
  evaluate()
  handle_start_element()
  handle_end_element()
  handle_character_data()
  split_paths()
  split_steps()
  get_axis()
  search_string()
  is_function()
  evaluate_step()
  evaluate_function()
  evaluate_predicate()
  check_predicates()
  check_node_test()
  handle_axis_child()
  handle_axis_parent()
  handle_axis_attribute()
  handle_axis_self()
  handle_axis_descendant()
  handle_axis_ancestor()
  handle_axis_namespace()
  handle_axis_following()
  handle_axis_preceding()
  handle_axis_following_sibling()
  handle_axis_preceding_sibling()
  handle_axis_descendant_or_self()
  handle_axis_ancestor_or_self()
  handle_function_last()
  handle_function_position()
  handle_function_count()
  handle_function_id()
  handle_function_name()
  handle_function_string()
  handle_function_concat()
  handle_function_starts_with()
  handle_function_contains()
  handle_function_substring_before()
  handle_function_substring_after()
  handle_function_substring()
  handle_function_string_length()
  handle_function_translate()
  handle_function_boolean()
  handle_function_not()
  handle_function_true()
  handle_function_false()
  handle_function_lang()
  handle_function_number()
  handle_function_sum()
  handle_function_floor()
  handle_function_ceiling()
  handle_function_round()
  handle_function_text()
  prestr()
  afterstr()
  display_error()


Classe: XML  - X-Ref

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.

XML( $file = "" )   X-Ref
Constructor of the class.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $file Path and name of the file to read and parsed.

load_file( $file )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $file Path and name of the file to be read and parsed.

get_file( $highlight = array()   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $highlight Array containing a list of full document
param: string $root While doing a recursion with this method, this
param: int $level While doing a recursion with this method, this
return: string The returned string contains well-formed XML data

add_node( $context, $name )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $content Full path of the parent, to which the new
param: string $name Name of the new node.
return: string The string returned by this method will contain the

remove_node( $node )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node to be removed.

add_content( $path, $value )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node.
param: string $value String containing the content to be added.

set_content( $path, $value )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node.
param: string $value String containing the content to be set.

get_content( $path )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node, from which the
return: string The returned string contains either the value or the

add_attributes( $path, $attributes )   X-Ref
Add attributes to a node.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node, the attributes
param: array $attributes Associative array containing the new

set_attributes( $path, $attributes )   X-Ref
Sets the attributes of a node.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node, the attributes
param: array $attributes Associative array containing the new

get_attributes( $path )   X-Ref
Retrieves a list of all attributes of a node.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node, from which the
return: array The returned associative array contains the all

get_name( $path )   X-Ref
Retrieves the name of a document node.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path Full document path of the node, from which the
return: string The returned array contains the name of the specified

evaluate( $path, $context = "" )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $path XPath expression to be evaluated.
param: string $context Full path of a document node, starting
return: array The returned array contains a list of the full

handle_start_element( $parser, $name, $attributes )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: int $parser Handler for accessing the current XML parser.
param: string $name Name of the opening tag found in the document.
param: array $attributes Associative array containing a list of

handle_end_element( $parser, $name )   X-Ref
Handles closing XML tags while parsing.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: int $parser Handler for accessing the current XML parser.
param: string $name Name of the closing tag found in the document.

handle_character_data( $parser, $text )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: int $parser Handler for accessing the current XML parser.
param: string $text Character data found in the document.

split_paths( $expression )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $expression The complete expression to be splitted
return: array The array returned from this method contains a list

split_steps( $expression )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $expression The complete expression to be splitted
return: array The array returned from this method contains a list

get_axis( $step, $node )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $step String containing a step of an XPath expression.
param: string $node Full document path of the node on which the
return: array This method returns an array containing information

search_string( $term, $expression )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $term String in which the search shall take place.
param: string $expression String that should be searched.
return: int This method returns -1 if no string was found, otherwise

is_function( $expression )   X-Ref
Checks for a valid function name.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $expression Name of the function to be checked.
return: boolean This method returns true if the given name is a valid

evaluate_step( $context, $steps )   X-Ref
Evaluates a step of an XPath expression.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $context Full document path of the context from
param: array $steps Array containing the remaining steps of the
return: array This method returns an array containing all nodes

evaluate_function( $function, $arguments, $node )   X-Ref
Evaluates an XPath function

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $function Name of the function to be evaluated.
param: string $arguments String containing the arguments being
param: string $node Full path to the document node on which the
return: mixed This method returns the result of the evaluation of

evaluate_predicate( $node, $predicate )   X-Ref
Evaluates a predicate on a node.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the predicate
param: string $predicate String containing the predicate expression
return: mixed This method is called recursively. The first call should

check_predicates( $nodes, $predicates )   X-Ref
Checks whether a node matches predicates.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: array $nodes Array of full paths of all nodes to be tested.
param: array $predicates Array of predicates to use.
return: array The array returned by this method contains a list of

check_node_test( $context, $node_test )   X-Ref
Checks whether a node matches a node-test.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $context Full path of the node, which should be tested
param: string $node_test String containing the node-test for the
return: boolean This method returns true if the node matches the

handle_axis_child( $axis, $context )   X-Ref
Handles the XPath child axis.

This method handles the XPath child axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_parent( $axis, $context )   X-Ref
Handles the XPath parent axis.

This method handles the XPath parent axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_attribute( $axis, $context )   X-Ref
Handles the XPath attribute axis.

This method handles the XPath attribute axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_self( $axis, $context )   X-Ref
Handles the XPath self axis.

This method handles the XPath self axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_descendant( $axis, $context )   X-Ref
Handles the XPath descendant axis.

This method handles the XPath descendant axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_ancestor( $axis, $context )   X-Ref
Handles the XPath ancestor axis.

This method handles the XPath ancestor axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_namespace( $axis, $context )   X-Ref
Handles the XPath namespace axis.

This method handles the XPath namespace axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_following( $axis, $context )   X-Ref
Handles the XPath following axis.

This method handles the XPath following axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_preceding( $axis, $context )   X-Ref
Handles the XPath preceding axis.

This method handles the XPath preceding axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_following_sibling( $axis, $context )   X-Ref
Handles the XPath following-sibling axis.

This method handles the XPath following-sibling axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_preceding_sibling( $axis, $context )   X-Ref
Handles the XPath preceding-sibling axis.

This method handles the XPath preceding-sibling axis.

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_descendant_or_self( $axis, $context )   X-Ref
Handles the XPath descendant-or-self axis.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_axis_ancestor_or_self( $axis, $context )   X-Ref
Handles the XPath ancestor-or-self axis.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: array $axis Array containing information about the axis.
param: string $context Node from which starting the axis should
return: array This method returns an array containing all nodes

handle_function_last( $node, $arguments )   X-Ref
Handles the XPath function last.

This method handles the XPath function last.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_position( $node, $arguments )   X-Ref
Handles the XPath function position.

This method handles the XPath function position.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_count( $node, $arguments )   X-Ref
Handles the XPath function count.

This method handles the XPath function count.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_id( $node, $arguments )   X-Ref
Handles the XPath function id.

This method handles the XPath function id.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_name( $node, $arguments )   X-Ref
Handles the XPath function name.

This method handles the XPath function name.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_string( $node, $arguments )   X-Ref
Handles the XPath function string.

This method handles the XPath function string.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_concat( $node, $arguments )   X-Ref
Handles the XPath function concat.

This method handles the XPath function concat.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_starts_with( $node, $arguments )   X-Ref
Handles the XPath function starts-with.

This method handles the XPath function starts-with.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_contains( $node, $arguments )   X-Ref
Handles the XPath function contains.

This method handles the XPath function contains.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_substring_before( $node, $arguments )   X-Ref
Handles the XPath function substring-before.

This method handles the XPath function substring-before.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_substring_after( $node, $arguments )   X-Ref
Handles the XPath function substring-after.

This method handles the XPath function substring-after.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_substring( $node, $arguments )   X-Ref
Handles the XPath function substring.

This method handles the XPath function substring.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_string_length( $node, $arguments )   X-Ref
Handles the XPath function string-length.

This method handles the XPath function string-length.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_translate( $node, $arguments )   X-Ref
Handles the XPath function translate.

This method handles the XPath function translate.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_boolean( $node, $arguments )   X-Ref
Handles the XPath function boolean.

This method handles the XPath function boolean.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_not( $node, $arguments )   X-Ref
Handles the XPath function not.

This method handles the XPath function not.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_true( $node, $arguments )   X-Ref
Handles the XPath function true.

This method handles the XPath function true.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_false( $node, $arguments )   X-Ref
Handles the XPath function false.

This method handles the XPath function false.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_lang( $node, $arguments )   X-Ref
Handles the XPath function lang.

This method handles the XPath function lang.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_number( $node, $arguments )   X-Ref
Handles the XPath function number.

This method handles the XPath function number.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_sum( $node, $arguments )   X-Ref
Handles the XPath function sum.

This method handles the XPath function sum.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_floor( $node, $arguments )   X-Ref
Handles the XPath function floor.

This method handles the XPath function floor.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_ceiling( $node, $arguments )   X-Ref
Handles the XPath function ceiling.

This method handles the XPath function ceiling.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_round( $node, $arguments )   X-Ref
Handles the XPath function round.

This method handles the XPath function round.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

handle_function_text( $node, $arguments )   X-Ref
Handles the XPath function text.

This method handles the XPath function text.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $node Full path of the node on which the function
param: string $arguments String containing the arguments that were
return: mixed Depending on the type of function being processed this

prestr( $string, $delimiter )   X-Ref
Retrieves a substring before a delimiter.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $string String, from which the substring should be
param: string $delimiter String containing the delimiter to use.
return: string Substring from the original string before the

afterstr( $string, $delimiter )   X-Ref
Retrieves a substring after a delimiter.

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

author: Michael P. Mehl <mpm@phpxml.org>
param: string $string String, from which the substring should be
param: string $delimiter String containing the delimiter to use.
return: string Substring from the original string after the

display_error( $message )   X-Ref
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.

author: Michael P. Mehl <mpm@phpxml.org>
param: string $message Error message to be displayed.



Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7