From 775f8f8bd720c5ad61a0236d63bf602ecec9dc5f Mon Sep 17 00:00:00 2001 From: Atsushi Eno Date: Thu, 15 Dec 2005 14:40:17 +0000 Subject: 2005-10-05 Atsushi Enomoto * System.Configuration.dll.sources: added IntegerValidatorAttribute.cs, IntegerValidator.cs, LongValidator.cs and LongValidatorAttribute.cs. * IntegerValidatorAttribute.cs, IntegerValidator.cs, LongValidator.cs, LongValidatorAttribute.cs : new files. svn path=/trunk/mcs/; revision=54458 --- mcs/class/System.XML/System.Xml/ChangeLog | 7 +++++ mcs/class/System.XML/System.Xml/DTDObjectModel.cs | 38 +++++++++++++++++++++-- mcs/class/System.XML/System.Xml/XmlTextReader.cs | 1 + mcs/class/System.XML/System.Xml/XmlTextReader2.cs | 2 +- 4 files changed, 44 insertions(+), 4 deletions(-) (limited to 'mcs/class/System.XML') diff --git a/mcs/class/System.XML/System.Xml/ChangeLog b/mcs/class/System.XML/System.Xml/ChangeLog index 94522d42ece..c4d1f01a753 100644 --- a/mcs/class/System.XML/System.Xml/ChangeLog +++ b/mcs/class/System.XML/System.Xml/ChangeLog @@ -1,3 +1,10 @@ +2005-12-15 Atsushi Enomoto + + * DTDObjectModel.cs : some fixes on GetXmlSchema() + - make generated schema cleaner. + - enumeration was missing for attribute type. + * XmlTextReader.cs, XmlTextReader2.cs : added tiny notes for dtd2xsd. + 2005-12-15 Konstantin Triger * XmlTextWriter.cs: allow null string in WriteCData. diff --git a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs index 5cbebbd8913..715f4596651 100644 --- a/mcs/class/System.XML/System.Xml/DTDObjectModel.cs +++ b/mcs/class/System.XML/System.Xml/DTDObjectModel.cs @@ -445,15 +445,21 @@ namespace Mono.Xml SetLineInfo (el); el.RefName = new XmlQualifiedName (ElementName); return el; - } else { + } + else if (ChildModels.Count == 0) + return null; + else { XmlSchemaGroupBase gb = (OrderType == DTDContentOrderType.Seq) ? (XmlSchemaGroupBase) new XmlSchemaSequence () : new XmlSchemaChoice (); SetLineInfo (gb); - foreach (DTDContentModel cm in ChildModels.Items) - gb.Items.Add (cm.CreateXsdParticle ()); + foreach (DTDContentModel cm in ChildModels.Items) { + XmlSchemaParticle c = cm.CreateXsdParticle (); + if (c != null) + gb.Items.Add (c); + } p = gb; } switch (Occurence) { @@ -673,6 +679,30 @@ namespace Mono.Xml XmlSchemaElement el = new XmlSchemaElement (); SetLineInfo (el); el.Name = Name; + + XmlSchemaComplexType ct = new XmlSchemaComplexType (); + el.SchemaType = ct; + if (Attributes != null) { + SetLineInfo (ct); + foreach (DTDAttributeDefinition a in + Attributes.Definitions) + ct.Attributes.Add (a.CreateXsdAttribute ()); + } + if (IsEmpty) + ; // nothing to do + else if (IsAny) { + XmlSchemaAny any = new XmlSchemaAny (); + any.MinOccurs = 0; + any.MaxOccursString = "unbounded"; + ct.Particle = any; + } + else { + if (IsMixedContent) + ct.IsMixed = true; + ct.Particle = ContentModel.CreateXsdParticle (); + } + + /* if (IsEmpty) { el.SchemaType = new XmlSchemaComplexType (); SetLineInfo (el.SchemaType); @@ -692,6 +722,7 @@ namespace Mono.Xml ct.Particle = ContentModel.CreateXsdParticle (); el.SchemaType = ct; } + */ return el; } } @@ -839,6 +870,7 @@ namespace Mono.Xml f.Value = name; } } + st.Content = r; } else if (qname != XmlQualifiedName.Empty) a.SchemaTypeName = qname; diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader.cs b/mcs/class/System.XML/System.Xml/XmlTextReader.cs index dc04ba5ad8c..24ea805b176 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextReader.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextReader.cs @@ -695,6 +695,7 @@ namespace System.Xml #region Internals // Parsed DTD Objects + // Note that thgis property must be kept since dtd2xsd uses it. internal DTDObjectModel DTD { get { return parserContext.Dtd; } } diff --git a/mcs/class/System.XML/System.Xml/XmlTextReader2.cs b/mcs/class/System.XML/System.Xml/XmlTextReader2.cs index 31d0f49eb51..da97c7c377f 100644 --- a/mcs/class/System.XML/System.Xml/XmlTextReader2.cs +++ b/mcs/class/System.XML/System.Xml/XmlTextReader2.cs @@ -45,7 +45,7 @@ namespace System.Xml IXmlLineInfo, IXmlNamespaceResolver, IHasXmlParserContext { XmlTextReader entity; - XmlTextReaderImpl source; + XmlTextReaderImpl source; // dtd2xsd expects this field's existence. bool entityInsideAttribute; bool insideAttribute; -- cgit v1.2.3