Author: atsushi
Date: 2007-07-04 09:19:57 -0400 (Wed, 04 Jul 2007)
New Revision: 81332

Modified:
   trunk/mcs/class/System.XML/Mono.Xml/ChangeLog
   trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs
   trunk/mcs/class/System.XML/Mono.Xml/XmlFilterReader.cs
   trunk/mcs/class/System.XML/System.Xml/ChangeLog
   trunk/mcs/class/System.XML/System.Xml/DTDAutomata.cs
   trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
   trunk/mcs/class/System.XML/System.Xml/DTDReader.cs
   trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader2.cs
   trunk/mcs/class/System.XML/System.Xml/XmlException.cs
   trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
   trunk/mcs/class/System.XML/System.Xml/XmlReaderSettings.cs
   trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs
Log:
2007-07-04  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * SubtreeXmlReader.cs XmlFilterReader.cs :
          exclude xsd stuff from NET_2_1 profile.

        * DTDAutomata.cs DTDObjectModel.cs DTDReader.cs
          DTDValidatingReader2.cs XmlException.cs XmlReader.cs
          XmlReaderSettings.cs XmlWriter.cs :
          Make System.Xml.Core.dll build easier, using NET_2_1.

          DTD support is simply cut at this stage (as it largely depends on
          sys.xml.schema stuff).



Modified: trunk/mcs/class/System.XML/Mono.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml/ChangeLog       2007-07-04 13:17:45 UTC 
(rev 81331)
+++ trunk/mcs/class/System.XML/Mono.Xml/ChangeLog       2007-07-04 13:19:57 UTC 
(rev 81332)
@@ -1,3 +1,8 @@
+2007-07-04  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * SubtreeXmlReader.cs XmlFilterReader.cs :
+         exclude xsd stuff from NET_2_1 profile.
+
 2007-05-03  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * XmlFilterReader.cs : do not close input when CloseInput is true.

Modified: trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs     2007-07-04 
13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/Mono.Xml/SubtreeXmlReader.cs     2007-07-04 
13:19:57 UTC (rev 81332)
@@ -124,9 +124,11 @@
                        get { return initial ? ReadState.Initial : eof ? 
ReadState.EndOfFile : Reader.ReadState ; }
                }
 
+#if !NET_2_1
                public override IXmlSchemaInfo SchemaInfo {
                        get { return Reader.SchemaInfo; }
                }
+#endif
 
                public override XmlReaderSettings Settings {
                        get { return Reader.Settings; }

Modified: trunk/mcs/class/System.XML/Mono.Xml/XmlFilterReader.cs
===================================================================
--- trunk/mcs/class/System.XML/Mono.Xml/XmlFilterReader.cs      2007-07-04 
13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/Mono.Xml/XmlFilterReader.cs      2007-07-04 
13:19:57 UTC (rev 81332)
@@ -160,9 +160,11 @@
                        get { return reader.NameTable; }
                }
 
+#if !NET_2_1
                public override IXmlSchemaInfo SchemaInfo {
                        get { return reader.SchemaInfo; }
                }
+#endif
 
                public override XmlReaderSettings Settings {
                        get { return settings; }

Modified: trunk/mcs/class/System.XML/System.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/ChangeLog     2007-07-04 13:17:45 UTC 
(rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/ChangeLog     2007-07-04 13:19:57 UTC 
(rev 81332)
@@ -1,3 +1,13 @@
+2007-07-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * DTDAutomata.cs DTDObjectModel.cs DTDReader.cs
+         DTDValidatingReader2.cs XmlException.cs XmlReader.cs
+         XmlReaderSettings.cs XmlWriter.cs :
+         Make System.Xml.Core.dll build easier, using NET_2_1.
+
+         DTD support is simply cut at this stage (as it largely depends on
+         sys.xml.schema stuff).
+
 2007-06-30  Gert Driesen  <[EMAIL PROTECTED]>
 
        * XmlTextReader.cs: Expose ProhibitDtd on 1.0 profile too.

Modified: trunk/mcs/class/System.XML/System.Xml/DTDAutomata.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDAutomata.cs        2007-07-04 
13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/DTDAutomata.cs        2007-07-04 
13:19:57 UTC (rev 81332)
@@ -27,12 +27,15 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
+
 using System;
 using System.Collections;
 using System.Text;
 using System.Xml;
+#if !NET_2_1
 using System.Xml.Schema;
 using Mono.Xml.Schema;
+#endif
 
 namespace Mono.Xml
 {

Modified: trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs     2007-07-04 
13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/DTDObjectModel.cs     2007-07-04 
13:19:57 UTC (rev 81332)
@@ -34,7 +34,11 @@
 using System.Text;
 using System.Xml;
 using System.Xml.Schema;
+#if NET_2_1
+using XmlSchemaException = System.Xml.XmlException;
+#else
 using Mono.Xml.Schema;
+#endif
 
 #if NET_2_0
 using XmlTextReaderImpl = Mono.Xml2.XmlTextReader;
@@ -141,6 +145,7 @@
                        set { linePosition = value; }
                }
 
+#if !NET_2_1
                internal XmlSchema CreateXsdSchema ()
                {
                        XmlSchema s = new XmlSchema ();
@@ -151,14 +156,19 @@
                                s.Items.Add (el.CreateXsdElement ());
                        return s;
                }
+#endif
 
                public string ResolveEntity (string name)
                {
                        DTDEntityDeclaration decl = EntityDecls [name] 
                                as DTDEntityDeclaration;
                        if (decl == null) {
+#if NET_2_1
+                               AddError (new XmlSchemaException (String.Format 
("Required entity was not found: {0}", name), null, this.LineNumber, 
this.LinePosition));
+#else
                                AddError (new XmlSchemaException ("Required 
entity was not found.",
                                        this.LineNumber, this.LinePosition, 
null, this.BaseURI, null));
+#endif
                                return " ";
                        }
                        else
@@ -435,6 +445,7 @@
                        return compiledAutomata;
                }
 
+#if !NET_2_1
                internal XmlSchemaParticle CreateXsdParticle ()
                {
                        XmlSchemaParticle p = CreateXsdParticleCore ();
@@ -483,6 +494,7 @@
                        }
                        return p;
                }
+#endif
 
                private DTDAutomata CompileInternal ()
                {
@@ -626,12 +638,14 @@
                        return new XmlException (this as IXmlLineInfo, BaseURI, 
message);
                }
 
+#if !NET_2_1
                public void SetLineInfo (XmlSchemaObject obj)
                {
                        obj.SourceUri = BaseURI;
                        obj.LineNumber = LineNumber;
                        obj.LinePosition = LinePosition;
                }
+#endif
        }
 
        internal class DTDElementDeclaration : DTDNode
@@ -681,6 +695,7 @@
                        }
                }
 
+#if !NET_2_1
                internal XmlSchemaElement CreateXsdElement ()
                {
                        XmlSchemaElement el = new XmlSchemaElement ();
@@ -732,6 +747,7 @@
                        */
                        return el;
                }
+#endif
        }
 
        internal class DTDAttributeDefinition : DTDNode
@@ -825,6 +841,7 @@
                        }
                }
 
+#if !NET_2_1
                internal XmlSchemaAttribute CreateXsdAttribute ()
                {
                        XmlSchemaAttribute a = new XmlSchemaAttribute ();
@@ -885,6 +902,7 @@
                                a.SchemaTypeName = qname;
                        return a;
                }
+#endif
 
                internal string ComputeDefaultValue ()
                {
@@ -1212,8 +1230,12 @@
                                }
                        }
                        if (start != 0)
+#if NET_2_1
+                               Root.AddError (new XmlSchemaException (this, 
this.BaseURI, "Invalid reference character '&' is specified."));
+#else
                                Root.AddError (new XmlSchemaException ("Invalid 
reference character '&' is specified.",
                                        this.LineNumber, this.LinePosition, 
null, this.BaseURI, null));
+#endif
                        scanned = true;
                        recursed = false;
                }

Modified: trunk/mcs/class/System.XML/System.Xml/DTDReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDReader.cs  2007-07-04 13:17:45 UTC 
(rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/DTDReader.cs  2007-07-04 13:19:57 UTC 
(rev 81332)
@@ -42,7 +42,11 @@
 using System.IO;
 using System.Text;
 using Mono.Xml;
+#if NET_2_1
+using XmlSchemaException = System.Xml.XmlException;
+#else
 using System.Xml.Schema;
+#endif
 
 namespace System.Xml
 {
@@ -932,6 +936,9 @@
 
                private DTDAttributeDefinition ReadAttributeDefinition ()
                {
+#if NET_2_1_HACK
+                       throw new NotImplementedException ();
+#else
                        DTDAttributeDefinition def = new DTDAttributeDefinition 
(DTD);
                        def.IsInternalSubset = this.processingInternalSubset;
 
@@ -1042,6 +1049,7 @@
                        ReadAttributeDefaultValue (def);
 
                        return def;
+#endif
                }
 
                private void ReadAttributeDefaultValue (DTDAttributeDefinition 
def)

Modified: trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader2.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader2.cs       
2007-07-04 13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/DTDValidatingReader2.cs       
2007-07-04 13:19:57 UTC (rev 81332)
@@ -62,6 +62,8 @@
 
 */
 
+#if !NET_2_1_HACK
+
 using System;
 using System.Collections;
 #if NET_2_0
@@ -85,7 +87,10 @@
 #if NET_2_0
                IXmlNamespaceResolver,
 #endif
-               IHasXmlParserContext, IHasXmlSchemaInfo
+               IHasXmlParserContext
+#if !NET_2_1
+               , IHasXmlSchemaInfo
+#endif
        {
                public DTDValidatingReader (XmlReader reader)
                        : this (reader, null)
@@ -1260,3 +1265,5 @@
 
        }
 }
+
+#endif

Modified: trunk/mcs/class/System.XML/System.Xml/XmlException.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlException.cs       2007-07-04 
13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/XmlException.cs       2007-07-04 
13:19:57 UTC (rev 81332)
@@ -116,6 +116,32 @@
                        this.linePosition = linePosition;
                }
 
+#if NET_2_1
+               internal XmlException (string message, int lineNumber, int 
linePosition,
+                       object sourceObject, string sourceUri, Exception 
innerException)
+                       : base (
+                               GetMessage (message, sourceUri, lineNumber, 
linePosition, sourceObject),
+                               innerException)
+               {
+                       //hasLineInfo = true;
+                       this.lineNumber         = lineNumber;
+                       this.linePosition       = linePosition;
+                       //this.sourceObj                = sourceObject;
+                       this.sourceUri          = sourceUri;
+               }
+
+               private static string GetMessage (string message, string 
sourceUri, int lineNumber, int linePosition, object sourceObj)
+               {
+                       string msg = "XmlSchema error: " + message;
+                       if (lineNumber > 0)
+                               msg += String.Format 
(CultureInfo.InvariantCulture, " XML {0} Line {1}, Position {2}.",
+                                       (sourceUri != null && sourceUri != "") 
? "URI: " + sourceUri + " ." : "",
+                                       lineNumber,
+                                       linePosition);
+                       return msg;
+               }
+#endif
+
                #endregion
 
                #region Properties

Modified: trunk/mcs/class/System.XML/System.Xml/XmlReader.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlReader.cs  2007-07-04 13:17:45 UTC 
(rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/XmlReader.cs  2007-07-04 13:19:57 UTC 
(rev 81332)
@@ -35,10 +35,12 @@
 using System.Diagnostics;
 using System.IO;
 using System.Text;
+#if !NET_2_1
 using System.Xml.Schema; // only required for NET_2_0 (SchemaInfo)
 using System.Xml.Serialization; // only required for NET_2_0 (SchemaInfo)
+using Mono.Xml.Schema; // only required for NET_2_0
+#endif
 using Mono.Xml; // only required for NET_2_0
-using Mono.Xml.Schema; // only required for NET_2_0
 
 namespace System.Xml
 {
@@ -184,9 +186,11 @@
                public abstract ReadState ReadState { get; }
 
 #if NET_2_0
+#if !NET_2_1
                public virtual IXmlSchemaInfo SchemaInfo {
                        get { return null; }
                }
+#endif
 
                public virtual XmlReaderSettings Settings {
                        get { return settings; }
@@ -400,6 +404,9 @@
 
                private static XmlReader CreateValidatingXmlReader (XmlReader 
reader, XmlReaderSettings settings)
                {
+#if NET_2_1
+                       return reader;
+#else
                        XmlValidatingReader xvr = null;
                        switch (settings.ValidationType) {
                        // Auto and XDR are obsoleted in 2.0 and therefore 
ignored.
@@ -425,10 +432,9 @@
                        //      throw new NotImplementedException ();
 
                        return xvr != null ? xvr : reader;
+#endif
                }
-#endif
 
-#if NET_2_0
                void IDisposable.Dispose ()
                {
                        Dispose (false);
@@ -705,8 +711,8 @@
                        }
 
                        if (name != Name) {
-                               string error = String.Format ("The expected 
element is {0} but found {1} instead",
-                                                             name, Name);
+                               string error = String.Format ("The {0} tag from 
namespace {1} is expected.",
+                                                             Name, 
NamespaceURI);
                                throw XmlError (error);
                        }
 
@@ -722,7 +728,7 @@
                        }
 
                        if (localName != LocalName || NamespaceURI != 
namespaceName) {
-                               string error = String.Format ("The expected 
element is {0} from namespace {1}, but found {2} from namespace {3} instead",
+                               string error = String.Format ("Expecting {0} 
tag from namespace {1}, got {2} and {3} instead",
                                                              localName, 
namespaceName,
                                                              LocalName, 
NamespaceURI);
                                throw XmlError (error);

Modified: trunk/mcs/class/System.XML/System.Xml/XmlReaderSettings.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlReaderSettings.cs  2007-07-04 
13:17:45 UTC (rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/XmlReaderSettings.cs  2007-07-04 
13:19:57 UTC (rev 81332)
@@ -35,7 +35,9 @@
 using System.Net;
 using System.Xml.Schema;
 
+#if !NET_2_1
 using XsValidationFlags = System.Xml.Schema.XmlSchemaValidationFlags;
+#endif
 
 namespace System.Xml
 {
@@ -51,10 +53,12 @@
                private int linePositionOffset;
                private bool prohibitDtd;
                private XmlNameTable nameTable;
+#if !NET_2_1
                private XmlSchemaSet schemas;
                private bool schemasNeedsInitialization;
                private XsValidationFlags validationFlags;
                private ValidationType validationType;
+#endif
                private XmlResolver xmlResolver;
 
                public XmlReaderSettings ()
@@ -62,7 +66,9 @@
                        Reset ();
                }
 
+#if !NET_2_1
                public event ValidationEventHandler ValidationEventHandler;
+#endif
 
                public XmlReaderSettings Clone ()
                {
@@ -80,12 +86,14 @@
                        lineNumberOffset = 0;
                        linePositionOffset = 0;
                        prohibitDtd = true;
+#if !NET_2_1
                        schemas = null;
                        schemasNeedsInitialization = true;
                        validationFlags =
                                XsValidationFlags.ProcessIdentityConstraints |
                                XsValidationFlags.AllowXmlAttributes;
                        validationType = ValidationType.None;
+#endif
                        xmlResolver = new XmlUrlResolver ();
                }
 
@@ -142,6 +150,7 @@
                        set { nameTable = value; }
                }
 
+#if !NET_2_1
                public XmlSchemaSet Schemas {
                        get {
                                if (schemasNeedsInitialization) {
@@ -178,6 +187,7 @@
                        get { return validationType; }
                        set { validationType = value; }
                }
+#endif
 
                public XmlResolver XmlResolver {
                        internal get { return xmlResolver; }

Modified: trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs  2007-07-04 13:17:45 UTC 
(rev 81331)
+++ trunk/mcs/class/System.XML/System.Xml/XmlWriter.cs  2007-07-04 13:19:57 UTC 
(rev 81332)
@@ -33,7 +33,7 @@
 using System;
 using System.IO;
 using System.Text;
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
 using System.Xml.XPath;
 #endif
 
@@ -385,7 +385,7 @@
                                WriteString (localName);
                }
 
-#if NET_2_0
+#if NET_2_0 && !NET_2_1
                [MonoTODO] // FIXME: test defattr handling
                public virtual void WriteNode (XPathNavigator navigator, bool 
defattr)
                {

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to