|
I tried a much simpler experiment based on your code and I ran into a remarkable descrepancy.
It occurs for tags that have only attributes or are placeholders like <ttt/>
Using both Java and C#, I simply attempted to increment and decrement a level counter when entering startElement and leaving endElement.
The numbering of the levels remained consistent with Java and both the start and end callbacks fired as expected. When using the XmlTextReader from C# I was forced to rely on the XmlNodeType.Element and XmlNodeType.EndElement values produced by the call to Read(). What occurred surprised me.
It seems that tags like <ttt/> do not fire an EndElement change. If the tag was changed to <ttt></ttt> then the numbering match the outcome from using SAX with Java.
example: from C#
1 1
<b/> 2 2
2
2 1
If you might be interested I can email the code and example xml files.
Your article was very interesting and clearly written. What I got from this is that there are some very subtle "features" awaiting the person who attempts to translate code between Java and C#.
|