XSD

R

RS

I have a Dataset that filled with data from a serious of flat files. Is
there a way to write XML from this Dataset per predefined XSD schema?
 
C

Cowboy

You can write out XSD from the DataSet.

If you are asking "can I magically make data conform to XSD", the answer is
no, unless the data already conforms. You can validate data against an XSD,
but you will have to transform data to have it fit an XSD, if it does not
already conform. XSLT is your baby for this.

Hope I am answering what you want answered. As I am a bit confused on the
question, I may be off base.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
W

William Ryan eMVP

It really depends on the structure of the files how you should approach it,
but the short answer is Yes, it's definitely possible.

You can just declare an instance of the dataset(based on the xsd) and add
those values to it. How you go about it can vary greatly so I'll have to
pause on this until I cna find out a little more about the data.

Also, depending on the delimmitter you may be able to use the text file as a
datasource, and call DataAdapter.Fill on it loading it into a dataset.
Whether this will be a clean fit or not once again depends on the structure.
If they match, that's all there is to it. If not, you'll need to iterate
through stuff and add the values so depending on the structure, this could
be a task accomplishable in 3-5 lines of code or it could be a Lot more.
Similarly, you can point your XML file to the schema if it fits naturally.

Let me know about the structure a little more. Do the delimmitters match
something so each delimmiter represents an element. How are they delimmited?
 
R

RS

1) I create new dataset
2) I read schema in to the dataset
3) after that i take values from text file and populate different tables in
the dataset.

Problem comes when i write XML out. I write it out and it looks good,
However my client expects the XML tags in certain order, and that what i
have problem with. My guess is insted of parcing they read it line by line
and they need an exact order to make their solution work.

Thanks,
 
R

RS

When i write out the XMl it comes out fine with out any problems exept the
oprder of the tags.
 
W

William Ryan eMVP

Right but is the order of the columns in the XSD the same as the order you
want them to be? They should be but depending on the relations they
probably won't


If the XML doc needs to be 1,2,3,4,5

Then are columns 1,2,3,4,5 in the dataset? Or I a relation or something
else causing ti to be 13452 or somethign like that?
 

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