471,334 Members | 1,472 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,334 software developers and data experts.

dataset and xsd

Hi group...

I am having big difficulties with dataset and xsd schemas.
First I dedicate a specific schema to a dataset. Then I use an adapter
to fill each table in the dataset.
But the problem is, when I use the write or getxml on the dataset, the
result is NOT like the schema I provided the dataset which I think
should not be possible.
I hope to get some idea how to correct my problem.

Here is more detailed information:

I have a databse with 3 tables:
'InformationData' which holds IdNumber, Name.
'Content' which holds Name, Value
'Setup' which holds Identifyer, Value.

My Schema looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="InformationSet">
<xs:complexType>
<xs:sequence>
<xs:element name="InformationData">
<xs:complexType>
<xs:sequence>
<xs:element name="IdNumber" type="xs:string" />
<xs:element name="Name" type="xs:string" />
<xs:element name="Content" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Setup" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Identifyer" type="xs:string" />
<xs:element name="Value" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

What i am doing now is:
myDataset.ReadXmlSchema(schemaFile); //schemaFile is the above schema
/* Some connection to the first table in the db here */
myAdapter.MissingSchemaAction = MissingSchemaAction.Error;
myAdapter.Fill(myDataset, "InformationData");
/* Some connection to another table in the db here */
myAdapter.MissingSchemaAction = MissingSchemaAction.Error;
myAdapter.Fill(myDataset, "Content");
/* Some connection to third table in the db here */
myAdapter.MissingSchemaAction = MissingSchemaAction.Error;
myAdapter.Fill(myDataset, "Setup");

What I am expecting from the above xsd, when running a .write()
or .getxml() on the dataset is this:

expected.xml:
<?xml version="1.0" standalone="yes"?>
<InformationSet>
<InformationData>
<IdNumber>Test</IdNumber>
<Name>Pony</Name>
<Content>
<Name>SomeName</Name>
<Value>SomeValue</Value>
</Content>
<Setup>
<Identifyer>SomeIdentifyer</Identifyer>
<Value>SomeValue</Value>
</Setup>
</InformationData>
</InformationSet>

But this is not the case! Instead I am getting this:

extracted.xml:
<?xml version="1.0" standalone="yes"?>
<InformationSet>
<InformationData>
<IdNumber>Test</IdNumber>
<Name>Pony</Name>
</InformationData>
<Content>
<Name>SomeName</Name>
<Value>SomeValue</Value>
</Content>
<Setup>
<Identifyer>SomeIdentifyer</Identifyer>
<Value>SomeValue</Value>
</Setup>
</InformationSet>

As you can see, there is just three ordinary tables in the dataset/xml
(you can see this by the position of the InformationData-tag. Somehow
the xsd is completely ignored.
When I try to load the "wrong" extracted xml from above into a dataset
with the schema provided (by using the .readxml() and .readxmlschema I
get an error. But when doing so with the one I expect I get no errors.

Can someone tell my how to fill the dataset correct? :o)
I need a xml which looks like the expected.xml

Regards
- rick -
Jun 1 '08 #1
0 1519

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeronimo Bertran | last post: by
5 posts views Thread by Mike | last post: by
3 posts views Thread by JJ | last post: by
5 posts views Thread by Jason | last post: by
2 posts views Thread by John Holmes | last post: by
15 posts views Thread by JIM.H. | last post: by
16 posts views Thread by Geoff Jones | last post: by
22 posts views Thread by Arne | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.