[Mono-list] XmlTextReader: MS compatibility, or W3C conformance?

Atsushi Eno atsushi@ximian.com
Fri, 09 Jul 2004 12:31:49 +0900


On bugzilla we (Ian and I) were discussing on XmlTextReader conformance
to XML specification. MS XmlTextReader is buggy since it accepts
XML declaration as element content (that violates W3C XML specification
section 3 Logical Structures).

However, there is another discussion that it is useful that new
XmlTextReader (xmlText, XmlNodeType.Element, null) accepts XML declaration.

Well, I agree that

	- that error-prone XmlTextReader might be useful (especially
	  for people who already depends on that behavior).
	- we did not always reject Microsoft badness; for example
	  we are copying System.Xml.XmlCDataSection that violates
	  W3C DOM interface hierarchy (!)

So it is case by case. I believe we should not allow such use of
XmlTextReader, but I understand what Ian wants me to do. The "fix"
can be very easily done.

I don't think it is major problem. Users can easily fix this problem
by calling MoveToContent(), or by skipping XmlDeclaration node with
Read() method (well, to call Read() safely, users have to check if
the reader state is Initial or not).

Any comments?

Atsushi Eno