XMLTypeCode & simple Type Defines

JaedenRuiner

Well-known member
Joined
Aug 13, 2007
Messages
340
Programming Experience
10+
For the XmlSchema, there are many situations where you are defining the "type" of an element or attribute. however, every such example that shows how to use these is formatted in much like this:

VB.NET:
e = New Xml.Schema.XmlSchemaElement()
e.Name = "MyElem"
e.SchemaTypeName = new Xml.XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema")

Now, far be it for me to judge, but it seems that with the XmlTypeCode enumeration in place, ins't there some listing or command to get the "qualifed" name of the simple basic types from the standard namespace. the xmlschema namespace as above has a slew of default types, but it appears a bit...dodgey to require a " " input of the type name. because "String" is different that "string", etc.

Just wondering if something like that exists so I can just do a:
VB.NET:
e.SchemaTypeName  = XSTypeName(XmlTypeCode.Integer)
[code]

(I am resigned to have to write this myself, i'm just checking before I do)
thanks
 
will this do:
VB.NET:
el.SchemaType = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.String)
 
Not really. I first thought of trying that too, but:

XmlSchemaElement.SchemaType
VB.NET:
      e = New Xml.Schema.XmlSchemaElement()
      e.Name = "dbmap"
      e.SchemaType = Xml.Schema.XmlSchemaType.GetBuiltInSimpleType(Xml.Schema.XmlTypeCode.String)
Output:
VB.NET:
    <xs:sequence>
      <xs:element name="dbmap">
        <xs:simpleType>
          <xs:restriction base="xs:anySimpleType" />
        </xs:simpleType>
      </xs:element>
    </xs:sequence>

XmlSchemaElement.SchemaTypeName
VB.NET:
      e = New Xml.Schema.XmlSchemaElement()
      e.Name = "dbmap"
      e.SchemaTypeName = New Xml.XmlQualifiedName("string", ns)
Output:
VB.NET:
    <xs:sequence>
      <xs:element name="dbmap" type="xs:string" />
    </xs:sequence>

Thanks though,
 
what if you mix them:
VB.NET:
el.SchemaTypeName = XmlSchemaType.GetBuiltInSimpleType(XmlTypeCode.String).QualifiedName
 
Back
Top