Hi, Please find my first attempt at a patch attached. At this point I'm hoping to ensure that I'm editing the right files, and get some pointers.
I find a lot of people get confused when using SimpleXML and they first run into a file that uses hyphens in the names of elements, so I added a simple explanation of how that is handled, and why it is a special case. paul -- Paul Reinheimer Zend Certified Engineer
Index: reference.xml =================================================================== RCS file: /repository/phpdoc/en/reference/simplexml/reference.xml,v retrieving revision 1.21 diff -u -r1.21 reference.xml --- reference.xml 20 Jun 2007 22:25:24 -0000 1.21 +++ reference.xml 7 Sep 2007 21:10:39 -0000 @@ -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> @@ -88,6 +91,24 @@ </programlisting> </example> </para> + <para> + Accesing elements within an XML document that contain characters not permitted under + PHP's naming convention (e.g. the hyphen) can be accomplished by encapsualting the + element name within curly braces and the apostraphe. + <example> + <title>Getting <literal><line></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>