Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If we add some xml into a $-variable:

Code Block
do(
   $xml = 
   '<?xml version="1.0" encoding="ISO-8859-1"?><store><thing category="X1"><name>Item1</name><price>15.00</price></thing><thing category="X2"><name>Item2</name><price>17.99</price></thing></store>',

   xmlToItems($xml, "/store/thing/price")

)

/* 
 * Where the xml would expanded would look like the below:
 *
   '<?xml version="1.0" encoding="ISO-8859-1"?>
   <store>
      <thing category="X1">
         <name>Item1</name>
         <price>15.00</price>
      </thing>
      <thing category="X2">
         <name>Item2</name>
         <price>17.99</price>
      </thing>
   </store>"',
 *
  xmlToItems($xml, "/store/thing/price")

)*/

Returns the values (in a list):

...