From f7fd134d6c5ad341cd49724134d2a9e549f8f72e Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Tue, 16 Jan 2007 01:05:32 +0000 Subject: [PATCH] Fix new style implementation Add missing sections / parameters git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@227337 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../simplexml-element-addAttribute.xml | 9 +- .../simplexml-element-attributes.xml | 48 ++++++++-- .../functions/simplexml-element-children.xml | 61 +++++++++--- .../functions/simplexml-element-construct.xml | 18 +++- .../functions/simplexml-element-getName.xml | 3 +- .../simplexml-element-getNamespaces.xml | 6 +- ...mplexml-element-registerXPathNamespace.xml | 12 ++- .../functions/simplexml-element-xpath.xml | 39 ++++++-- .../functions/simplexml-import-dom.xml | 72 +++++++++++--- .../functions/simplexml-load-file.xml | 94 ++++++++++++++----- .../functions/simplexml-load-string.xml | 78 ++++++++++++--- 11 files changed, 351 insertions(+), 89 deletions(-) diff --git a/reference/simplexml/functions/simplexml-element-addAttribute.xml b/reference/simplexml/functions/simplexml-element-addAttribute.xml index 82ebed47a5..ffc02aea3d 100644 --- a/reference/simplexml/functions/simplexml-element-addAttribute.xml +++ b/reference/simplexml/functions/simplexml-element-addAttribute.xml @@ -1,5 +1,5 @@ - + SimpleXMLElement->addAttribute() @@ -55,6 +55,13 @@ + + &reftitle.returnvalues; + + &return.void; + + + &reftitle.examples; diff --git a/reference/simplexml/functions/simplexml-element-attributes.xml b/reference/simplexml/functions/simplexml-element-attributes.xml index b631de295d..07aa66d273 100644 --- a/reference/simplexml/functions/simplexml-element-attributes.xml +++ b/reference/simplexml/functions/simplexml-element-attributes.xml @@ -1,12 +1,13 @@ - + SimpleXMLElement->attributes() Identifies an element's attributes - - Description + + + &reftitle.description; SimpleXMLElement @@ -19,6 +20,40 @@ This function provides the attributes and values defined within an xml tag. &simplexml.iteration; + + + + &reftitle.parameters; + + + + ns + + + An optional namespace for the retrieved attributes + + + + + is_prefix + + + Default to &false; + + + + + + + + + &reftitle.returnvalues; + + + + + + &reftitle.examples; Interpret an XML string @@ -26,7 +61,7 @@ + 1 XML; @@ -38,9 +73,7 @@ foreach($xml->foo[0]->attributes() as $a => $b) { ?> ]]> - - This script will display: - + &example.outputs; + + SimpleXMLElement->children() Finds children of given node - - Description + + + &reftitle.description; SimpleXMLElement @@ -20,9 +21,43 @@ follows normal iteration rules. &simplexml.iteration; - - Traversing a <literal>children()</literal> pseudo-array - + + + + &reftitle.parameters; + + + + ns + + + + + + + is_prefix + + + Default to &false; + + + + + + + + + &reftitle.returnvalues; + + + + + + &reftitle.examples; + + + Traversing a <literal>children()</literal> pseudo-array + children() as $second_gen) { } ?> ]]> - - - This script will output: - - + + &example.outputs; + - - + + + + + SimpleXMLElement->__construct() @@ -21,7 +21,7 @@ - Creates a new SimpleXMLElement object + Creates a new SimpleXMLElement object. @@ -57,6 +57,20 @@ + + ns + + + + + + + is_prefix + + + + + diff --git a/reference/simplexml/functions/simplexml-element-getName.xml b/reference/simplexml/functions/simplexml-element-getName.xml index a863f5b5ad..b8c4ec880c 100644 --- a/reference/simplexml/functions/simplexml-element-getName.xml +++ b/reference/simplexml/functions/simplexml-element-getName.xml @@ -1,5 +1,5 @@ - + SimpleXMLElement->getName() @@ -51,6 +51,7 @@ foreach ($sxe->children() as $child) + + SimpleXMLElement->getNamespaces() @@ -65,13 +65,13 @@ XML; $sxe = new SimpleXMLElement($xml); -$namespaces = $sxe->getNamespaces(TRUE); +$namespaces = $sxe->getNamespaces(true); var_dump($namespaces); ?> ]]> - &example.outputs.similar; + &example.outputs; - + SimpleXMLElement->registerXPathNamespace() @@ -54,6 +54,13 @@ + + &reftitle.returnvalues; + + &return.success; + + + &reftitle.examples; @@ -88,8 +95,7 @@ $sxe = new SimpleXMLElement($xml); $sxe->registerXPathNamespace('c', 'http://example.org/chapter-title'); $result = $sxe->xpath('//c:title'); -foreach ($result as $title) -{ +foreach ($result as $title) { echo $title . "\n"; } diff --git a/reference/simplexml/functions/simplexml-element-xpath.xml b/reference/simplexml/functions/simplexml-element-xpath.xml index 7d5d450a43..1eca7abe32 100644 --- a/reference/simplexml/functions/simplexml-element-xpath.xml +++ b/reference/simplexml/functions/simplexml-element-xpath.xml @@ -1,12 +1,13 @@ - + SimpleXMLElement->xpath() Runs XPath query on XML data - - Description + + + &reftitle.description; SimpleXMLElement @@ -17,8 +18,34 @@ The xpath method searches the SimpleXML node for children matching the XPath path. - It always returns an array of SimpleXMLElement objects. + + + + &reftitle.parameters; + + + + path + + + An XPath path + + + + + + + + + &reftitle.returnvalues; + + Always returns an array of SimpleXMLElement objects. + + + + + &reftitle.examples; Xpath @@ -55,9 +82,7 @@ while(list( , $node) = each($result)) { ?> ]]> - - This script will display: - + &example.outputs; - + simplexml_import_dom @@ -13,20 +13,55 @@ stringclass_name - This function takes a node of a DOM document and makes it into a SimpleXML node. This new object can - then be used as a native SimpleXML element. If any errors occur, - it returns &false;. + then be used as a native SimpleXML element. - - - - Import DOM - + + + + &reftitle.parameters; + + + + node + + + A DOM Element node + + + + + class_name + + + You may use this optional parameter so that + simplexml_load_string will return an object of + the specified class. That class should extend the + SimpleXMLElement class. + + + + + + + + + &reftitle.returnvalues; + + Returns a SimpleXMLElement or &false; on failure. + + + + + &reftitle.examples; + + + Importing DOM + loadXML('blah'); if (!$dom) { echo 'Error while parsing the document'; @@ -38,13 +73,20 @@ $s = simplexml_import_dom($dom); echo $s->book[0]->title; // blah ?> ]]> - - - - See also - dom_import_simplexml. + + + + + &reftitle.seealso; + + + dom_import_simplexml + + + + + simplexml_load_file @@ -18,32 +18,82 @@ boolis_prefix - This function will convert the well-formed XML document in the file - specified by filename to an object - of class SimpleXMLElement. If any errors occur during file - access or interpretation, the function returns &false;. + Convert the well-formed XML document in the given file to an object. + + + + &reftitle.parameters; - You may use the optional class_name parameter so - that simplexml_load_file will return an object of - the specified class. That class should extend the - SimpleXMLElement class. + + + filename + + + Path to the XML file + + + + Libxml 2 unescapes the URI, so if you want to pass e.g. + b&c as the URI parameter a, + you have to call + simplexml_load_file(rawurlencode('http://example.com/?a=' . + urlencode('b&c'))). Since PHP 5.1.0 you don't need to do + this because PHP will do it for you. + + + + + + class_name + + + You may use this optional parameter so that + simplexml_load_string will return an object of + the specified class. That class should extend the + SimpleXMLElement class. + + + + + options + + + Since PHP 5.1.0 and Libxml 2.6.0, you may also use the + options parameter to specify additional Libxml parameters. + + + + + ns + + + + + + + is_prefix + + + + + + + + + + &reftitle.returnvalues; - Since PHP 5.1.0 and Libxml 2.6.0, you may also use the - options parameter to specify additional Libxml parameters. + Returns an object of class SimpleXMLElement with + properties containing the data held within the XML document. On errors, it + will return &false;. - - - Libxml 2 unescapes the URI, so if you want to pass e.g. - b&c as the URI parameter a, - you have to call - simplexml_load_file(rawurlencode('http://example.com/?a=' . - urlencode('b&c'))). Since PHP 5.1.0 you don't need to do - this because PHP will do it for you. - - + + + + &reftitle.examples; Interpret an XML document diff --git a/reference/simplexml/functions/simplexml-load-string.xml b/reference/simplexml/functions/simplexml-load-string.xml index a09c2124a1..264cc538d6 100644 --- a/reference/simplexml/functions/simplexml-load-string.xml +++ b/reference/simplexml/functions/simplexml-load-string.xml @@ -1,5 +1,5 @@ - + simplexml_load_string @@ -18,22 +18,72 @@ boolis_prefix - This function will take the well-formed xml string - data and return an object of class - SimpleXMLElement with properties containing the data held - within the xml document. If any errors occur, it returns &false;. + Takes a well-formed XML string and returns it as an object. + + + + &reftitle.parameters; - You may use the optional class_name parameter so - that simplexml_load_string will return an object of - the specified class. That class should extend the - SimpleXMLElement class. + + + data + + + A well-formed XML string + + + + + class_name + + + You may use this optional parameter so that + simplexml_load_string will return an object of + the specified class. That class should extend the + SimpleXMLElement class. + + + + + options + + + Since PHP 5.1.0 and Libxml 2.6.0, you may also use the + options parameter to specify additional Libxml parameters. + + + + + ns + + + + + + + is_prefix + + + + + + + + + + &reftitle.returnvalues; - Since PHP 5.1.0 and Libxml 2.6.0, you may also use the - options parameter to specify additional Libxml parameters. + Returns an object of class SimpleXMLElement with + properties containing the data held within the xml document. On errors, it + will return &false;. + + + + &reftitle.examples; Interpret an XML string @@ -58,9 +108,7 @@ var_dump($xml); ?> ]]> - - This script will display: - + &example.outputs;