How to write xml file using existing XML Schema file?

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.dotnetmonster.com/Uwe/Forums.aspx/asp-net/200911/1

0
aspfun
11/13/2009 5:30:56 PM
dotnet.framework.aspnet 1423 articles. 0 followers. Follow

2 Replies
800 Views

Similar Articles

[PageSpeed] 43

aspfun via DotNetMonster.com wrote:
> 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)
> 

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://msmvps.com/blogs/martin_honnen/
0
Martin
11/13/2009 6:41:59 PM
"aspfun via DotNetMonster.com" <u53138@uwe> wrote in
news:9f10144734d1c@uwe: 

> 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. 

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://tinyurl.com/mirandabelieve

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
|      Think outside the box!             |
*******************************************
0
Gregory
11/13/2009 7:20:53 PM
Reply:

Similar Artilces:

Need help getting files from Exchange Server.
We have a computer that had an account on Outlook attached to a Microsoft exchange server. Apparently for the moment, this computer and the server are inextricably tied together. Outlook cannot even be started without logging into the server because information store or whatever is missing. How do you get the information out of the exchange server to wean the computer from it? tom <Spamblocker@ameritech.net> wrote: > We have a computer that had an account on Outlook > attached to a Microsoft exchange server. > > Apparently for the moment, this computer and the > se...

Using it internationally
How adaptable would Money be to use in Sweden? How much functionality would I lose when I move? (Compared to Quicken. I am moving to Sweden and can't decide which of the two would be best when living there...the one that is most adoptable to international situations. Both allow currency changes but neither import from Swedish banks, but I'm curious about any other differences that would make Money better for my situation.) Thanks! Hi Dan, I'm using Money (US edition) in Spain, since I moved back home, and it works well. Obviously, I can't import from Spanish banks, but...

when i save a file that i have worked on, excel7 closes down work.
i have recently purchased office pro 2007. Excel 2007, when i save a filethat i have worked on, excel closes down and work is lost, done all updates, re installed from disc, please help i have lost 2 hours of work this moring that i need for a report a few questions: 1. what happens with save as? 2. what happens in safe mode? (hold shift key while starting excel) 3. do you have add-ins? 4. what operating system? x64? -- Gary Keramidas Excel 2003 "rob" <rob@discussions.microsoft.com> wrote in message news:0483F09B-3289-42B4-8849-0C0A61380B11@mic...

How to get TASK_ID field for summary tasks without using Project.a
I know for tasks which are not summary tasks we can get TASK_ID field using statusing web service. But i could nto find any other options than Project web service to get TASK_ID field for summary tasks and the top level project task. Problem of using Project web service is that in my custom sharedpoint web part where we are using PSI web services we get all the data required using Resource and Statusing web service for the logged in resource. But Statusing web service retrieves TASK_ID only for actual tasks and not for summary tasks. Now just to get TASK_ID of summary tas...

How to change .pst file location on hard drive(s)?
I want to move my .PST file c/w archives to a partition other than C:\. How can I do this with Win Live Mail? Thanks, John. "Machinist60" <e_john_wilson.no.spam.@hotmail.com> wrote in message news:hj5s5l$q8r$1@news.eternal-september.org... > I want to move my .PST file c/w archives to a partition other than C:\. > How can I do this with Win Live Mail? > > Thanks, John. I didn't realize WLM utilized the .pst file. I had to convert my .pst file data into the Windows Mail format and then import the data into WLM. Please explain what you...

Just saved file, cannot be found. ?
Even Global search ? Win 7 ... Whatz up? if you saved it, it should be in the mru list? what version of excel are you using? -- Gary Keramidas Excel 2003 "Boswell" <Boswell@discussions.microsoft.com> wrote in message news:E9D6ED74-ABC5-469D-9572-2D8AE93F36CD@microsoft.com... > Even Global search ? > > Win 7 ... > > Whatz up? one other question, how did you open it, outlook email? if that's the case, search will never find it. it is probably here: C:\Users\Your user name\AppData\Local\Microsoft\Windows\Temporary Intern...

Permissions is not allowing me to use my print preview.
Help! Don't understand My Permission in Excel. Even though I unrestrict, it still doesn't allow me to Preview my documents. How do I reset? Please Help, ...

Excel 2003 file freezes laptop
I took a laptop away from the office and tried to open a large spreadsheet on the local C: drive. Each time I tried the laptop froze and had to be rebooted. When I connected back to the LAN at work, and opened the same file on the local C: drive I had no problems. What could cause this? If there is any corruption is there a way to decompile or something as you would in Access? Thanks, Mich ...

Transferring Field from Existing Table/limitations and change of d
Thank you in advance for your help! I have two Excel spreadsheets that I successfully imported into Access 2003 and created tables for. I need to add the field from one table to the other, but there is not a direct match in the relationship. The large table uses the Employee ID as the primary key. The smaller table contains one field that lists a subset of these Employee ID numbers (a selection of certain employees). I need to transfer this field to the larger table, but I do not know how to tell Access to match up the corresponding numbers (i.e., the large table lists all employees, bu...

How do I TRIM a field in existing fields....?
I didn't realize when I imported some data into my database that there were a bunch of spaces after all the data. I know that I can do a RTRIM the data in a query, but I don't want to have to remember every time I create a query to TRIM it. Do I have to use a query and make a temp table and then delete the data from my original table and then put the data back in from my temp table. I can do this, but wanted to know if there is a better way. Thanks Kelvin Kelvin A standard approach to importing (and "cleaning") data is to import/append to a temporary table, then ...

How to search against XML files in the file system?
Putting the search textbox on the page is the easy part. What's preferred way to find terms in XML files located on the file system? Like finding stuff saved in XML files some of the blogs use these days to store their blog items? There can be lots and lots and lots of XML files on the file system to search. -- <%= Clinton Gallagher NET csgallagher AT metromilwaukee.com URL http://clintongallagher.metromilwaukee.com/ clintonG wrote: > Putting the search textbox on the page is the easy part. What's preferred > way to find terms in XML files located ...

OT: managing file fragmentation on external USB backup drive (SBS2003)
Just wondering how others are managing file fragmentation on their external USB backup drives (SBS 2003)? I have two WD 500GB drives that i rotate weekly (each backup is around 55GB currently) but periodically the server will "freeze" during a backup (fans on, but no response at all) and requires a hard reboot to get going again. The first time it did it, i had no idea what caused it, but on subsequent occurrences I narrowed it down to the external hard drive itself - after the reboot, simply trying to access the drive via Windows Explorer on the server caused the se...

Unattend configure Send/Receive Group / PRF file -Outlook XP
Hi, Have to rollout 4000 laptops with Offline Storage enabled. I want to automatically configure outlook to: - use OST file - Synchronize when logging on and off - Download and sync. the general address book I have made a PRF file (using CIW) that creates OST file...so far so good... But I can't unattend set the option to sync when logging on and off. It seems this setting is stored in an SRS file in the users profile!! Second item, default the first address book in the list is synchronised. Is there a way to auto configure Outlook XP to sync OST fiel when logging on and off, (ins...

Recovery excel file
Anybody knows if there is any free tools to recover a advanced excel file (using macro, graphics, formulas, and several formats)???????? Tks, Marcelo Rayol ...

Open 2003 files with 2007
Hello all, I just upgraded my Office 2003 with Office 2007 on an EP Pro machine. The only snaffoo I find(so far..) is with Excel 2007. When I double-click on an Excel 2003 file, Excel 2007 starts up just fine, BUT my file is not displayed. At that point if I click the Restore button up at top-right, the file appears when Excel is restored up or down, then all is well. Anyone have any idea whats up with that and how to fix it??? Thanks John Lots of people have complained that when they doubleclick on a file in windows explorer, that the workbook doesn't seem to show up in xl20...

copy rows to another file
Dear Experts I have following code,i need to copy desirde rows to new file (r.xls) on sheet 1. This code is able to copy desired rows from active sheet to sheet2(same file) based on values in column G. Would you please guide me? regards Sub Marine() Dim arrParts() As String Dim MyRange As Range, CopyRange As Range Dim LastRow As Long LastRow = Cells(Cells.Rows.Count, "G").End(xlUp).Row Set MyRange = Range("G1:G" & LastRow) response = InputBox("Enter rows to copy in the format nnn,nnn,nn") arrParts = Split(response, ",") For Each ...

Question on multiple NICs used by Exchange 2003
I have a requirement to bind four virtual SMTP servers to unique IP addresses. The server has four NICs and each IP address is uniquely bound to a virtual SMTP server. I used telnet to confirm that the appropriate virtual SMTP server responds to each assigned IP address. In case you are wondering why I did not use virtual IP addresses- Per Microsoft, the virtual IP address schema will not satisfy our requirement that the same IP address be used for sending (relaying) the e-mail that received it. Their recommendation was to have a NIC for each virtual SMTP server. The problem that I am ex...

Appending XML to an existing XML file
Hey all, I've read a few articles about speed and XML processing - so I just want to make sure that I'm using the right strategy for what I want to achieve. I have an XML file that I'm appending to every time a user submits their information. Right now I'm using XMLDocument (Load and Save) in conjuncture with XmlElement objects. Is this the right approach or is there a faster approach? Thanks, Novice PS Here is a simplified version of what I'm doing: XmlDocument xdoc = new XmlDocument(); xdoc.Load("results.xml"); XmlNode node = xdoc.SelectSingleNode("...

How do I export .dba calendar files from a Palm Treo to Outlook?
Chapura won't do it. Something about a problem with calendar files. ...

How to write schema
How to write xsd schema for the element which has both child element and text value? The xml fragment seems like this: <content> aaaaaaaaaa<mark />aaaaa<mark>m</mark>aaaaaa </content> Hello! > How to write xsd schema for the element which has both child element and > text value? > > The xml fragment seems like this: > <content> > aaaaaaaaaa<mark />aaaaa<mark>m</mark>aaaaaa > </content> You may be looking for "Mixed Content" (mixed="true") <http://www.w3.org/TR/xmlschema-0/...

File Naming for Picture Order
I want my photos within a folder to appear in a certain order and want them in numberical order; however, when I put them in numerical order and get past 9 (into 2 digit numbers) the order gets all whacky. bjackson wrote: > I want my photos within a folder to appear in a certain order and > want them in numberical order; however, when I put them in numerical > order and get past 9 (into 2 digit numbers) the order gets all whacky. ======================= Instead of... 1, 2, 3,.....10, 11, 12... Try this... 0001, 0002, 0003,.....0010, 0011, 0012 If you are batch renumbering the f...

Using the classes created with xsd.exe
I have created classes from several xsd files. These files create about 150 classes and spot checking them they do represent types in the xsd files. the question is how do I use these files. How do I load data into them and create xml from them. Is there some articles about this subject. Thank you, -- Jerry Hi Jerry, As for the classes you've generated, are they normal classes or dataset classes? As for the normal classes you generated through xsd.exe, you can use XML serialization to convert those class instances into XML content or deserialize the XML content back into objec...

How to get the handle of a Help file belonging to other process.
Hi all, In my application,I want to change the Index of a HTMLHELP file which belongs to a dialog running in other exe.In order to do this I need to find whether the Help file is open or not & get the handle of that to use HH_DISPLAY_INDEX .Is there any way to do this?? Note: I dont want to use FindWindow() as it is giving rise to some problems in my application.. Thanks in advance ...

How to use AjaxToolKit in asp.net for DHTML Editor
Dear Sir/Madam Please tell me how to use AjaxToolKit dll for DHTML purpose using C#. Thanks in Advance "Deep" <vinodkus@gmail.com> wrote in message news:7ac633e9-2cbd-4417-9b4e-363a9b5b3e74@d27g2000yqf.googlegroups.com... > Please tell me how to use AjaxToolKit dll for DHTML purpose using C#. http://tinyurl.com/ybfuqo8 ...

2007
Project desktop expert, new to Project Server 2007 and working with a sandbox implementation currently. When I use the PWA Build Team...Replace to replace a generic resource on a project with an actual named resource after first publishing a plan, my updates don't appear to be reflected in Project Server. If I check out and open the Project Plan in MSP Pro, however, the updates were made, and then if I publish the schedule, the updates appear in server. I thought when you made resource updates using PWA that they should be reflected immediately (or as soon as the request...