2005-01-31 Zoltan Varga <vargaz@freemail.hu>
[mono.git] / web / xml-classes
index cbeb84fdfd037244bb56fca803e85f4be67e46c6..b2a4c595b6c0473b166aa53339f0c05a40ae55ff 100755 (executable)
   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 an improved <a href="http://codeblogs.ximian.com/blogs/benm/archives/000039.html">XmlCachingResolver</a> by Ben Maurer. 
-  If even one time download is not acceptable, you can use <a href="http://primates.ximian.com/~atsushi/XmlStoredResolver.cs">this one</a>.
+  You might also be interested in some improved implementations which resides
+  in Mono.Xml.Ext.dll.
 
-  [2.0] XmlDataSourceResolver is not implemented as yet.
+  [2.0] XmlDataSourceResolver <del>is not implemented as yet</del><ins>vanished</ins>.
 
 **** XmlNameTable
 
   NameTable is implemented, but also needs performance improvement.
-  It affects on the whole XML processing performance so much.
   Optimization hackings are welcome. There is also a <a 
   href="http://bugzilla.ximian.com/show_bug.cgi?id=59537">bugzilla entry</a> 
   for this matter.
@@ -59,7 +58,7 @@
 
        <ul>
                * All OASIS conformance test passes as Microsoft does. Some 
-                 W3C tests fail, but it looks better.
+                 W3C tests fail, but it looks better than Microsoft.
                * Entity expansion and its well-formedness check is incomplete.
                  It incorrectly allows divided content models. It incorrectly
                  treats its Base URI, so some dtd parse fails.
 
 *** System.Xml.Serialization
 
-  Lluis rules ;-)
+  Lluis Sanchez is the maintainer of this namespace (as well as
+  System.Web.Services).
 
-  Well, in fact XmlSerializer is almost finished and is on bugfix phase.
+  XmlSerializer is almost finished and is on bugfix phase.
 
   However, we appliciate more tests. Please try 
   
   mcs/class/System.Web.Services/Test/standalone.
 
   You might also interested in "genxs", which enables you to create custom
-  XML serializer. This is not included in Microsoft.NET. 
-  See <a 
-  href="http://primates.ximian.com/~lluis/blog/archives/000120.html">here</a>
-  and manpages for details. Code files are in mcs/tools/genxs.
+  XML serializer. See "tools" section discussed later. There is also "sgen"
+  that is introduced in .NET 2.0.
 
-  Lluis also created "sgen", that based on XmlSerializer.GenerateSerializer().
-  Code files are in mcs/tools/sgen.
 
 *** System.Xml.XPath and System.Xml.Xsl
 
 </ul>
 
 
-** Plans
-
-*** System.Xml v2.0
+** System.Xml v2.0
 
   Microsoft released the first public beta version of .NET Framework 2.0,
   available from <a href="http://www.microsoft.com/downloads/details.aspx?familyid=916EC067-8BDC-4737-9430-6CEC9667655C&displaylang=en">MSDN</a>.
   It contains several new classes.
 
   There are two assemblies related to System.Xml v2.0; System.Xml.dll and
-  System.Data.SqlXml.dll. Most of the important part are in System.Xml.dll
-  (you will find that the core part of XQuery is in System.Xml.dll; see some
-  classes in MS.Internal.Xml namespace), so I'll still spot only on
-  System.Xml.dll.
+  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 that they are subject
-  to change.
+  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:
 
        <ul>
-               * new XPathNavigator and XPathDocument
-               * Factory method based and strongly-typed XmlReader
+               * new XPathNavigator members that supports editing XmlDocument
+               * XmlReaderSettings, XmlWriterSettings and factory methods
+               * Strongly typed XmlReader, XmlWriter and XPathNavigator.
                * XML Schema design changes
                * XSD Inference
-               * XQuery implementation
                * Well-documented and improved XmlSerializer.
-               * XSLT IL generator (similar to Apache XSLTC) - it is 
-                 internal use
+               * XSLT per-stylesheet assembly generator
+       </ul>
+
+*** System.Xml 2.0
+
+**** Summary
+
+  <a href="http://mono.ximian.com/class-status/mono-HEAD-vs-fx-2/class-status-System.Xml.html">
+  Here</a> is the latest status of mono's System.Xml 2.0.
+
+  Major remaining tasks are:
+
+       <ul>
+               * binary content support on XmlReader
+               * XmlValueConverter
+               * XslCompiledTransform (not available in .NET FX 2.0 as yet)
+       </ul>
+
+  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:
+
+       <ul>
+               * XmlReader, XmlTextReader and XmlValidatingReader has
+                 many "missing bits", but ReadValueAsXxx() are obsoleted.
+                 They were now taken its place by ReadContentAsXxx() and
+                 ReadElementContentAsXxx() methods (those differences come
+                 from the basis of the methods: ReadElementString() or
+                 ReadString()).
+               * In System.Xml.XPath - first, new features in XPathDocument
+                 are said as reverted. So I just commented out those new
+                 features that had been already implemented in mono.
+                 Other missing classes such as XPathEditableNavigator are
+                 obsolete and will vanish at the time of 2.0 RTM.
+               * There are some security attributes. They are either way
+                 not applicable as yet, and actually currently corcompare
+                 ignores them. (So I already added some, but are ignored.)
        </ul>
 
-**** XmlReader.Create() and ReadValueAsXxx()
+**** 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).
+  alternative way to create XmlNodeReader). Similarly, there are
+  XmlWriter.Create() overloads.
 
-  As for typed XmlReader support, we need something like XQueryConvert that
-  is like XmlConvert but based on XQuery 1.0 and XPath 2.0 data model.
+  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.
 
-**** XML Schema design changes
+  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 some.
+  change many things.
+
+       <ul>
+               * It does not expose XmlSchemaDatatype as a type of an
+                 element or an attribute (except for obsolete members). 
+                 Primitive types are represented as XmlSchemaSimpleType 
+                 instances (thus there are ElementSchemaType, 
+                 AttributeSchemaType, BaseXmlSchemaType that replace some 
+                 existing properties). Note that XmlSchemaDatatype itself is 
+                 not deprecated as yet.
+
+               * "XQuery 1.0 and XPath 2.0 Data Model" datatypes (such as
+                 xdt:dayTimeDuration) are newly supported. They are partially
+                 implemented yet.
+
+               * schema structures are now bound in parent-child
+                 relationship. It is not yet implemented. With related to
+                 it, there seems bunch of schema compilation bugfixes.
+
+               * XmlSchemaCollection is not used anymore to represent
+                 effective set of schemas. Instead, new XmlSchemaSet class
+                 is used. It should affect on schema compilation design.
+       </ul>
+
 
 **** XSD Inference
 
-  In .NET 2.0, there is an XML Schema inference implementation. Once
-  XmlSchemaSet is implemented, it can be separately done by anyone.
-  Volunteer efforts are welcome here.
+  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.
+
+
 
-**** New XPathNavigator
+** External assemblies for Mono 2.0
 
-  System.Xml v2.0 implementation will be started from new XPathNavigator
-  implementation. First, its document structure and basic navigation feature
-  will be implemented. And next, XPath2 engine should be implemented 
-  (XPathNavigator2 looks very different from XPathNavigator).
+*** Mono.Xml.Ext
 
-  My current plan is to implement editable interface for XmlDocumentNavigator
-  (XPathNavigator from XmlDocument). Our XPathDocument is index-based
-  implementation, and thus it cannot be modified to be editable as it is.
+  (<strong>IMPORTANT</strong>: 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.)
 
-  There are some trivial tasks such as schema validation (we have
-  <a href="http://www24.brinkster.com/ginga/XPathDocumentReader.cs.txt">
-  XPathDocumentReader</a> that just wraps XPathNavigator, and our
-  XmlValidatingReader can accept any XmlReader).
+  Mono.Xml.Ext.dll contains mainly XQuery implementation, and some utility 
+  classes.
 
-**** XQuery 1.0
+  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.
 
-  XQuery is a new face XML data manipulation language (well, at least new
-  face in .NET world). It is similar to SQL, but intended to manipulate and to
-  support XML. It is similar to XPath, but extended to support new features
-  such as XML Schema based datatypes.
+  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.
 
-  XQuery implementation can be found mainly in System.Xml.Query and 
-  MS.Internal.Xml.Query namespaces. <del>Note that they are in 
-  System.Data.SqlXml.dll</del><ins> The implementation is mostly
-  in System.Xml.dll</ins>.
+  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 
+  <a href="http://www.w3.org/TR/2004/WD-xquery-20040723/">23 July 2004
+  version</a> (latest as of now) of the working draft.
 
-  XQuery implementation will be done in these steps:
+  XQuery implementation tasks are:
 
        <ul>
                * XQuery syntax parser that parses xquery string to AST 
-                 (abstract syntax tree).
+                 (abstract syntax tree). -> partly not done.
 
-               * XQuery AST compiler into runnable query command (not done yet)
+               * XQuery AST compiler into static context -> partly not done.
 
                * XQuery (dynamic context) runtime = XQuery expression evaluator
-                 + sequence iterator.
+                 + sequence iterator. -> partly not done.
+
+               * XPathItem data model and (mainly) conversion support.
+                 -> partly done.
 
                * Applied expression classes for XQuery/XPath 2.0 functions and
-                 operators.
+                 operators. -> partly done.
 
-               * XQuery data model and (mainly) conversion support.
+               * Optimization, and design per-query assembly code generator (later)
        </ul>
 
-**** Relax NG and DSDL in Mono 1.2
+  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: <a 
   http://sourceforge.net/projects/dotnetopensrc/</a>). With a few changes,
   it can be used with mono.
   
-  We also don't have multi-language based validation, namely Namespace-based
-  Validation Dispatch Language (NVDL). To support unwrapping, one special 
-  XmlReader implementation is required. 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).
+  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:
+
+       <ul>
+               * RelaxngPattern.Compile() now provides error location.
+
+               * RelaxngValidatingReader now supports "expected label
+                 collector" API; You can get name list of expected element
+                 names and attribute names by simulating validation.
 
-  In Mono 1.2, there might be improvements on Commons.Xml.Relaxng.
+  In Mono 2.0, there might be improvements on Commons.Xml.Relaxng.
 
        <ul>
-               * Currently RelaxngPattern.Compile() provides cheap compilation
-                 error information. At least it can provide error location.
-                 Also, the type of error should be kind of 
-                 RelaxngGrammarException.
+               * The type of error should be kind of RelaxngGrammarException.
 
                * Right now there is no ambiguity detection implementation that
                  would be useful for RelaxngPattern based xml serialization (if
                  there is need).
+
+               * Because of lack of ambiguity detection, there is no way to
+                 provide XmlMapping (XmlTypeMapping/XmlMemberMapping). But 
+                 If anyone is interested in such effort, integration with
+                 XmlSerializer would be interesting task.
        </ul>
 
 
 
   See <a href="ado-net.html">ADO.NET page</a>.
 
-  Microsoft has another inference class from XmlReader to XmlSchemaCollection
-  (Microsoft.XsdInference). It may be useful, but it won't be so easy.
+  Note that xsd.exe does not support XmlSchemaInference in System.Xml 2.0.
+
+*** genxs.exe
+
+  genxs.exe is a custom XmlSerializer code generator. This is Mono exclusive 
+  advantage. See <a 
+  href="http://primates.ximian.com/~lluis/blog/archives/000120.html">Lluis's
+  description</a> and manpages for details. Code files are in mcs/tools/genxs.
+
+*** sgen.exe
+
+  sgen.exe is an alternative XmlSerializer code generator which is based on
+  XmlSerializer.GenerateSerializer() written by Lluis. Code files are in
+  mcs/tools/sgen.
+
+*** dtd2xsd.exe
 
+  It is a tiny tool that enables conversion from DTD structure to XML Schema.
+  You need an XML instance, not DTD file itself (since basic XmlTextReader has
+  no feature to read external DTD resource itself). It runs only under mono.
 
 ** Miscellaneous
 
   Note that you still need System.dll to run mcs.
 
 
-  Atsushi Eno <asushi@ximian.com>
-  last updated 07/11/2004
+  Atsushi Eno <atsushi@ximian.com>
+  last updated 12/16/2004