
Example DOM parsing XML
By: a guest on
Feb 6th, 2012 | syntax:
PHP | size: 0.32 KB | hits: 57 | expires: Never
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->loadXML($xml_post);
$msgids = $dom->getElementsByTagName('custom-attribute');
foreach($msgids as $k=>$v){
$tmp_msg = array();
$tmp_msg['attr_value'] = $v->getAttribute('attribute-id');
$tmp_msg['tag_value'] = $v->item(0)->nodeValue;
$msgid[] = $tmp_msg;
}