0

HI , all ..

I need to parse an DWF file using PHP, which looks like an xml file . 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 ..

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks meder, i have used simplexml but the format here is different its not like <title>My Title</title> its like <title value="sds" /> so how do I get value of this sds ?
1

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.

2 Comments

Thanks Artefacto, Any examples plz
@ravi See the manual, there are examples there (the linked pages include even a link that says "examples").

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.