cvs: phpdoc /en/reference/simplexml reference.xml

From: Date: Mon, 10 Sep 2007 21:24:57 +0000
Subject: cvs: phpdoc /en/reference/simplexml reference.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-6@lists.php.net to get a copy of this message
preinheimer Mon Sep 10 21:24:57 2007 UTC Modified files: /phpdoc/en/reference/simplexml reference.xml Log: added some details on invalid characters in XML names, changed a few cdata lines http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/simplexml/reference.xml?r1=1.21&r2=1.22&diff_format=u Index: phpdoc/en/reference/simplexml/reference.xml diff -u phpdoc/en/reference/simplexml/reference.xml:1.21 phpdoc/en/reference/simplexml/reference.xml:1.22 --- phpdoc/en/reference/simplexml/reference.xml:1.21 Wed Jun 20 22:25:24 2007 +++ phpdoc/en/reference/simplexml/reference.xml Mon Sep 10 21:24:57 2007 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.21 $ --> +<!-- $Revision: 1.22 $ --> <!-- Purpose: xml --> <!-- Membership: bundled, external --> @@ -61,6 +61,9 @@ scripting language? All is revealed in this thrilling horror spoof of a documentary. </plot> + <great-lines> + <line>PHP solves all my web problems</line> + </great-lines> <rating type="thumbs">7</rating> <rating type="stars">5</rating> </movie> @@ -89,13 +92,33 @@ </example> </para> <para> + Accessing elements within an XML document that contain characters not permitted under + PHP's naming convention (e.g. the hyphen) can be accomplished by encapsulating the + element name within curly braces and the apostrophe. + <example> + <title>Getting <literal>&lt;line&gt;</literal></title> + <programlisting role="php"> +<![CDATA[ +<?php +include 'example.php'; + +$xml = new SimpleXMLElement($xmlstr); + +echo $xml->movie->{'great-lines'}->line;; // "PHP solves all my web problems" +?> +]]> + </programlisting> + </example> + </para> + <para> <example> <title>Accessing non-unique elements in SimpleXML</title> <simpara> When multiple instances of an element exist as children of a single parent element, normal iteration techniques apply. </simpara> - <programlisting role="php"><![CDATA[ + <programlisting role="php"> +<![CDATA[ <?php include 'example.php';

« previous php.doc.cvs (#6) next »