今天遇到一個特別XML
<?xml version="1.0" encoding="utf-8" ?>
<root>
<row sid="1234" n="AAA" dt="20101214" />
</root>
解讀方式
$doc = new DOMDocument();
$doc->formatOutput = true;
$doc->loadXML("以上那段XML字串");
$x = $doc->documentElement;
foreach($x->childNodes AS $item){
//print $item->nodeName."=".$item->nodeValue."<BR>";
foreach($item->attributes AS $row){
print $row->name ."=". $row->value."<BR>"
}
}
JavaScript方式(待.......)