Mark Fussell recently authored a very comprehensive article on the MSDN XML developer center that details the improvements to the XML APIs in System.Xml and the .NET Framework for version 2.0. This is the first in a series of articles that will provide an in-depth review of the forthcoming V2.0 release for the System.Xml namespace and the XML support in ADO.NET. Mark did a terrific job with this and I think reading it is definitely worth your time (along with going thru the XML gems that are up on the developer center). Well the question, I bet that many .NET Compact Framework (CF) developers are asking is “exactly what will be supported on NETCF and what will not be available?” I thought it will be a good idea to review his article from a CF standpoint and let you guys know ahead of time what functionality we plan to provide (at least in Beta 1) and receive feedback from you guys.
Mark structures the article by doing a top ten feature count down for System.Xml. Over the next few day's I'll be going through each of the features and give you a Yes (It's in CF Beta 1), No (We do not plan to support it) and a Maybe (We are considering it for v2.0 but it did not make it into Beta).
Coming in at No 10 feature is Static Creation Methods on XmlReader and XmlWriter The answer to this is “YES” .... you bet... in keeping with our model of maintaining consistency between the development story on both desktop and device we definitely thought this was one area we could not afford to deviate from the desktop story.
Yes this means (with our schema validation support introduced in V2.0) creating a reader that performs validation and strips insignificant whitespace from the document at the same time becomes as simple as this code snippet (which I pulled from the article).
XmlReaderSettings settings = new XmlReaderSettings();
settings.XsdValidate = true;
settings.IgnoreWhitespace = true;
XmlReader reader = XmlReader.Create("books.xml",settings);
Those of you who played with our V1 product remember that we did not have support for the XmlValidatingReader thus you could not perform run time data validation (against a schema) with your reader. While we do not provide a publicly available XmlValidatingReader the piece of code above does exactly just what you'll like an XmlValidatingReader to do. The caveat here though is that CF only supports Xsd Validation (no we do not plan to support DTD or XDR validation). As a matter of fact if you attempt to create a Reader over an XML document that contains a DTD you'll get a NotSupportedException (just like the V1 behavior). One thing to note is that in V1 the reader simply ignored entity references but in V2.0 a NotSupportedException will be thrown each time we encounter an entity reference.
I'll be going through the remaining 9 features over the next few days and I hope to get feedback from you guys. I highly recommend that you read the article on the developer center as these posts will only make sense if you've read the article.