sktt Posted November 25, 2010 Share Posted November 25, 2010 Hi, Im trying to grab some data from a XML generated by an external server. I know how to grab from XML without attributes, but I cant seem to wrap my head around the structure of this file. What would be easiest way to get the value of the "dbnr" field? Part of the XML file: <data> <location> <field name="id" format="Long">xxxxxx</field> <field name="dbnr" format="Long">xxxxxx</field> <field name="jobnr" format="Long">xxxxxx</field> <field name="job_type" format="String" maxlen="50">xxxxxx</field> <field name="job_category" format="String" maxlen="50">xxxxxx</field> </location> </data> Quote Link to comment Share on other sites More sharing options...
MrXHellboy Posted November 25, 2010 Share Posted November 25, 2010 preg_match_all('@<field name="dbnr" format="Long">(.*)<\/field>@', $a, $matches); echo '<pre>'. print_r($matches, true).'</pre>'; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.