SHARE
TWEET

Example DOM parsing XML

a guest Feb 6th, 2012 62 Never
  1. $dom = new DOMDocument('1.0', 'UTF-8');
  2. $dom->loadXML($xml_post);
  3. $msgids = $dom->getElementsByTagName('custom-attribute');
  4. foreach($msgids as $k=>$v){
  5.     $tmp_msg = array();
  6.     $tmp_msg['attr_value'] = $v->getAttribute('attribute-id');
  7.     $tmp_msg['tag_value'] = $v->item(0)->nodeValue;
  8.     $msgid[] = $tmp_msg;
  9. }
RAW Paste Data
Top