* XML Classes Status and Tasks ** Abstract XML library is used by several areas of Mono such as ADO.NET and XML Digital Signature (xmldsig). Here I write about System.Xml.dll and related tools. This page won't include any classes which are in other assemblies such as XmlDataDocument. Note that current corlib has its own XML parser class (Mono.Xml.MiniParser). Basically System.XML.dll feature is almost finished, so I write this document mainly for bugs and improvement hints. ** Status *** System.Xml namespace **** Document Object Model (Core) DOM implementation has finished and our DOM implementation scores better than MS.NET as to the NIST DOM test results (it is ported by Mainsoft hackers and in our unit tests). **** Xml Writer Here XmlWriter almost equals to XmlTextWriter. If you want to see another implementation, check XmlNodeWriter.cs and DTMXPathDocumentWriter.cs in System.XML sources. XmlTextWriter is completed, though it looks a bit slower than MS.NET (I tried 1.1). **** XmlResolver XmlUrlResolver is implemented. XmlSecureResolver, which is introduced in MS .NET Framework 1.1 is basically implemented, but it requires CAS (code access security) feature. We need to fixup this class after ongoing CAS effort works. You might also be interested in some improved implementations which resides in Mono.Xml.Ext.dll. [2.0] XmlDataSourceResolver is not implemented as yetvanished. **** XmlNameTable NameTable is implemented, but also needs performance improvement. Optimization hackings are welcome. There is also a bugzilla entry for this matter. **** XML Reader XmlTextReader, XmlNodeReader and XmlValidatingReader are almost finished. XmlTextReader and XmlValidatingReader should be faster than now. Currently XmlTextReader looks nearly twice as slow as MS.NET, and XmlValidatingReader (which uses this slow XmlTextReader) looks nearly three times slower. (Note that XmlValidatingReader wouldn't be so slow as itself. It uses schema validating reader and dtd validating reader.) **** Some Advantages The design of Mono's XmlValidatingReader is radically different from that of Microsoft's implementation. Under MS.NET, DTD content validation engine is in fact simple replacement of XML Schema validation engine. Mono's DTD validation is designed fully separate and does validation as normal XML parser does. For example, Mono allows non-deterministic DTD. Another advantage of this XmlValidatingReader is support for *any* XmlReader. Microsoft supports only XmlTextReader (this bug is fixed in .NET 2.0 beta, taking shape of XmlReader.Create()). I added extra support interface named "IHasXmlParserContext", which is considered in XmlValidatingReader.ResolveEntity(). This is now made as internal interface. Microsoft failed to design XmlReader so that XmlReader cannot be subtree-pluggable (i.e. wrapping use of other XmlReader) since XmlParserContext shoud be supplied for DTD information support (e.g. entity references cannot be expanded) and namespace manager. (In .NET 2.0, Microsoft also supported similar to IHasXmlParserContext, named IXmlNamespaceResolver, but it still does not provide DTD information.) We also have RELAX NG validating reader (described later). *** System.Xml.Schema **** Summary Basically it is completed. You can test how current schema validation engine is complete (incomplete) by using standalone test module (see mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests). At least in my box, msxsdtest fails only 30 cases with bugfixed catalog - this score is better than that of Microsoft implementation. But instead, we need performance boost. There should be many points to improve schema compilation and validation. **** Schema Object Model Completed, except for some things to be fixed: **** Validating Reader Basically this is implemented and actually its feature is complete, but I have only did validation feature testing. So we have to write more tests on properties, methods, and events (validation errors). *** System.Xml.Serialization Lluis Sanchez is the maintainer of this namespace (as well as System.Web.Services). XmlSerializer is almost finished and is on bugfix phase. However, we appliciate more tests. Please try And if any problems were found, please file it to bugzilla. Lluis also built interesting standalone test system placed under mcs/class/System.Web.Services/Test/standalone. You might also interested in "genxs", which enables you to create custom XML serializer. See "tools" section discussed later. There is also "sgen" that is introduced in .NET 2.0. *** System.Xml.XPath and System.Xml.Xsl There are two XSLT implementations. One and historical implementation is based on libxslt (aka Unmanaged XSLT). Now we uses fully implemented and managed XSLT by default. To use Unmanaged XSLT, set MONO_UNMANAGED_XSLT environment value (any value is acceptable). As for Managed XSLT, we support msxsl:script. It would be nice if we can support EXSLT. Microsoft has tried to do some of them, but it is not successful because of System.Xml.Xsl design problem: So if we support EXSLT, it has to be done inside our System.XML.dll. Microsoft developers are also aware of this problem and some of them wish to have EXSLT support in WinFX (not whidbey). If anyone is interested in it, it would be nice. Our managed XSLT implementation is slower than MS XSLT for some kind of stylesheets, and faster for some. *** RELAX NG I implemented an experimental RelaxngValidatingReader. It is still not complete, for example some simplification stuff (see RELAX NG spec chapter 4; especially 4.17-19) and some constraints (especially 7.3). See mcs/class/Commons.Xml.Relaxng/README for details. Currently we have ** System.Xml v2.0 Microsoft released the first public beta version of .NET Framework 2.0, available from MSDN. It contains several new classes. There are two assemblies related to System.Xml v2.0; System.Xml.dll and System.Data.SqlXml.dll. Now that System.Data.SqlXml.dll is little important. It just contains only XQueryCommand class inside System.Xml.* namespace. Most of the important part are in System.Xml.dll. Note that .NET Framework is pre-release version, so they are subject to change. Actually many of the pre-released classes vanished. System.Xml 2.0 contains several features such as: *** System.Xml 2.0 **** Summary Here is the latest status of mono's System.Xml 2.0. Major remaining tasks are: In general, System.Xml 2.0 bits are largely implemented. I have some notes on things marked as "missing" in the above class status page: **** XmlReader/XmlWrier Factory methods In .NET 2.0, XmlTextReader, XmlNodeReader, XmlValidatingReader are obsolete and XmlReader.Create() is recommended (there is however no alternative way to create XmlNodeReader). Similarly, there are XmlWriter.Create() overloads. Currently, Microsoft's XmlWriter.Create() is unstable and there will be changes. So basically remaining XmlWriter.Create() is supposed to be done after the next beta version of .NET 2.0. Some of XmlReader.Create() overloads are implemented, with limited XmlReaderSettings support. **** Strongly typed XmlReader/XmlWriter In .NET 2.0, XmlReader is supposed to support strongly-typed data reading. They are based on W3C "XML Schema Datatypes" Recommendation and "XQuery 1.0 and XPath 2.0 Data Model" Working Draft. Note that this W3C specification is just a Working Draft and there might be incompatible changes for those strongly-typed API. For example, in the latest version of the spec (as of November 2004), xs:QName is specified as to have prefix, local name and namespace URI, while .NET XML classes just treat it as XmlQualifiedName which does not contain prefix. So this part of API might become obsolete or useless. Some of XmlReader.ReadValueAsXxx() and XmlWriter.WriteValue() overloads are implemented, though incompletely. They are based on internal XQueryConvert. **** Sub-tree handling in XmlReader/XmlWriter/XPathNavigator Currently XmlReader.ReadSubtree(), XmlWriter.WriteSubtree() and XPathNavigator.ReadSubtree() are implemented, though not well-tested. They are based on Mono.Xml.SubtreeXmlReader and Mono.Xml.XPath.XPathNavigatorReader classes. *** System.Xml.Schema 2.0 Since .NET 1.x is not so compliant with W3C XML Schema specification, Microsoft had to redesign System.Xml.Schema classes. We also have to change many things. **** XSD Inference In .NET 2.0, there is an XML Schema inference implementation. The API (or implementation design) is not cool and Microsoft will make changes in later version of beta or .NET Framework. **** XmlSchemaValidator It is (somewhat) exposed XML Schema validation functionality. It enables developers to get expected particles and attributes. Actually it is internally used to implement XmlReader.Create() with XmlSchemaSet. *** System.Xml.XPath 2.0 **** Editable XPathNavigator In System.Xml 2.0, XPathNavigator has many editing API (that used to be "XPathEditableNavigator"). It enables developers to edit XmlDocument (not for XPathDocument; it is read-only). (In the early stage of .NET 2.0, XPathDocument is supposed to be editable. Also, the new version of editable XPathNavigator had been already implemented in Mono, as Mono.Xml.XPath.XPathEditableDocument.) *** System.Xml.Xsl 2.0 There used to be System.Xml.Query.XsltCommand class, and it now disappeared and it is said (by Microsoft developers) that there will be a class named XslCompiledTransform - so it will be included in the next beta version. It is regarded as the identical thing to XsltCommand. XslCompiledtransform seems almost the same as System.Xml.Xsl.XslTransform, but this class transforms documents twice to four times as fast as XslTransform. Instead, stylesheet compilation is much slower, because it generates compiled stylesheet assembly. ** External assemblies for Mono 2.0 *** Mono.Xml.Ext (IMPORTANT: There used to be System.Xml.Query.XQueryCommand class that implemented XQuery, but now Microsoft dropped it for .NET 2.0. So we moved them out to external assembly named Mono.Xml.Ext.dll, but I haven't changed thing so much when I just extracted them. Thus, this section is kept as is, and basically old stuff.) Mono.Xml.Ext.dll contains mainly XQuery implementation, and some utility classes. XQueryCommand implements XQuery. XQuery is a new face XML document manipulation language (at least new face in .NET world). It is similar to XSLT, but extended to support XML Schema based datatypes (and it is not XML based langauge). It is similar to XPath, but it can construct XML nodes. It has no complicated template resolution, but works like functional languages. Under MS.NET, XQuery implementation is mainly in System.Xml.Query and MS.Internal.Xml.* namespaces. The implementation is mostly in System.Xml.dll. It is also true to our System.Xml.dll. Our XQueryCommand in System.Data.SqlXml.dll just invokes the actual XQuery processor (Mono.Xml.XPath2.XQueryCommandImpl) which resides in System.Xml.dll via reflection. Currently we are not implementing MS.Internal.Xml.* classes. MS implementation is based on an old version of the W3C specification, and our implementation is currently based on 23 July 2004 version (latest as of now) of the working draft. XQuery implementation tasks are: It already handles some queries, while major part implementation is missing or buggy (like FLWOR, expressions for sequence type handling, built-in function support etc.). *** Relax NG and DSDL in Mono 1.2 Currently we support only RELAX NG as one part of ISO DSDL effort. There is existing Schematron implementation (NMatrix Project: http://sourceforge.net/projects/dotnetopensrc/). With a few changes, it can be used with mono. We don't have multi-language based validation support, namely Namespace-based Validation Dispatch Language (NVDL). To support unwrapping, one special XmlReader implementation is required (other schema validation support can be done by ReadSubtree()). Note that we had seen RELAX Namespace, Modular Namespace (MNS) and Namespace Routing Language (NRL) - that is, standardization effort is still ongoing (though NVDL looks mostly the same as NRL). In Mono 2.0, there are some improvements: