need help to declard type=IntType instead type="xsd:int" with xml schema

Hi,

I am writing C# code to produce xml schema.

			//Create attribute
			XmlSchemaAttribute att2 = new XmlSchemaAttribute();
			att2.Name = "CustomerID";
			att2.SchemaTypeName = new XmlQualifiedName("int",schemaNS);
			att2.Use = XmlSchemaUse.Required;
			ct.Attributes.Add(att2);


I need to produce schema with custom data type instead of the
xsd:string or xsd:int

The code above will produce the following schema

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema attributeFormDefault="unqualified" version="1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="Customer">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Order">
          <xsd:complexType>
            <xsd:attribute name="CustomerID" type="xsd:int"
use="required" />
            <xsd:attribute name="OrderID" type="xsd:int" use="required"
/>
          </xsd:complexType>
        </xsd:element>
      </xsd:sequence>
      <xsd:attribute name="CustomerID" type="xsd:StringType"
use="required" />
    </xsd:complexType>
  </xsd:element>
</xsd:schema>



I need to produce schema with

<xsd:attribute name="CustomerID" type="IntType" use="required" />
or
<xsd:attribute name="CustomerID" type="StringType" use="required" />


when I use
att2.SchemaTypeName = new XmlQualifiedName("IntType",schemaNS);

I get

<xsd:attribute name="CustomerID" type="xsd:IntType" use="required" />

How do I get the type to equal only "IntType" without the "xsd" part?

Thanks

0
10/27/2005 2:07:19 AM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
969 Views

Similar Articles

[PageSpeed] 17


comic_rage@yahoo.com wrote:


> <xsd:attribute name="CustomerID" type="IntType" use="required" />
> or
> <xsd:attribute name="CustomerID" type="StringType" use="required" />
> 
> 
> when I use
> att2.SchemaTypeName = new XmlQualifiedName("IntType",schemaNS);

I would simply try
   att2.SchemaTypeName = new XmlQualifiedName("IntType")
then if your type is in no namespace.
Or if that schema is going to have a targetNamespace then I think you 
need to use
   att2.SchemaTypeName = new XmlQualifiedName("IntType", 
"targetNamespaceURIGoesHere")

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
10/27/2005 11:03:06 AM
Reply:

Similar Artilces:

need help to declard type=IntType instead type="xsd:int" with xml schema
Hi, I am writing C# code to produce xml schema. //Create attribute XmlSchemaAttribute att2 = new XmlSchemaAttribute(); att2.Name = "CustomerID"; att2.SchemaTypeName = new XmlQualifiedName("int",schemaNS); att2.Use = XmlSchemaUse.Required; ct.Attributes.Add(att2); I need to produce schema with custom data type instead of the xsd:string or xsd:int The code above will produce the following schema <?xml version="1.0" encoding="utf-8"?> <xsd:schema attributeFormDefault="unqualified" version="1.0" xmlns:xsd=...