[Mono-list] parsing an incomplete xml

Krisztian PIFKO monsta@mail.tvnet.hu
Mon, 19 Jul 2004 10:54:55 +0200

On Mon, 2004-07-19 at 01:46 -0400, Chris Bruner wrote:
> I believe that the xml spec says that parsing should stop as soon as an error 
> occurs. (This includes begin incomplete).

yes i fear this is the correct approach for all of the parsers.

> Therefore the only way you could "fix" it would be to have a completion string 
> built up. So that you would mark every tag that get's added, and unmark them 
> as they are done. eg <tag></tag> Also tags that end with /> can be thought of  
> as finished.  Then when you find the stream has died, you just complete all 
> the tags. 

i do something like this, i handle the initial incomplete part by hand
and then parse the properly closed internal parts as they arrive.

> The downside is that this means you are doing the job of parsing the xml 
> before the parser. Seems like a lot of work.

yes, but maybe something useful will grow out of this. ;)


Krisztian PIFKO