Can explain this block Code to me PHP XML DOMDocument Syntax -
I am currently learning different ways using XML document tags, using the php DOMDocument object, I Next: go Get a list of by itself. If the state is: To tell you, check, which uses all the method to call simultaneously. < $ note, you have left Understand foreach to loop through the tag, but
$ element-> Items (0) - & gt; Child nodes-> Items (0) - & gt; Node Vela is not quite clear Is anyone can tell me in detail? Thank you.
& lt ;? Php $ xmlDoc = new DOMDocument (); $ XmlDoc- & gt; Load ('StudentData.xml'); $ StudentRoot = $ xmlDoc- & gt; GetElementsByTagName ('student'); ($ I = $; $ i & lt; ($ studentRoot- & gt; Length); $ i ++) {$ firstNameTags = $ studentRoot- & gt; Items ($ i) - & gt; GetElementsByTagName ('first name'); Echo $ First Name Tag- & gt; Items (0) - & gt; Child nodes-> Items (0) - & gt; Node vale '& Lt; Br / & gt; '; } / * So simple and clear to understand! * / Foreach ($ student $$ root as node) {/ * each & lt; Students & gt; Tag it as a separate node, move it into the child's node, and for each child, echo the text content * / foreach ($ node-> as childNodes $$) {echo $ child- & Gt; TextContent & Lt; Br / & gt; '; }}? & Gt;
$ element-> Items (0) - & gt; ChildNodes- & Gt; Items (0) - & gt;
$ firstNameTags = $ studentRoot- & gt; Items ($ i) - & gt; GetElementsByTagName ('first name'); $ FirstNameTags-> ...
- & gt; A reference before item (0)
$ elements because it is zero-indexed, so
-> Index <>
-> In the list in the list item (0) ChildNodes
referenced by that
$ Elements node> - & gt; Item (0) above is not a
() , this is a (read only)
DOMNodeList property .
Again, get the first node in the list of hair nodes by index .
- & gt; Nodevela
$ obj-> gt; Method () - & gt; Method () - & gt; Sahay
s , but this indicates That is one or more possible by the conference . Then the
$ element element will be zero or one , the
$ element can be zero, one or more of the $ element in a collection of $ .
Comments
Post a Comment