1 * XML Classes Status and Tasks
5 XML library is used by several areas of Mono such as ADO.NET and XML
6 Digital Signature (xmldsig). Here I write about System.Xml.dll and
7 related tools. This page won't include any classes which are in other
8 assemblies such as XmlDataDocument.
10 Note that current corlib has its own XML parser class (Mono.Xml.MiniParser).
12 Basically System.XML.dll feature is almost finished, so I write this
13 document mainly for bugs and improvement hints.
17 *** System.Xml namespace
20 **** Document Object Model (Core)
22 DOM implementation has finished and our DOM implementation scores better
23 than MS.NET as to the NIST DOM test results (it is ported by Mainsoft
24 hackers and in our unit tests).
28 Here XmlWriter almost equals to XmlTextWriter. If you want to see
29 another implementation, check XmlNodeWriter.cs and DTMXPathDocumentWriter.cs
30 in System.XML sources.
32 XmlTextWriter is completed, though it looks a bit slower than MS.NET (I
37 XmlUrlResolver is implemented.
39 XmlSecureResolver, which is introduced in MS .NET Framework 1.1 is basically
40 implemented, but it requires CAS (code access security) feature. We need to
41 fixup this class after ongoing CAS effort works.
43 You might also be interested in some improved implementations which resides
46 [2.0] XmlDataSourceResolver <del>is not implemented as yet</del><ins>vanished</ins>.
50 NameTable is implemented, but also needs performance improvement.
51 Optimization hackings are welcome. There is also a <a
52 href="http://bugzilla.ximian.com/show_bug.cgi?id=59537">bugzilla entry</a>
57 XmlTextReader, XmlNodeReader and XmlValidatingReader are almost finished.
60 * All OASIS conformance test passes as Microsoft does. Some
61 W3C tests fail, but it looks better than Microsoft.
62 * Entity expansion and its well-formedness check is incomplete.
63 It incorrectly allows divided content models. It incorrectly
64 treats its Base URI, so some dtd parse fails.
65 * I won't add any XDR support on XmlValidatingReader. (I haven't
66 ever seen XDR used other than Microsoft's BizTalk Server 2000,
67 and Now they have 2002 with XML Schema support). If anyone
68 contributes an implementation, it would be still nice.
71 XmlTextReader and XmlValidatingReader should be faster than now. Currently
72 XmlTextReader looks nearly twice as slow as MS.NET, and XmlValidatingReader
73 (which uses this slow XmlTextReader) looks nearly three times slower. (Note
74 that XmlValidatingReader wouldn't be so slow as itself. It uses schema
75 validating reader and dtd validating reader.)
80 The design of Mono's XmlValidatingReader is radically different from
81 that of Microsoft's implementation. Under MS.NET, DTD content validation
82 engine is in fact simple replacement of XML Schema validation engine.
83 Mono's DTD validation is designed fully separate and does validation
84 as normal XML parser does. For example, Mono allows non-deterministic DTD.
86 Another advantage of this XmlValidatingReader is support for *any* XmlReader.
87 Microsoft supports only XmlTextReader (this bug is fixed in .NET 2.0 beta,
88 taking shape of XmlReader.Create()).
90 <del>I added extra support interface named "IHasXmlParserContext", which is
91 considered in XmlValidatingReader.ResolveEntity(). </del><ins>This is now
92 made as internal interface.</ins> Microsoft failed to design XmlReader
93 so that XmlReader cannot be subtree-pluggable (i.e. wrapping use of other
94 XmlReader) since XmlParserContext shoud be supplied for DTD information
95 support (e.g. entity references cannot be expanded) and namespace manager.
96 (In .NET 2.0, Microsoft also supported similar to IHasXmlParserContext,
97 named IXmlNamespaceResolver, but it still does not provide DTD information.)
99 We also have RELAX NG validating reader (described later).
102 *** System.Xml.Schema
106 Basically it is completed. You can test how current schema validation engine
107 is complete (incomplete) by using standalone test module (see
108 mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests).
109 At least in my box, msxsdtest fails only 30 cases with bugfixed catalog -
110 this score is better than that of Microsoft implementation. But instead,
111 we need performance boost. There should be many points to improve
112 schema compilation and validation.
114 **** Schema Object Model
116 Completed, except for some things to be fixed:
119 * Complete facet support. Currently some of them is missing.
120 Recently David Sheldon is doing several fixes on them.
121 * ContentTypeParticle for pointless xs:choice is incomplete
122 (fixing this arose another bugs in compilation.
123 Interestingly, MS.NET also fails around here, so it might
124 be nature of ContentTypeParticle design)
125 * Some derivation by restriction (DBR) handling is incorrect.
128 **** Validating Reader
130 Basically this is implemented and actually its feature is complete,
131 but I have only did validation feature testing. So we have to write more
132 tests on properties, methods, and events (validation errors).
135 *** System.Xml.Serialization
137 Lluis Sanchez is the maintainer of this namespace (as well as
138 System.Web.Services).
140 Well, in fact XmlSerializer is almost finished and is on bugfix phase.
142 However, we appliciate more tests. Please try
145 * System.Web.Services to invoke SOAP services.
146 * xsd.exe and wsdl.exe to create classes.
149 And if any problems were found, please file it to bugzilla.
151 Lluis also built interesting standalone test system placed under
152 mcs/class/System.Web.Services/Test/standalone.
154 You might also interested in "genxs", which enables you to create custom
155 XML serializer. This is not included in Microsoft.NET.
157 href="http://primates.ximian.com/~lluis/blog/archives/000120.html">here</a>
158 and manpages for details. Code files are in mcs/tools/genxs.
160 Lluis also created "sgen", that based on XmlSerializer.GenerateSerializer().
161 Code files are in mcs/tools/sgen.
163 *** System.Xml.XPath and System.Xml.Xsl
165 There are two XSLT implementations. One and historical implementation is
166 based on libxslt (aka Unmanaged XSLT). Now we uses fully implemented and
167 managed XSLT by default. To use Unmanaged XSLT, set MONO_UNMANAGED_XSLT
168 environment value (any value is acceptable).
170 As for Managed XSLT, we support msxsl:script.
172 It would be nice if we can support <a href="http://www.exslt.org/">EXSLT</a>.
173 <a href="http://msdn.microsoft.com/WebServices/default.aspx?pull=/library/en-us/dnexxml/html/xml05192003.asp">Microsoft has tried to do some of them</a>,
174 but it is not successful because of System.Xml.Xsl design problem:
177 * In general, .NET's "extension objects" (including
178 msxsl:script) is not useful to return node-sets (MS XSLT
179 implementation rejects just overriden XPathNodeIterator,
180 but accepts only their hidden classes. And are the same
181 in Mono though classes are different)
183 * In .NET's extension object design, extension function name
184 is a valid method name that cannot contain some characters
185 such as '-'. That is, implementing EXSLT in C# is impossible.
188 So if we support EXSLT, it has to be done inside our System.XML.dll.
189 Microsoft developers are also aware of this problem and some of them wish
190 to have EXSLT support in WinFX (not whidbey). If anyone is interested
191 in it, it would be nice.
193 Our managed XSLT implementation is slower than MS XSLT for some kind of
194 stylesheets, and faster for some.
199 I implemented an experimental RelaxngValidatingReader. It is still not
200 complete, for example some simplification stuff (see RELAX NG spec
201 chapter 4; especially 4.17-19) and some constraints (especially 7.3).
202 See mcs/class/Commons.Xml.Relaxng/README for details.
207 * Custom datatype support. Right now, you can use XML schema
208 datatypes ( http://www.w3.org/2001/XMLSchema-datatypes )
209 as well as RELAX NG default datatypes (as used in relaxng.rng).
211 * RELAX NG Compact Syntax support, though not yet stable.
212 See Commons.Xml.Relaxng.Rnc.RncParser class.
218 Microsoft released the first public beta version of .NET Framework 2.0,
219 available from <a href="http://www.microsoft.com/downloads/details.aspx?familyid=916EC067-8BDC-4737-9430-6CEC9667655C&displaylang=en">MSDN</a>.
220 It contains several new classes.
222 There are two assemblies related to System.Xml v2.0; System.Xml.dll and
223 System.Data.SqlXml.dll. Now that System.Data.SqlXml.dll is little important.
224 It just contains only XQueryCommand class inside System.Xml.* namespace.
225 Most of the important part are in System.Xml.dll.
227 Note that .NET Framework is pre-release version, so they are subject
228 to change. Actually many of the pre-released classes vanished.
230 System.Xml 2.0 contains several features such as:
233 * new XPathNavigator members that supports editing XmlDocument
234 * XmlReaderSettings, XmlWriterSettings and factory methods
235 * Strongly typed XmlReader, XmlWriter and XPathNavigator.
236 * XML Schema design changes
238 * Well-documented and improved XmlSerializer.
239 * XSLT per-stylesheet assembly generator
246 <a href="http://mono.ximian.com/class-status/mono-HEAD-vs-fx-2/class-status-System.Xml.html">
247 Here</a> is the latest status of mono's System.Xml 2.0.
249 Major remaining tasks are:
252 * binary content support on XmlReader
253 * IXmlSchemaInfo support for DOM and XmlValidatingReader
254 * XmlSchemaObject.Parent support
256 * possibly XmlSchemaValidator (but no description about this
258 * XslCompiledTransform (not available in .NET FX 2.0 as yet)
261 **** XmlReader/XmlWrier Factory methods
263 In .NET 2.0, XmlTextReader, XmlNodeReader, XmlValidatingReader are
264 obsolete and XmlReader.Create() is recommended (there is however no
265 alternative way to create XmlNodeReader). Similarly, there are
266 XmlWriter.Create() overloads.
268 Currently, Microsoft's XmlWriter.Create() is unstable and there will
269 be changes. So basically remaining XmlWriter.Create() is supposed to be
270 done after the next beta version of .NET 2.0.
272 Some of XmlReader.Create() overloads are implemented, with limited
273 XmlReaderSettings support.
276 **** Strongly typed XmlReader/XmlWriter
278 In .NET 2.0, XmlReader is supposed to support strongly-typed data reading.
279 They are based on W3C "XML Schema Datatypes" Recommendation and "XQuery 1.0
280 and XPath 2.0 Data Model" Working Draft.
282 Note that this W3C specification is just a Working Draft and there might
283 be incompatible changes for those strongly-typed API. For example, in the
284 latest version of the spec (as of November 2004), xs:QName is specified as
285 to have prefix, local name and namespace URI, while .NET XML classes just
286 treat it as XmlQualifiedName which does not contain prefix. So this part of
287 API might become obsolete or useless.
289 Some of XmlReader.ReadValueAsXxx() and XmlWriter.WriteValue() overloads are
290 implemented, though incompletely. They are based on internal XQueryConvert.
293 **** Sub-tree handling in XmlReader/XmlWriter/XPathNavigator
295 Currently XmlReader.ReadSubtree(), XmlWriter.WriteSubtree() and
296 XPathNavigator.ReadSubtree() are implemented, though not well-tested.
297 They are based on Mono.Xml.SubtreeXmlReader and
298 Mono.Xml.XPath.XPathNavigatorReader classes.
301 *** System.Xml.Schema 2.0
303 Since .NET 1.x is not so compliant with W3C XML Schema specification,
304 Microsoft had to redesign System.Xml.Schema classes. We also have to
308 * It does not expose XmlSchemaDatatype as a type of an
309 element or an attribute (except for obsolete members).
310 Primitive types are represented as XmlSchemaSimpleType
311 instances (thus there are ElementSchemaType,
312 AttributeSchemaType, BaseXmlSchemaType that replace some
313 existing properties). Note that XmlSchemaDatatype itself is
314 not deprecated as yet.
316 * "XQuery 1.0 and XPath 2.0 Data Model" datatypes (such as
317 xdt:dayTimeDuration) are newly supported. They are partially
320 * schema structures are now bound in parent-child
321 relationship. It is not yet implemented. With related to
322 it, there seems bunch of schema compilation bugfixes.
324 * XmlSchemaCollection is not used anymore to represent
325 effective set of schemas. Instead, new XmlSchemaSet class
326 is used. It should affect on schema compilation design.
332 In .NET 2.0, there is an XML Schema inference implementation. The API (or
333 implementation design) is not cool and Microsoft will make changes in
334 later version of beta or .NET Framework.
337 *** System.Xml.XPath 2.0
339 **** Editable XPathNavigator
341 In System.Xml 2.0, XPathNavigator has many editing API (that used to be
342 "XPathEditableNavigator"). It enables developers to edit XmlDocument
343 (not for XPathDocument; it is read-only).
345 (In the early stage of .NET 2.0, XPathDocument is supposed to be editable.
346 Also, the new version of editable XPathNavigator had been already
347 implemented in Mono, as Mono.Xml.XPath.XPathEditableDocument.)
350 *** System.Xml.Xsl 2.0
352 There used to be System.Xml.Query.XsltCommand class, and it now disappeared
353 and it is said (by Microsoft developers) that there will be a class named
354 XslCompiledTransform - so it will be included in the next beta version.
355 It is regarded as the identical thing to XsltCommand.
357 XslCompiledtransform seems almost the same as System.Xml.Xsl.XslTransform,
358 but this class transforms documents twice to four times as fast as
359 XslTransform. Instead, stylesheet compilation is much slower, because
360 it generates compiled stylesheet assembly.
364 ** External assemblies for Mono 2.0
368 (<strong>IMPORTANT</strong>: There used to be System.Xml.Query.XQueryCommand
369 class that implemented XQuery, but now Microsoft dropped it for .NET 2.0.
370 So we moved them out to external assembly named Mono.Xml.Ext.dll, but I
371 haven't changed thing so much when I just extracted them. Thus, this
372 section is kept as is, and basically old stuff.)
374 Mono.Xml.Ext.dll contains mainly XQuery implementation, and some utility
377 XQueryCommand implements XQuery. XQuery is a new face XML document
378 manipulation language (at least new face in .NET world). It is similar
379 to XSLT, but extended to support XML Schema based datatypes (and it is
380 not XML based langauge). It is similar to XPath, but it can construct
381 XML nodes. It has no complicated template resolution, but works like
382 functional languages.
384 Under MS.NET, XQuery implementation is mainly in System.Xml.Query and
385 MS.Internal.Xml.* namespaces. The implementation is mostly
386 in System.Xml.dll. It is also true to our System.Xml.dll. Our XQueryCommand
387 in System.Data.SqlXml.dll just invokes the actual XQuery processor
388 (Mono.Xml.XPath2.XQueryCommandImpl) which resides in System.Xml.dll via
391 Currently we are not implementing MS.Internal.Xml.* classes. MS
392 implementation is based on an old version of the W3C specification, and
393 our implementation is currently based on
394 <a href="http://www.w3.org/TR/2004/WD-xquery-20040723/">23 July 2004
395 version</a> (latest as of now) of the working draft.
397 XQuery implementation tasks are:
400 * XQuery syntax parser that parses xquery string to AST
401 (abstract syntax tree). -> partly not done.
403 * XQuery AST compiler into static context -> partly not done.
405 * XQuery (dynamic context) runtime = XQuery expression evaluator
406 + sequence iterator. -> partly not done.
408 * XPathItem data model and (mainly) conversion support.
411 * Applied expression classes for XQuery/XPath 2.0 functions and
412 operators. -> partly done.
414 * Optimization, and design per-query assembly code generator (later)
417 It already handles some queries, while major part implementation is missing
418 or buggy (like FLWOR, expressions for sequence type handling, built-in
419 function support etc.).
422 *** Relax NG and DSDL in Mono 1.2
424 Currently we support only RELAX NG as one part of ISO DSDL effort. There
425 is existing Schematron implementation (NMatrix Project: <a
426 href="http://sourceforge.net/projects/dotnetopensrc/">
427 http://sourceforge.net/projects/dotnetopensrc/</a>). With a few changes,
428 it can be used with mono.
430 We don't have multi-language based validation support, namely
431 Namespace-based Validation Dispatch Language (NVDL). To support unwrapping,
432 one special XmlReader implementation is required (other schema validation
433 support can be done by ReadSubtree()). Note that we had seen RELAX
434 Namespace, Modular Namespace (MNS) and Namespace Routing Language (NRL)
435 - that is, standardization effort is still ongoing (though NVDL looks
436 mostly the same as NRL).
438 In Mono 2.0, there might be improvements on Commons.Xml.Relaxng.
441 * Currently RelaxngPattern.Compile() provides cheap compilation
442 error information. At least it can provide error location.
443 Also, the type of error should be kind of
444 RelaxngGrammarException.
446 * Right now there is no ambiguity detection implementation that
447 would be useful for RelaxngPattern based xml serialization (if
450 * Because of lack of ambiguity detection, there is no way to
451 provide XmlMapping (XmlTypeMapping/XmlMemberMapping). But
452 If anyone is interested in such effort, integration with
453 XmlSerializer would be interesting task.
461 See <a href="ado-net.html">ADO.NET page</a>.
463 Note that xsd.exe does not support XmlSchemaInference in System.Xml 2.0.
468 *** Mutual assembly dependency
470 Sometimes I hear complain about System.dll and System.Xml.dll mutual
471 dependency: System.dll references to System.Xml.dll (e.g.
472 System.Configuration.ConfigXmlDocument extended from XmlDocument), while
473 System.Xml.dll vice versa (e.g. XmlUrlResolver.ResolveUri takes System.Uri).
474 Since they are in public method signatures, so at least we cannot get rid
475 of these mutual references.
477 Nowadays System.Xml.dll is built using incomplete System.dll (lacking
478 System.Xml dependent classes such as ConfigXmlDocument). Full System.dll
479 is built after System.Xml.dll is done.
481 Note that you still need System.dll to run mcs.
484 Atsushi Eno <atsushi@ximian.com>
485 last updated 11/29/2004