how to process an XML NODE in PHP -


Here's the simple code. I just want to know how the $ reader-> Expand ();

   open ("data.xml") (die ("failed to open 'data.xml')";} while ($ reader-> read ()) {$ Node = $ reader-> Expanded (); // How to process this node now?} $ Reader- & gt; off ();? & Gt;   < / Div> 

  & lt; php $ xml = & lt; & lt; & lt; XML & gt; Xml version = "1.0" encoding = "UTF-8" standalone = "no"? & Gt; Parents xmlns: dc = "myns" & gt; & lt; DC: child & gt; & lt; DC: one & Gt; & lt; / DC: A & gt; & lt; DC: p & gt; B & lt; / DC: p & gt; & lt; / DC: Children & gt; DC: Children & Gt; & Lt; dc: a & gt; c & lt; / dc: a & gt; dc: p & gt; d & lt; / dc: p & gt; & lt; / dc: child & gt; & Lt; dc: child & gt; & lt; dc: one & gt; e & lt; / dc: a & gt; dc: p & gt; f  XML ($ XML); While ($ reader-> read ()) {switch ($ reader- & gt; nodeType) {case static ('XMLREADER :: ELEMENT'): if ($ reader-> name == 'dc: child ') {// db in var_dump ($ reader-> readInnerXml ()); } break; }} $ Reader-> Close ();   

Output:

  string (63) "& lt; dc: a xmlns: dc =" myNS ">     "string (63)" & lt; dc: a xmlns: dc = "myns "& Gt; c & lt; / dc: a & gt; dc: B xmlns: dc =" myns "> D & lt; / dc: b & gt;" string (63) "& lt ; Dc: a xmlns: dc = "myns"> E & lt; / dc: a & gt; & lt; dc: b Xmlns: dc = "myns" & gt; f & lt; / dc: b & Gt; "string (63)" & lt; dc: a xmlns: dc = "myns"> G    

Comments