Question

I am writing custom OFX -> XML parser on c#.

Currently I am using standard XMLTextReader.

The ofx format might have following structure:

<STATUS>
    <CODE>0
    <SEVERITY>INFO
</STATUS>

The thing is if the element is text element then previous one doesn't have closing tag. I want to add it. BUT I am having:

The 'SEVERITY' start tag on line 7 position 10 does not match the end tag of 'STATUS'. Line 8, position 9.

But if I try-catch while(reader.Read()) block, then I get proper structure but only till my </SEVERITY> tag.

Is there any way to ignore such Exceptions?

Was it helpful?

Solution

With "XML" this broken, the only sure way is to use a TextReader and forget about pretending it is structured in any meaningful way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top