XML Parsing from Non-XML Document

Posted by Neel Basu on Stack Overflow See other posts from Stack Overflow or by Neel Basu
Published on 2011-01-01T16:33:12Z Indexed on 2011/01/02 18:53 UTC
Read the original article Hit count: 982

Filed under:
|
|
|
|

in a xml/non-xml File there may exist some XML Block that I need to parse and replace with some other string.. The Scenario is something like this..

Some Text
<cnt:use name="abc" call="xyz">
   <cnt:param name="x" value="2" />
</cnt:use>
Some Text

There is no guarantee that the document is a proper XML document. (there may exist some unclosed Tags. or some other common mistakes that a Stupid people can make while typing HTML). so I can't use SAX or DOM. I can't even pass it to XSLT (am I right ?). So Whats the best way to extract the <cnt:*> part from the non-xml Document. and read it then replace with something else.

© Stack Overflow or respective owner

Related posts about php

Related posts about Xml