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.
16 ** System.Xml namespace
19 *** Document Object Model (Core)
21 DOM implementation has finished and our DOM implementation scores better
22 than MS.NET as to the NIST DOM test results (it is ported by Mainsoft
23 hackers and in our unit tests).
27 Here XmlWriter almost equals to XmlTextWriter. If you want to see
28 another implementation, check XmlNodeWriter.cs and DTMXPathDocumentWriter.cs
29 in System.XML sources.
31 XmlTextWriter is completed, though it looks a bit slower than MS.NET (I
36 Currently XmlTextReader uses specified XmlResolver. If nothing was supplied,
37 then it uses XmlUrlResolver. XmlResolver is used to parse external DTD,
38 importing XSL stylesheets and schemas etc.
40 XmlSecureResolver, which is introduced in MS .NET Framework 1.1 is basically
41 implemented, but it requires CAS (code access security) feature. We need to
42 fixup this class after ongoing CAS effort works.
44 You might also be interested in an improved <a href="http://codeblogs.ximian.com/blogs/benm/archives/000039.html">XmlCachingResolver</a> by Ben Maurer.
45 If even one time download is not acceptable, you can use <a href="http://primates.ximian.com/~atsushi/XmlStoredResolver.cs">this one</a>.
49 NameTable itself is implemented. It should be actually used in several
50 classes. Currently it makes sense if compared names are both in the table,
51 they should be simply compared using ReferenceEquals(). We have done where
52 it seems possible e.g. in XmlNamespaceManager (in .NET 2.0 methods; if the
53 build is not NET_2_0, it will be used internally).
55 NameTable also needs performance improvement. Optimization hackings are
60 When we are using ASCII document, we don't care which encoding we are using.
61 However, XmlTextReader must be aware of the specified encoding in XML
62 declaration. So we have internal XmlStreamReader class (and currently
63 XmlInputStream class. This may disappear since XmlStreamReader is enough to
66 However, there used to be some problems in these classes on reading network
67 stream (especially on Linux). However, this might be already fixed with
68 some network stream bugfixes.
72 XmlTextReader, XmlNodeReader and XmlValidatingReader are almost finished.
75 * All OASIS conformance test passes as Microsoft does. Some
76 W3C tests fail, but it looks better.
77 * Entity expansion and its well-formedness check is incomplete.
78 It incorrectly allows divided content models. It incorrectly
79 treats its Base URI, so some dtd fails.
80 * I won't add any XDR support on XmlValidatingReader. (I haven't
81 ever seen XDR used other than Microsoft's BizTalk Server 2000,
82 and Now they have 2002 with XML Schema support)
85 XmlTextReader and XmlValidatingReader should be faster than now. Currently
86 XmlTextReader looks nearly twice as slow as MS.NET, and XmlValidatingReader
87 (which uses this slow XmlTextReader) looks nearly three times slower. (Note
88 that XmlValidatingReader won't be slow as itself. It uses schema validating
89 reader and dtd validating reader.)
94 The design of Mono's XmlValidatingReader is radically different from
95 that of Microsoft's implementation. Under MS.NET, DTD content validation
96 engine is in fact simple replacement of XML Schema validation engine.
97 Mono's DTD validation is designed fully separate and does validation
98 as normal XML parser does. For example, Mono allows non-deterministic DTD.
100 Another advantage of this XmlValidatingReader is support for *any* XmlReader.
101 Microsoft supports only XmlTextReader (this bug will be fixed in VS 2005,
102 taking shape of XmlFactory).
104 <del>I added extra support interface named "IHasXmlParserContext", which is
105 considered in XmlValidatingReader.ResolveEntity(). </del><ins>This is now
106 made as internal interface.</ins> Microsoft failed to design XmlReader
107 so that XmlReader cannot be subtree-pluggable (i.e. wrapping use of other
108 XmlReader) since XmlParserContext shoud be supplied for DTD information
109 support (e.g. entity references cannot be expanded) and namespace manager.
110 (In .NET 2.0, Microsoft also supported similar to IHasXmlParserContext,
111 named IXmlNamespaceResolver, but it still does not provide DTD information.)
113 We also have RELAX NG validating reader. See mcs/class/Commons.Xml.Relaxng.
120 Basically it is completed. We can compile complex and simple types, refer to
121 external schemas, extend or restrict other types, or use substitution groups.
122 You can test how current schema validation engine is complete (incomplete)
123 by using standalone test module
124 (see mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests).
125 At least in my box, msxsdtest fails only 30 cases with bugfixed catalog -
126 this score is better than that of Microsoft implementation.
128 *** Schema Object Model
130 Completed, except for some things to be fixed:
133 * Complete facet support. Currently some of them is missing.
134 Recently David Sheldon is doing several fixes on them.
135 * ContentTypeParticle for pointless xs:choice is incomplete
136 (It is because fixing this arose another bugs in
137 compilation. Interestingly, MS.NET also fails around here,
138 so it might be nature of ContentTypeParticle design)
139 * Some derivation by restriction (DBR) handling is incorrect.
142 *** Validating Reader
144 XML Schema validation feature is (currently) implemented on
145 Mono.Xml.Schema.XsdValidatingReader, which is internally used in
148 Basically this is implemented and actually its feature is almost complete,
149 but I have only did validation feature testing. So we have to write more
150 tests on properties, methods, and events (validation errors).
153 ** System.Xml.Serialization
157 Well, in fact XmlSerializer is almost finished and is on bugfix phase.
159 However, we appliciate more tests. Please try
162 * System.Web.Services to invoke SOAP services.
163 * xsd.exe and wsdl.exe to create classes.
166 And if any problems were found, please file it to bugzilla.
168 Lluis also built interesting standalone test system placed under
169 mcs/class/System.Web.Services/Test/standalone.
171 You might also interested in genxs, which enables you to create custom
172 XML serializer. This is not included in Microsoft.NET.
174 href="http://primates.ximian.com/~lluis/blog/archives/000120.html">here</a>
175 and manpages for details. Code files are in mcs/tools/genxs.
178 ** System.Xml.XPath and System.Xml.Xsl
180 There are two XSLT implementations. One and historical implementation is
181 based on libxslt (aka Unmanaged XSLT). Now we uses fully implemented and
182 managed XSLT by default. To use Unmanaged XSLT, set MONO_UNMANAGED_XSLT
183 environment value (any value is acceptable).
185 As for Managed XSLT, we support msxsl:script.
187 It would be nice if we can support <a href="http://www.exslt.org/">EXSLT</a>.
188 <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>,
189 but it is not good code since it depends on internal concrete derivatives of
190 XPathNodeIterator classes.
192 In general, .NET's "extension objects" (including msxsl:script) is not
193 useful to return node-sets (MS XSLT implementation rejects just overriden
194 XPathNodeIterator, but accepts only their hidden classes. And are the same
195 in Mono though classes are different), so if we support EXSLT, it has to
196 be done inside our System.XML.dll. Volunteers are welcome.
198 Our managed XSLT implementation is slower than MS XSLT for some kind of
199 stylesheets, and faster for some.
202 ** System.Xml and ADO.NET v2.0
204 Microsoft released the second beta version of .NET Framework 2.0 with
205 Visual Studio 2005 alpha version. They are only available on MSDN
206 _subscriber_ download (i.e. it is not publicly downloadable yet). It
207 contains several new classes.
209 There are two assemblies related to System.Xml v2.0; System.Xml.dll and
210 System.Data.SqlXml.dll (here I treat sqlxml.dll as part of System.Xml v2.0,
211 but note that it is also one of the ADO.NET 2.0 feature). There are several
212 namespaces such as MS.Internal.Xml and System.Xml. Note that .NET Framework
213 is pre-release version so that they are subject to change.
215 System.Xml 2.0 contains several features such as:
218 * new XPathNavigator and XPathDocument
221 * XSLT IL generator (similar to Apache XSLTC) - it is
225 Tim Coleman started ADO.NET 2.0 related works. Currently I have no plan to
226 implement System.Xml v2.0 classes and won't touch with them immediately,
227 but will start in some months. If any of you wants to try this frontier,
228 we welcome your effort.
230 *** New XPathNavigator
232 System.Xml v2.0 implementation will be started from new XPathDocument and
233 XPathNavigator implementations (they are called as XPathDocument2 and
234 XPathNavigator2, and they were very different from existing one). First,
235 its document structure and basic navigation feature will be implemented.
236 And next, XPath2 engine should be implemented (XPathNavigator2 looks very
237 different from XPathNavigator).
239 There are some trivial tasks such as schema validation (we have
240 <a href="http://www24.brinkster.com/ginga/XPathDocumentReader.cs.txt">
241 XPathDocumentReader</a> that just wraps XPathNavigator, and our
242 XmlValidatingReader can accept any XmlReader).
246 XML Query is a new face XML data manipulation language (well, at least new
247 face in .NET world). It is similar to SQL, but intended to manipulate and to
248 support XML. It is similar to XSLT, but extended to support new features
249 such as XML Schema based datatypes.
251 XML Query implementation can be found mainly in System.Xml.Query and
252 MS.Internal.Xml.Query namespaces. Note that they are in
253 System.Data.SqlXml.dll.
255 MSDN documentation says that there are two kind of API for XML Query: High
256 Level API and Low Level API. At the time of this beta version, the Low Level
257 API is described not released yet (though it may be MS.Internal.Xml.*
258 classes). However, to implement the High Level API, the Low Level API will
259 be used. They looks to have interesting class structures in MS.Internal.Xml
260 related stuff, so it would be nice (and I will) start to learn about them.
262 They looks to have IL generator classes, but it might be difficult to
265 *** System.Data.Mapping
267 System.Data.Mapping and System.Data.Mapping.RelationalSchema are the
268 namespaces for mapping support between database and xml. This is at
269 stubbing phase (incomplete as yet).
273 XmlAdapter is used to support XML based query and update using (new)
274 XPathDocument and XPathNavigator. This class is designed to synthesize
275 ADO.NET and System.Xml. It connects to databases, and querys data in XML
276 shape into XPathDocument, using Mapping schema above. This must be
277 done after several classes such as XPathDocument and MappingSchema.
280 ** Miscellaneous Class Libraries
284 I implemented an experimental RelaxngValidatingReader. It is still not
285 complete, for example some simplification stuff (see RELAX NG spec
286 chapter 4; especially 4.17-19) and some constraints (especially 7.3).
287 See mcs/class/Commons.Xml.Relaxng/README for details.
289 It supports custom datatype handling. Right now, you can use XML schema
290 datatypes ( http://www.w3.org/2001/XMLSchema-datatypes ) as well
291 as RELAX NG default datatypes (as used in relaxng.rng).
293 In Commons.Xml.Relaxng.dll, there is also RELAX NG Compact Syntax support.
294 See Commons.Xml.Relaxng.Rnc.RncParser class.
296 I am planning improvements (giving more kind error messages, and even
297 object mapping), but it won't be come true until Mono 1.0 release.
304 See <a href="ado-net.html">ADO.NET page</a>.
306 Microsoft has another inference class from XmlReader to XmlSchemaCollection
307 (Microsoft.XsdInference). It may be useful, but it won't be so easy.
312 *** Mutual assembly dependency
314 Sometimes I hear complain about System.dll and System.Xml.dll mutual
315 dependency: System.dll references to System.Xml.dll (e.g.
316 System.Configuration.ConfigXmlDocument extended from XmlDocument), while
317 System.Xml.dll vice versa (e.g. XmlUrlResolver.ResolveUri takes System.Uri).
318 Since they are in public method signatures, so at least we cannot get rid
319 of these mutual references.
321 Nowadays System.Xml.dll is built using incomplete System.dll (lacking
322 System.Xml dependent classes such as ConfigXmlDocument). Full System.dll
323 is built after System.Xml.dll is done.
325 Note that you still need System.dll to run mcs.