How to write xml file using existing XML Schema file?

How to write xml file using existing XML Schema file?

Post by aspfun via » Sun, 15 Nov 2009 02:30:56


My app used myDataset.xmlwrite to export dataset to xml file. It works fine
for data but first two lines need to modify as existing XML Schema file.
Below are the difference in first two lines:

New xml file:

<?xml version="1.0" standalone="yes" ?>
<NewDataSet>
<SpecSum>
<USER>ANDYK</USER>
<Grouper>Allergy/Immunology</Grouper>
<Auths>0</Auths>
<Cost>0</Cost>
</SpecSum>
<SpecSum>

Old xml file:

<?xml version="1.0" encoding="UTF-8" ?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2009-11-
12T09:19:20">
<SpecSum>
<USER>ANDYK</USER>
<Grouper>Allergy/Immunology</Grouper>
<Auths>0</Auths>
<Cost>0</Cost>
</SpecSum>
<SpecSum>

How to change?

from

<?xml version="1.0" standalone="yes" ?>
<NewDataSet>

to

<?xml version="1.0" encoding="UTF-8" ?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2009-11-
12T09:19:20">

(generated="2009-11-12T09:19:20" wil changed based on run time)

--
Message posted via DotNetMonster.com
http://www.yqcomputer.com/
 
 
 

How to write xml file using existing XML Schema file?

Post by Martin Hon » Sun, 15 Nov 2009 03:41:59


You could try to create an XmlDataDocument from your DataSet and then
manipulate that XmlDataDocument and Save it e.g.
XmlDataDocument doc = new XmlDataDocument(yourDataSetInstance);
doc.DocumentElement.SetAttribute("generated",
XmlConvert.ToString(DateTime.Now));
would add that 'generated' attribute.

--

Martin Honnen --- MVP XML
http://www.yqcomputer.com/

 
 
 

How to write xml file using existing XML Schema file?

Post by Gregory A. » Sun, 15 Nov 2009 04:20:53

"aspfun via DotNetMonster.com" <u53138@uwe> wrote in



I would create an XSLT file out of the schema and do a transform.

Peace and Grace,
Greg

--
Vote for Miranda's Christmas Story
http://www.yqcomputer.com/

Twitter: @gbworld
Blog: http://www.yqcomputer.com/

*******************************************
| Think outside the box! |
*******************************************