Help with XSD Schema

V

Vai2000

Hi all!!
This is my XML
<foo>
<item name="gold" carat="18">8987</item>
<item name="gold" carat="14">8907</item>
</foo>

AND THIS WAS THE SCHEMA GENERATED VIA THE VS IDE
I want the item_Text to be INTEGER type as well as name to Code instead of
item_Text !!! What changes are required in the schema for that?

TIA
<?xml version="1.0" ?>

<xs:schema id="foo" targetNamespace="http://tempuri.org/xsd_int.xsd"
xmlns:mstns="http://tempuri.org/xsd_int.xsd"
xmlns="http://tempuri.org/xsd_int.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">

<xs:element name="foo" msdata:IsDataSet="true"
msdata:EnforceConstraints="False">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="item" nillable="true">

<xs:complexType>

<xs:simpleContent msdata:ColumnName="item_Text" msdata:Ordinal="2">

<xs:extension base="xs:string">

<xs:attribute name="name" form="unqualified" type="xs:string" />

<xs:attribute name="carat" form="unqualified" type="xs:string" />

</xs:extension>

</xs:simpleContent>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

</xs:element>

</xs:schema>
 
S

Steve Alpert

I'd expect you want to change:

<xs:simpleContent msdata:ColumnName="item_Text" msdata:Ordinal="2">
<xs:extension base="xs:string">

to:

<xs:simpleContent msdata:ColumnName="item_Text" msdata:Ordinal="2">
<xs:extension base="xs:long">
^^^^^^^^

/steveA
 
V

Vai2000

Thanks Steve,I had tried that out using the following snippet

StringReader sr=new StringReader(xmlDoc);

DataSet ds2 =new DataSet();

ds2.ReadXmlSchema(@"myschema.xsd");

ds2.ReadXml(sr);

GOT ERRORED OUT SAYING "Input string was not in a correct format."



:(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top