i think this is clean, notsure as i cant build the web page for some reason.
[mono.git] / web / xml-classes
1 * XML Classes
2
3 ** Abstract
4
5   XML library is used by several field 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.
9
10   Note that current corlib has its own XML parser class named Mono.Xml.MiniParser.
11
12   Basically System.XML.dll feature has finished, or almost finished, so
13   I write this page mainly for bugs and improvement hints.
14
15
16 ** System.Xml namespace
17
18
19 *** Document Object Model (Core)
20
21   DOM feature has already implemented. There is still missing feature.
22
23         <ul>
24         * ID constraint support is problematic because W3C DOM does not specify
25           handling of ID attributes into non-adapted element. (MS.NET also 
26           looks incomplete in this area).
27
28         * I think, event feature is not fully tested. There are no concrete
29           desctiption on which events are risen, so we have to do some
30           experiment on MS.NET.
31         </ul>
32
33 *** Xml Writer
34
35   Here XmlWriter almost equals to XmlTextWriter. If you want to see
36   another implementation, check XmlNodeWriter.cs used in monodoc.
37
38   XmlTextWriter is completed. However, it looks nearly twice as slow as 
39   MS.NET (I tried 1.1)
40
41 *** XmlResolver
42
43   Currently XmlTextReader uses specified XmlResolver. If nothing was supplied,
44   then it uses XmlUrlResolver. XmlResolver is used to parse external DTD,
45   importing XSL stylesheets and schemas etc.
46
47   However, XmlUrlResolver is still buggy (mainly because System.Uri is also
48   incomplete yet) and this results in several loading error.
49
50   XmlSecureResolver, which is introduced in MS .NET Framework 1.1 is basically
51   implemented, but it requires CAS (code access security) feature. We need to
52   fixup this class after ongoing CAS effort works.
53
54
55 *** XmlNameTable
56
57   XmlNameTable itself is implemented. However, it should be actually used in
58   several classes. Currently it makes sense if compared names are both in
59   the table, but if it is obvious that compared names are both in this table,
60   it should be simply compared using ReferenceEquals() (if these names are
61   different, the comparison is still inefficient yet).
62
63
64 *** Xml Stream Reader
65
66   When we are using ASCII document, we don't care which encoding we are using.
67   However, XmlTextReader must be aware of the specified encoding in XML
68   declaration. So we have internal XmlStreamReader class (and currently
69   XmlInputStream class. This may disappear since XmlStreamReader is enough to
70   handle this problem).
71
72   However, there are some problems lies in these classes on reading network
73   stream (especially on Linux). This should be fixed soon.
74
75
76 *** XML Reader
77
78   XmlTextReader, XmlNodeReader and XmlValidatingReader are almost finished.
79
80         - Most of the OASIS conformance test passes as Microsoft does, but
81           about W3C tests, it is not perfect.
82
83         - I won't add any XDR support on XmlValidatingReader. (I haven't
84           ever seen XDR used other than Microsoft's BizTalk Server 2000,
85           and Now they have 2003 with XML Schema support)
86
87   XmlTextReader and XmlValidatingReader should be faster than now. Currently
88   XmlTextReader looks nearly twice as slow as MS.NET, and XmlValidatingReader
89   (which uses this slow XmlTextReader) looks nearly three times slower. (Note
90   that XmlValidatingReader won't be slow as itself. It uses schema validating
91   reader and dtd validating reader.)
92
93
94 **** Some Advantages
95
96   The design of Mono's XmlValidatingReader is radically different from
97   that of Microsoft's implementation. Under MS.NET, DTD content validation
98   engine is in fact simple replacement of XML Schema validation engine.
99   Mono's DTD validation is designed fully separate and does validation
100   as normal XML parser does. For example, Mono allows non-deterministic DTD.
101
102   Another advantage of this XmlValidatingReader is support for *any* XmlReader.
103   Microsoft supports only XmlTextReader.
104
105   I added extra support interface named "IHasXmlParserContext", which is
106   considered in XmlValidatingReader.ResolveEntity(). Microsoft failed to 
107   design XmlReader to support pluggable use of XmlReader (i.e. wrapping use
108   of other XmlReader) since XmlParserContext is required to support both
109   entity resolution and namespace manager. (In .NET 1.2, Microsoft also 
110   supported similar to IHasXmlParserContext, named IXmlNamespaceResolver,
111   but it still does not provide any DTD information.)
112
113   We also have RELAX NG validating reader. See mcs/class/Commons.Xml.Relaxng.
114
115
116 ** System.Xml.Schema
117
118 *** Schema Object Model
119
120   Basically it is implemented. Some features still needs to fix:
121
122         - Complete facet support. Currently some of them is missing. Recently
123           David Sheldon is doing several fixes on them.
124
125         - Complete derivation by restriction (DBR) support. Especially
126           substitution group won't work with it (However, I won't recommend
127           both substitution group and DBR, regardless of this incompleteness.)
128
129   Some bugs are remaining, but as far as I tried W3C XML Schema test suite 
130   with bugfixes (of test suite), only 69 out of 7581 has failed. With my test
131   suite fix, MS.NET failed 48 cases.
132
133 *** Validating Reader
134
135   XML Schema validation feature is (currently) implemented on
136   Mono.Xml.Schema.XsdValidatingReader, which is internally used in
137   XmlValidatingReader. 
138   
139   Basically this is implemented and actually its feature is almost complete,
140   but I have only did validation feature testing. So we have to write more 
141   tests on properties, methods, and events (validation errors).
142
143
144 ** System.Xml.Serialization
145
146   Lluis rules ;-)
147
148   Well, in fact XmlSerializer is almost finished and is on bugfix phase.
149   However, more tests are required especially schema import and export
150   feature. Please try xsd.exe to create classes from schema, or schema
151   from class. And if any problems were found, please file it to bugzilla.
152
153
154 ** System.Xml.XPath and System.Xml.Xsl
155
156   There are two implementations for XSLT. One (and historical) implementation
157   is based on libxslt. Now we uses fully implemented managed XSLT.
158
159   Putting aside bug fixes, we have to support:
160
161         - embedded script (such as VB, C#, JScript). So some packages like 
162           latest NAnt (for MS.NET) won't be compiled.
163
164   It would be nice if we can support <a href="http://www.exslt.org/">EXSLT</a>.
165   <a href="http://msdn.microsoft.com/WebServices/default.aspx?pull=/library/en-us/dnexxml/html/xml05192003.asp">Microsoft has already done it</a>, but it
166   is not good code since it depends on internal concrete derivatives of
167   XPathNodeIterator classes. In general, .NET's "extension objects" is not
168   usable to return node-sets, so if we support EXSLT, it has to be done
169   internally inside our System.XML.dll. Volunteers are welcome.
170
171   Our managed XSLT implementation is still inefficient. XslTransform.Load()
172   and .Transform() looks three times slower (However it depends on 
173   XmlTextReader which is also slow, so we are starting optimization from 
174   that class, not XSLT itself). These number are only for specific cases,
175   and there might be more critical point on XSLT engine (mainly
176   XPathNodeIterator).
177
178
179 ** Miscellaneous Class Libraries
180
181 *** RELAX NG
182
183   I implemented an experimental RelaxngValidatingReader. It is far from
184   complete, especially simplification stuff (see RELAX NG spec chapter 4),
185   some constraints (in chapter 7), and datatype handling.
186
187   I am planning improvements (starts with renaming classes, giving more
188   kind error messages, supporting compact syntax and even object mapping),
189   but it is still my wishlist.
190
191
192 ** Tools
193
194 *** xsd.exe
195
196   xsd.exe is used to:
197
198         1) generate classes source code from schema
199         2) generate DataSet classes source code from schema
200         3) generate schema documents from assembly (classes)
201         4) infer schema documents from XML instance
202         5) convert XDR into XSD
203
204   As descrived above, I won't work on 5) XDR stuff.
205
206   Current xsd.exe supports 1) and 3) 
207
208   As for 2) and 4), Currently there is no works on them. (This inference
209   feature is rather DataSet specific than general purpose use.)
210
211   Microsoft has another inference class from XmlReader to XmlSchemaCollection.
212   It may be useful, but it won't be so easy.
213
214   any volunteers?
215