By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,558 Members | 1,675 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,558 IT Pros & Developers. It's quick & easy.

How is this done?

P: n/a
I am planning on writing an application, where, before the user can do
anything, he/she must open up a file...

.... it would be an XML file, which contains all the data that he/she
needs in order to work w/ the program.

The XML file has a corresponding .XSD (schema).

So there are really 2 files.

Here's the question: I would like the XML and XSD to be a SINGLE file.
So the user would start by going to File > Open, and selecting that
single file. I don't want the user to have to open up an XML and also
an XSD... too complicated, and it's not standard to the way most
programs work.

I also want it to be a single file, so it is easily portable from
computer to computer. (Like an MS word .doc is a single file that can
be opened anywhere MS Word is installed)

How is this done? Should all the data be combined in a single file, and
then when it's opened, it's parsed out: one part parsed out and saved
as an XML file, and the other parsed and saved as an XSD.

Can anyone give suggestions?

Thanks!
John

Nov 21 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
John,

If I did understand you than is the answer for me

Use a dataset. That is extremely handy for what you want to do.

Cor
Nov 21 '05 #2

P: n/a
Why not have them open the XML file and then the program opens the XSD file
automatically (assuming they are named the same)

"johnb41" <or****@informatik.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I am planning on writing an application, where, before the user can do
anything, he/she must open up a file...

... it would be an XML file, which contains all the data that he/she
needs in order to work w/ the program.

The XML file has a corresponding .XSD (schema).

So there are really 2 files.

Here's the question: I would like the XML and XSD to be a SINGLE file.
So the user would start by going to File > Open, and selecting that
single file. I don't want the user to have to open up an XML and also
an XSD... too complicated, and it's not standard to the way most
programs work.

I also want it to be a single file, so it is easily portable from
computer to computer. (Like an MS word .doc is a single file that can
be opened anywhere MS Word is installed)

How is this done? Should all the data be combined in a single file, and
then when it's opened, it's parsed out: one part parsed out and saved
as an XML file, and the other parsed and saved as an XSD.

Can anyone give suggestions?

Thanks!
John

Nov 21 '05 #3

P: n/a
A dataset isn't actually a "file" that the user can open, is it? To
get info into a dataset, you have to either get it from a datasource
(database, or xml), or create a dataset from scratch. The user needs
to open data that already exists, so creating it from scratch is not an
option.

If a dataset can be opened as a standalone file, then please show me
how! :)

John

Nov 21 '05 #4

P: n/a
Terry,

Thanks for helping! The problem is that there are still 2 files. If
the XML file gets moved to a different computer, then the XSD will
probably get forgotten. To the end-user, it would not be obvious that
there are always 2 files that must be used.

John

Nov 21 '05 #5

P: n/a
John,

It is so easy I type it in this message so watch typos

\\\
Dim ds as new dataset
dim dt as new datatable
dt.columns.add("john")
dt.rows.add(dt.newrow)
dt.rows(0)(0) = "Hello John"
ds.tables.add(dt)
ds.writexml("C:\mydataset")
///

(reading is ds.readxml(":\mydatasert")

Is that difficult, I did not think so.

I hope this helps,

Cor
Nov 21 '05 #6

P: n/a
My current application actually is very similar to this. But instead
of creating a dataset from scratch, my dataset is created from a
ds.readxml. I then add rows, del rows, edit rows, etc. and then
ds.writexml it back to the same xml file.

Anyway, after seeing your code, I thought it still would not work
because I also need an xml schema (xsd), and that is a separate file.

But after playing around, i realized that when doing ds.writexml, there
is a constructor that actually adds a schema into the xml file. So the
result is a single file.

So as it stands, I think this will work for me, and not much XML
expertise is needed. Phew!

Thanks for your help!

John

Nov 21 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.