<?php
The first thing to do is to build a DOMDocument object
$xml = new DOMDocument ();
Loading an XML file
$xml->load ("3.xml");
Get all the post labels
$postDom = $xml->getelementsbytagname ("PROPERTIES");
Print_r ($postDom);
Echo ' <br> ';
Looping through post labels
foreach ($postDom as $post) {//Get title Tag node
$id = $post->getelementsbytagname ("Wcmmetatablehcn_services_supportsid"); /** * To get the id attribute of the title tag, go to section two * 1. Gets a list of all the attributes in the title, which is $title->item (0)->attributes * 2. Gets the attribute of the ID in the title, because it is in the first place so with item (0) * Small hint: * If the value of the attribute can be used with item (*)->nodevalue * If the tag of the attribute can be used with item (*)->nodename * You can use item (*)->nodetype * * If the type of attribute is taken.
$dataid = $post->getelementsbytagname ("METADATAID");
$time = $post->getelementsbytagname ("Crtime");
$title = $post->getelementsbytagname ("DocTitle");
$sub = $post->getelementsbytagname ("Bigtxt");
echo "Id:". $id->item (0)->nodevalue. "< br/>";
echo "Time:". $time->item (0)->nodevalue. "< br/>";
echo "Title:". $title->item (0)->nodevalue. "< br/>";
echo "Sub:". $sub->item (0)->nodevalue. "< br/>";
}
?>