Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Eno <atsushieno@gmail.com>2003-07-20 08:57:55 +0400
committerAtsushi Eno <atsushieno@gmail.com>2003-07-20 08:57:55 +0400
commit7fc66b4393c9bbc719cf64323569bb0818858aef (patch)
treeeaa11d3f9ffa103d0ceb10c08a981cddad809bc2
parentd51892ae10a373316dbfbfa35f25569356df0c17 (diff)
2003-07-20 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* XmlSchema.cs : added support for collecting missing type references at compilation-time. * XmlSchemaType.cs, XmlSchemaComplexType.cs, XmlSchemaSimpleType.cs: - Renamed qName to QNameInternal. - Added BaseSchemaType and ContentTypeParticle support. svn path=/trunk/mcs/; revision=16437
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/ChangeLog8
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchema.cs27
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs40
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs2
-rwxr-xr-xmcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs10
5 files changed, 61 insertions, 26 deletions
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
index 789db52a581..590f244a1e3 100755
--- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog
@@ -1,3 +1,11 @@
+2003-07-20 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+ * XmlSchema.cs : added support for collecting missing type references
+ at compilation-time.
+ * XmlSchemaType.cs, XmlSchemaComplexType.cs, XmlSchemaSimpleType.cs:
+ - Renamed qName to QNameInternal.
+ - Added BaseSchemaType and ContentTypeParticle support.
+
2003-07-19 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
* XmlSchema.cs, XmlSchemaAll.cs, XmlSchemaAnnotated.cs,
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
index 62022bd4f7d..5ca91efa3c3 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
@@ -45,6 +45,7 @@ namespace System.Xml.Schema
// post schema compilation infoset
private Hashtable idCollection;
+ private Hashtable missingBaseSchemaTypeRefs;
// Compiler specific things
private static string xmlname = "schema";
@@ -65,6 +66,7 @@ namespace System.Xml.Schema
notations = new XmlSchemaObjectTable();
schemaTypes = new XmlSchemaObjectTable();
idCollection = new Hashtable ();
+ missingBaseSchemaTypeRefs = new Hashtable ();
}
@@ -220,28 +222,11 @@ namespace System.Xml.Schema
get { return idCollection; }
}
- /*
- internal XmlSchemaForm ElementFormDefaultCompiled
+ internal Hashtable MissingBaseSchemaTypeRefs
{
- get { return elementFormDefaultCompiled; }
+ get { return missingBaseSchemaTypeRefs; }
}
- internal XmlSchemaForm AttributeFormDefaultCompiled
- {
- get { return attributeFormDefaultCompiled; }
- }
-
- internal XmlSchemaDerivationMethod BlockDefaultCompiled
- {
- get { return blockDefaultCompiled; }
- }
-
- internal XmlSchemaDerivationMethod FinalDefaultCompiled
- {
- get { return finalDefaultCompiled; }
- }
- */
-
#endregion
#region Compile
@@ -338,6 +323,10 @@ namespace System.Xml.Schema
}
}
}
+ // Add missing references.
+ foreach (XmlSchemaComplexType cType in missingBaseSchemaTypeRefs.Keys)
+ cType.BaseSchemaTypeInternal =
+ SchemaTypes [missingBaseSchemaTypeRefs [cType] as XmlQualifiedName];
foreach(XmlSchemaObject obj in Items)
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
index 987ecc6e4b4..ab7e9abe01a 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
@@ -160,6 +160,7 @@ namespace System.Xml.Schema
if (this.IsComplied (schema.CompilationId))
return 0;
+ // block/final resolution
if(istoplevel)
{
if(this.Name == null || this.Name == string.Empty)
@@ -167,7 +168,7 @@ namespace System.Xml.Schema
else if(!XmlSchemaUtil.CheckNCName(Name))
error(h,"name must be a NCName");
else
- this.qName = new XmlQualifiedName(Name, schema.TargetNamespace);
+ this.QNameInternal = new XmlQualifiedName(Name, schema.TargetNamespace);
if(Block != XmlSchemaDerivationMethod.None)
{
@@ -234,20 +235,56 @@ namespace System.Xml.Schema
error(h,"block must be absent in a local complex type");
}
+ // Process contents and BaseSchemaType
if(ContentModel != null)
{
if(anyAttribute != null || Attributes.Count != 0 || Particle != null)
error(h,"attributes, particles or anyattribute is not allowed if ContentModel is present");
+ XmlQualifiedName baseTypeName = null;
if(ContentModel is XmlSchemaSimpleContent)
{
XmlSchemaSimpleContent smodel = (XmlSchemaSimpleContent)ContentModel;
errorCount += smodel.Compile(h,schema);
+
+ XmlSchemaSimpleContentExtension sscx = smodel.Content as XmlSchemaSimpleContentExtension;
+ if (sscx != null)
+ baseTypeName = sscx.BaseTypeName;
+ else {
+ XmlSchemaSimpleContentRestriction sscr = smodel.Content as XmlSchemaSimpleContentRestriction;
+ baseTypeName = sscr.BaseTypeName;
+ if (sscr.BaseType != null) {
+ sscr.BaseType.Compile (h, schema);
+ BaseSchemaTypeInternal = sscr.BaseType;
+ }
+ }
}
else if(ContentModel is XmlSchemaComplexContent)
{
XmlSchemaComplexContent cmodel = (XmlSchemaComplexContent)ContentModel;
errorCount += cmodel.Compile(h,schema);
+
+ XmlSchemaComplexContentExtension sccx = cmodel.Content as XmlSchemaComplexContentExtension;
+ if (sccx != null) {
+ contentTypeParticle = sccx.Particle;
+ baseTypeName = sccx.BaseTypeName;
+ }
+ else {
+ XmlSchemaComplexContentRestriction sccr = cmodel.Content as XmlSchemaComplexContentRestriction;
+ contentTypeParticle = sccr.Particle;
+ baseTypeName = sccr.BaseTypeName;
+ }
+ }
+
+ // fill base schema type
+ if (BaseSchemaTypeInternal == null && baseTypeName != null) { // simple content restriction may have type itself.
+ if (baseTypeName.Namespace == XmlSchema.Namespace)
+ BaseSchemaTypeInternal = XmlSchemaDatatype.FromName (baseTypeName);
+ else {
+ BaseSchemaTypeInternal = schema.SchemaTypes [baseTypeName];
+ if (BaseSchemaTypeInternal == null)
+ schema.MissingBaseSchemaTypeRefs.Add (this, baseTypeName);
+ }
}
}
else
@@ -272,6 +309,7 @@ namespace System.Xml.Schema
XmlSchemaSequence xss = (XmlSchemaSequence)Particle;
errorCount += xss.Compile(h,schema);
}
+ this.contentTypeParticle = Particle;
if(this.anyAttribute != null)
{
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
index 5782ca77efc..8f7758d6a07 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
@@ -71,7 +71,7 @@ namespace System.Xml.Schema
else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2
error(h,"name attribute of a simpleType must be NCName");
else
- this.qName = new XmlQualifiedName(this.Name,schema.TargetNamespace);
+ this.QNameInternal = new XmlQualifiedName(this.Name,schema.TargetNamespace);
//NOTE: Although the FinalResolved can be Empty, it is not a valid value for Final
//DEVIATION: If an error occurs, the finaldefault is always consulted. This deviates
diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
index e1a24b97c17..1b79eaae8dd 100755
--- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
+++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaType.cs
@@ -12,19 +12,19 @@ namespace System.Xml.Schema
/// </summary>
public class XmlSchemaType : XmlSchemaAnnotated
{
- private object baseSchemaType;
+ internal object BaseSchemaTypeInternal;
private XmlSchemaDatatype datatype;
private XmlSchemaDerivationMethod derivedBy;
private XmlSchemaDerivationMethod final;
internal XmlSchemaDerivationMethod finalResolved;
private bool isMixed;
private string name;
- internal XmlQualifiedName qName;
+ internal XmlQualifiedName QNameInternal;
public XmlSchemaType()
{
final = XmlSchemaDerivationMethod.None;
- qName = XmlQualifiedName.Empty;
+ QNameInternal = XmlQualifiedName.Empty;
}
#region Attributes
@@ -44,7 +44,7 @@ namespace System.Xml.Schema
[XmlIgnore]
public XmlQualifiedName QualifiedName
{
- get{ return qName; }
+ get{ return QNameInternal; }
}
[XmlIgnore]
public XmlSchemaDerivationMethod FinalResolved
@@ -54,7 +54,7 @@ namespace System.Xml.Schema
[XmlIgnore]
public object BaseSchemaType
{
- get{ return baseSchemaType; }
+ get{ return BaseSchemaTypeInternal; }
}
[XmlIgnore]
public XmlSchemaDerivationMethod DerivedBy