From 19c403ea63c86a25b7b1249de5aba30a8ee1c231 Mon Sep 17 00:00:00 2001 From: Paul Reinheimer Date: Mon, 10 Sep 2007 21:24:57 +0000 Subject: [PATCH] added some details on invalid characters in XML names, changed a few cdata lines git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@242390 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/simplexml/reference.xml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/reference/simplexml/reference.xml b/reference/simplexml/reference.xml index a7b71e2f07..1969e12d6a 100644 --- a/reference/simplexml/reference.xml +++ b/reference/simplexml/reference.xml @@ -1,5 +1,5 @@ - + @@ -61,6 +61,9 @@ $xmlstr = << + + PHP solves all my web problems + 7 5 @@ -84,6 +87,25 @@ $xml = new SimpleXMLElement($xmlstr); echo $xml->movie[0]->plot; // "So this language. It's like..." ?> +]]> + + + + + 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. + + Getting <literal><line></literal> + +movie->{'great-lines'}->line;; // "PHP solves all my web problems" +?> ]]> @@ -95,7 +117,8 @@ echo $xml->movie[0]->plot; // "So this language. It's like..." When multiple instances of an element exist as children of a single parent element, normal iteration techniques apply. - +