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>2009-01-22 07:55:40 +0300
committerAtsushi Eno <atsushieno@gmail.com>2009-01-22 07:55:40 +0300
commitc88cc5165897a7f014d616220b164dd475caac2d (patch)
treecfc2d1e19e707b2fa74b65ed529578363d606091 /mcs/class/System.XML/System.Xml.Serialization
parent5280a95b2f8359bd31b512cc74b6ec81af9ed0b8 (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')
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/ChangeLog3
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs24
2 files changed, 19 insertions, 8 deletions
diff --git a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
index 2f00d84c552..02358c9122e 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
+++ b/mcs/class/System.XML/System.Xml.Serialization/ChangeLog
@@ -1,3 +1,6 @@
+2009-01-22 Atsushi Enomoto <atsushi@ximian.com>
+
+ * XmlSchemaImporter.cs : hack ImportSchemaType().
2008-12-10 Gonzalo Paniagua Javier <gonzalo@novell.com>
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 ();