System.Runtime.Serialization.XsdDataContractImporter.Import C# (CSharp) Method

Import() public method

public Import ( XmlSchemaSet schemas, XmlSchemaElement element ) : XmlQualifiedName
schemas System.Xml.Schema.XmlSchemaSet
element System.Xml.Schema.XmlSchemaElement
return System.Xml.XmlQualifiedName
		public XmlQualifiedName Import (XmlSchemaSet schemas, XmlSchemaElement element)
		{
			if (schemas == null)
				throw new ArgumentNullException ("schemas");
			if (element == null)
				throw new ArgumentNullException ("element");

			var elname = element.QualifiedName;

			switch (elname.Namespace) {
			case KnownTypeCollection.MSSimpleNamespace:
				switch (elname.Name) {
				case "char":
				case "duration":
				case "guid":
					return elname;
				}
				break;
			}

			// FIXME: use element to fill nillable and arrays.
			var qname = element.SchemaType != null ? element.QualifiedName : element.ElementSchemaType.QualifiedName;
			Import (schemas, element.ElementSchemaType, qname);
			return qname;
		}

Same methods

XsdDataContractImporter::Import ( XmlSchemaSet schemas ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, ICollection typeNames ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, XmlQualifiedName typeName ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, XmlSchemaType type ) : void
XsdDataContractImporter::Import ( XmlSchemaSet schemas, XmlSchemaType type, XmlQualifiedName qname ) : void

Usage Example

コード例 #1
0
		void IWsdlImportExtension.ImportContract (WsdlImporter importer,
			WsdlContractConversionContext context)
		{
			if (!enabled)
				return;

			if (importer == null)
				throw new ArgumentNullException ("importer");
			if (context == null)
				throw new ArgumentNullException ("context");
			if (this.importer != null || this.context != null)
				throw new SystemException ("INTERNAL ERROR: unexpected recursion of ImportContract method call");

			dc_importer = new XsdDataContractImporter ();
			schema_set_in_use = new XmlSchemaSet ();
			schema_set_in_use.Add (importer.XmlSchemas);
			foreach (WSDL wsdl in importer.WsdlDocuments)
				foreach (XmlSchema xs in wsdl.Types.Schemas)
					schema_set_in_use.Add (xs);
			dc_importer.Import (schema_set_in_use);

			this.importer = importer;
			this.context = context;
			try {
				DoImportContract ();
			} finally {
				this.importer = null;
				this.context = null;
			}
		}
All Usage Examples Of System.Runtime.Serialization.XsdDataContractImporter::Import