This is a discussion on using DomXML and getting the attribute tag within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Using PHP 4.4.8 and DomXML , how can I go about reading the following XML content? I don't ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Using PHP 4.4.8 and DomXML , how can I go about reading the following
XML content? I don't need help reading the file, I need help obtaining the "value" attribute of each element within the topmost element. <?xml version="1.0" encoding="UTF-8"?> <CustomStyle> <StyleFormat.foreground value = "0xFFFFFF" /> <StyleFormat.background value = "0xFFFFFF" /> <TabTextColor value = "0xFFFFFF" /> </CustomStyle> /** Code Start **/ $noderoot = $dom->document_element(); $childnodes = $noderoot->child_nodes(); // build the array and output the elements foreach ($childnodes as $value) { echo $value->tagname . " : " . $value->get_content() . " : ". $value->get_attribute['value'] ."<br>"; $nodeArray[$value->tagname] = $value->get_content(); } /** Code Finish **/ |
![]() |
| Thread Tools | |
| Display Modes | |
|
|