HI , all ..
I need to parse an DWF file using PHP, which looks like an xml fi开发者_运维百科le . example :
<dwf:Feature id="BXV1D8mWfkGOqXbyoIxQ2g">
<dwf:Properties id="hZBTdWkXKEuhGWAeTpMOUA">
<dwf:Property name="NO" value="0" />
<dwf:Property name="DESCRIPTION" value="Testing" />
<dwf:Property name="DATE" value="06/25/09" />
<dwf:Property name="BY" value="SJ" />
<dwf:Property name="CHK" value="JF" />
</dwf:Properties>
How to parse this.. I am new to PHP xml parsing ..
Use simplexml, like so: http://blog.sherifmansour.com/?p=302
Would be nice if you provided the xml prolog as well. The children
method accepts a namespace prefix if you need to use that.
You can use DOMDocument. To deal with namespaces (which you have) take a look at the methods that end in NS
.
An alternative is SimpleXML. The SimpleXMLElement::children
methods accepts a namespace or namespace prefix.
精彩评论