Compact Framework SP3 (and I think also SP2 and SP1) XmlTextReader does not
handle !DOCTYPE and (maybe?) rdf elements. How can I get the XmlTextReader to
read these without issuing a NotSupportedException? Or at least to get past
these elements (and nested elements) with an Skip()? I've tried setting
xtr.XmlResolver = null; but it doesn't change the functionality. I'm still
getting the exception.
In a recent MSDN MVP Chat, I was pointed to http://tinyurl.com/5n827 where
it says "Support for parsing DTDs was removed to increase perf and size. It
was considered for .NetCF v2 but was cut again in favor of XmlSchema support."
I'm not asking for XML validation, just a usable way to read the rest of the
XML, while ignoring the DOCTYPE entity. It would be great if I can just
xtr.Skip(), or xtr.MoveToContent() around the DOCTYPE. In my code, if I get
an Exception, I currently try to xtr.Skip() around it, but with SP3, this
creates another NotSupportedException. This may have worked at one time with
SP1 or SP2, I'm not sure. The various flavors of SP1, 2, 3 handle this in
slightly different ways, I think. But I haven't fully characterized this. I
just want this working with SP3 so I can suggest to my users to upgrade, if
necessary.
In desperation, along with xtr.XmlResolver = null; I've also tried
xtr.Namespaces = false; and xtr.Normalization = false;
Obviously to those who are more familiar with how XmlTextReader works, you
may notice that the above properties have nothing to do with my problem.
I have already had to kludge the Encoding because XmlTextReader does not
provide a way to extend the supported text encodings. I hope that I can get
around this DOCTYPE issue easily. I'm considering implementing my own XML
parser. It would be a shame if this becomes necessary. Parsing out the
encoding line is relatively easy (read until the first ">". Parsing the
DOCTYPE is much more difficult because it can include optional nested
elements.
While the XmlTextReader helped me greatly in getting my program going, it is
now in the way of reading some XML documents.
To email me: change to d from delicacy and yahoo from yahoozier.