diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2009-01-22 07:55:40 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2009-01-22 07:55:40 +0300 |
commit | c88cc5165897a7f014d616220b164dd475caac2d (patch) | |
tree | cfc2d1e19e707b2fa74b65ed529578363d606091 /mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs | |
parent | 5280a95b2f8359bd31b512cc74b6ec81af9ed0b8 (diff) |
2009-01-22 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaImporter.cs : hack ImportSchemaType().
svn path=/trunk/mcs/; revision=124164
Diffstat (limited to 'mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs')
-rw-r--r-- | mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs index a4a28896ef3..6ee4e787e8c 100644 --- a/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs +++ b/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs @@ -355,22 +355,23 @@ namespace System.Xml.Serialization throw new NotImplementedException (); } - [MonoTODO] public XmlTypeMapping ImportSchemaType (XmlQualifiedName typeName) { - throw new NotImplementedException (); + return ImportSchemaType (typeName, typeof (object)); } - [MonoTODO] public XmlTypeMapping ImportSchemaType (XmlQualifiedName typeName, Type baseType) { - throw new NotImplementedException (); + return ImportSchemaType (typeName, typeof (object), false); } - [MonoTODO] + [MonoTODO ("baseType and baseTypeCanBeIndirect are ignored")] public XmlTypeMapping ImportSchemaType (XmlQualifiedName typeName, Type baseType, bool baseTypeCanBeIndirect) { - throw new NotImplementedException (); + XmlSchemaType stype = + (XmlSchemaType) schemas.Find (typeName, typeof (XmlSchemaComplexType)) ?? + (XmlSchemaType) schemas.Find (typeName, typeof (XmlSchemaSimpleType)); + return ImportTypeCommon (typeName, typeName, stype, true); } #endif @@ -449,7 +450,14 @@ namespace System.Xml.Serialization XmlSchemaElement elem = (XmlSchemaElement) schemas.Find (name, typeof (XmlSchemaElement)); if (!LocateElement (elem, out qname, out stype)) throw new InvalidOperationException (String.Format ("'{0}' is missing.", name)); - + return ImportTypeCommon (name, qname, stype, elem.IsNillable); + } + + // FIXME: name and qname are confusing. Rename one either + // (name is in schema itself, qname is for actual processing. + // For example simple types have qname as in xsd namespace.) + private XmlTypeMapping ImportTypeCommon (XmlQualifiedName name, XmlQualifiedName qname, XmlSchemaType stype, bool isNullable) + { if (stype == null) { if (qname == anyType) { // Importing anyType. @@ -473,7 +481,7 @@ namespace System.Xml.Serialization map = CreateTypeMapping (qname, SchemaTypes.Class, name); map.Documentation = GetDocumentation (stype); - map.IsNullable = elem.IsNillable; + map.IsNullable = isNullable; RegisterMapFixup (map, qname, (XmlSchemaComplexType)stype); BuildPendingMaps (); |