Thanx vMike, but I don't think I'm being clear. In your code, you wrote
'Load the XML data.
doc.Load(yourxmlfilename)
which suggests to me that the "yourxmlfilename" file is ALREADY populated
with data and if so, that isn't what I mean. Effectively that is taking a
"populated" XML file, loading it into a DataSet, modifying it and the writing
it back to the XML File.
I am talking about STARTING with JUST the XML schema, without ANY data.
Creating a DataSet (NOT FROM AN XML FILE) right from the database that
matches the requirement of this schema and POPULATING an EMPTY XML File with
the data from the DataSet in the XML formate specified by the Schema.
Do you understand? A DATALESS Schema + a DataSet (NOT FROM AN XML FILE BUT)
from the database itself and outputing an XML FILE that is populated with the
data from the DataSet and in the format of the Schema.
"vMike" wrote:
"Sindarian" <Si*******@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com... This just seems like the most basic thing, but I can't find a simple
description of this process anywhere and in here, everone is talking about
going the other way :( I had .NET create an XML Schema file (xsd) for a
table in my database. I then create a DataSet that contains 1 row of data from
that same table. I want to use this DataSet along with the Schema file to
create an XML file that ACTUALLY CONTAINS THE DATA. Simple huh: DataSet +
Schema -> Test.xml file WITH DATA. Would someone please show me how that is done?
This snip takes an existing xml file, changes the data and saves it. Maybe
it will give you some ideas.
Dim doc as XmlDataDocument = new XmlDataDocument()
'Load the schema.
doc.DataSet.ReadXmlSchema(yourschemafile)
'Load the XML data.
doc.Load(yourxmlfilename)
Dim dt as DataTable = doc.DataSet.Tables("yourtablename")
dim dv as dataview = new dataview(dt)
do data manipulation here
doc.Save(yourxmlfilename)
Mike