Is there a modified Expat to handle XML that is not well formed?

T

tvmaly

Has anyone ever modified Expat to handle xml that is not well formed?
Specifically, I am looking at XML that does not have a root element.
It also may have erroneous quotes within quotes.

Best Regards

Ty
 
R

Richard Tobin

Has anyone ever modified Expat to handle xml that is not well formed?
Specifically, I am looking at XML that does not have a root element.
It also may have erroneous quotes within quotes.

One approach to handling documents with no root element - or
equivalently, multiple root elements - is to treat them as external
entities. Create a file (or a string) that declares an external
entity with the URI of the document, and a single element containing a
reference to it. Then parse that, and remove the root element.

This doesn't work if your multi-element document itself contains a DTD
or an XML declaration with a standalone declaration or without an
encoding declaration.

-- Richard
 
J

Joe Kesselman

Has anyone ever modified Expat to handle xml that is not well formed?
Specifically, I am looking at XML that does not have a root element.
It also may have erroneous quotes within quotes.

Why not just fix whatever generated this not-quite-XML in the first
place? Tolerating bad documents rather than trying to educate the users
was one of the browser world's worst mistakes...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top