Read partial xml into dataset

Hello

I need some help to read only partial nodes of a xml and store it as a
dataset. In my example below, I need  only the values within the nodes
<WorkFlowStepHistory> in a dataset. I'm sure it is pretty simple, but
since I'm new to xml not sure how it is done.

Say my xml string has nodes like

<RequestSpecificData>
     <OtherNodes>
        -------
     </OtherNodes>

     <WorkFlowStepHistory>
            <WorkFlowStatus>FormSubmitted</WorkFlowStatus>
            <WorkFlowStatusDateTime>12/17/2007</
WorkFlowStatusDateTime>
     <WorkFlowStepHistory>
     <WorkFlowStepHistory>
            <WorkFlowStatus>FormApproved</WorkFlowStatus>
            <WorkFlowStatusDateTime>12/18/2007</
WorkFlowStatusDateTime>
     <WorkFlowStepHistory>
      <WorkFlowStepHistory>
            <WorkFlowStatus>FormRejected</WorkFlowStatus>
            <WorkFlowStatusDateTime>12/18/2007</
WorkFlowStatusDateTime>
     <WorkFlowStepHistory>

     <OtherNodesXYZ>
        -------
     </OtherNodesXYZ>
</RequestSpecificData>
0
12/17/2007 3:05:37 PM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
678 Views

Similar Articles

[PageSpeed] 59

Sue wrote:
> Hello
> 
> I need some help to read only partial nodes of a xml and store it as a
> dataset. In my example below, I need  only the values within the nodes
> <WorkFlowStepHistory> in a dataset. I'm sure it is pretty simple, but
> since I'm new to xml not sure how it is done.
> 
> Say my xml string has nodes like
> 
> <RequestSpecificData>
>      <OtherNodes>
>         -------
>      </OtherNodes>
> 
>      <WorkFlowStepHistory>
>             <WorkFlowStatus>FormSubmitted</WorkFlowStatus>
>             <WorkFlowStatusDateTime>12/17/2007</
> WorkFlowStatusDateTime>
>      <WorkFlowStepHistory>
>      <WorkFlowStepHistory>
>             <WorkFlowStatus>FormApproved</WorkFlowStatus>
>             <WorkFlowStatusDateTime>12/18/2007</
> WorkFlowStatusDateTime>
>      <WorkFlowStepHistory>
>       <WorkFlowStepHistory>
>             <WorkFlowStatus>FormRejected</WorkFlowStatus>
>             <WorkFlowStatusDateTime>12/18/2007</
> WorkFlowStatusDateTime>
>      <WorkFlowStepHistory>
> 
>      <OtherNodesXYZ>
>         -------
>      </OtherNodesXYZ>
> </RequestSpecificData>

Well you could load the XML into a System.Xml.XmlDocument, then for that 
XmlDocument you could remove the nodes you don't want/need in the 
DataSet, then you could use an XmlNodeReader over the XmlDocument and 
pass it to the ReadXml method of your DataSet.


-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
12/17/2007 3:16:35 PM
On Dec 17, 9:16 am, Martin Honnen <mahotr...@yahoo.de> wrote:
> Sue wrote:
> > Hello
>
> > I need some help to read only partial nodes of a xml and store it as a
> > dataset. In my example below, I need  only the values within the nodes
> > <WorkFlowStepHistory> in a dataset. I'm sure it is pretty simple, but
> > since I'm new to xml not sure how it is done.
>
> > Say my xml string has nodes like
>
> > <RequestSpecificData>
> >      <OtherNodes>
> >         -------
> >      </OtherNodes>
>
> >      <WorkFlowStepHistory>
> >             <WorkFlowStatus>FormSubmitted</WorkFlowStatus>
> >             <WorkFlowStatusDateTime>12/17/2007</
> > WorkFlowStatusDateTime>
> >      <WorkFlowStepHistory>
> >      <WorkFlowStepHistory>
> >             <WorkFlowStatus>FormApproved</WorkFlowStatus>
> >             <WorkFlowStatusDateTime>12/18/2007</
> > WorkFlowStatusDateTime>
> >      <WorkFlowStepHistory>
> >       <WorkFlowStepHistory>
> >             <WorkFlowStatus>FormRejected</WorkFlowStatus>
> >             <WorkFlowStatusDateTime>12/18/2007</
> > WorkFlowStatusDateTime>
> >      <WorkFlowStepHistory>
>
> >      <OtherNodesXYZ>
> >         -------
> >      </OtherNodesXYZ>
> > </RequestSpecificData>
>
> Well you could load the XML into a System.Xml.XmlDocument, then for that
> XmlDocument you could remove the nodes you don't want/need in the
> DataSet, then you could use an XmlNodeReader over the XmlDocument and
> pass it to the ReadXml method of your DataSet.
>
> --
>
>         Martin Honnen --- MVP XML
>        http://JavaScript.FAQTs.com/- Hide quoted text -
>
> - Show quoted text -

Hello Martin

Thank You for the response. Would you kind enought to show me how it's
done. Using the SelectNode I read from the xml document the required
nodes I need for the dataset. But not sure how to use that "nodelist"
with the ReadXML method.
0
12/17/2007 5:27:50 PM
Sue wrote:

> Thank You for the response. Would you kind enought to show me how it's
> done. Using the SelectNode I read from the xml document the required
> nodes I need for the dataset. But not sure how to use that "nodelist"
> with the ReadXML method.

My suggestion is to remove the nodes you don't want in the DataSet so 
you would do e.g.
             XmlDocument xmlDoc = new XmlDocument();
             xmlDoc.Load(@"..\..\XMLFile1.xml");
             XmlNodeList nodesToBeRemoved =
   xmlDoc.SelectNodes("*/*[not(self::WorkFlowStepHistory)]");
             for (int i = nodesToBeRemoved.Count - 1; i >= 0; i--)
             {
                 XmlNode toBeRemoved = nodesToBeRemoved[i];
                 toBeRemoved.ParentNode.RemoveChild(toBeRemoved);
             }
             // now you can use an XmlNodeReader(xmlDoc) and feed that 
to the ReadXml method
-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/
0
mahotrash (1777)
12/17/2007 5:40:31 PM
Reply:

Similar Artilces:

need some help please, read inside, cheers!!
Hello Peeps! I am trying to work out a formula that can count multiple strings i.e. =COUNTIF($E$3:$E$40,"Setup") But not only have it count look for the word setup, have it look for another word to i.e!!! =COUNTIF($E$3:$E$40,"Setup", "Done") This doesn't work but u get the jist of what i need, any help would be much appreciated!!me! Thanks Alot Kami Wilson Use separate countifs: =COUNTIF($E$3:$E$40,"Setup") + COUNTIF($E$3:$E$40,"Done") Andy. "Wilson" <Lordwils@btopenworld.com> wrote in message news:78na00ppvvbsqt...

I cannot read forwarded messages. I only get an email address
For some reason, when someone forwards a message to me all that shows up is the email address of the person who originally sent the message. Any ideas? Change your View>Encoding setting. "Michelle10000" wrote: > For some reason, when someone forwards a message to me all that shows up is > the email address of the person who originally sent the message. Any ideas? ...

Reading raw messages
I'm having a spam problem (yes, I know, who isn't!!!) and I would like to read the raw message, as it comes in from the POP server. I want to examine the message headers, etc. I can either do this in Outlook 2003 or in Exchange 2003, as I own and run both. When I was running MDaemon, I could access the mailbox store and read the raw messages. Ms, in their wisdom, in Exchange 2003, make this very difficult and hide this "raw" information away. I reckon Exchange Server is the place to look - if you export messages from Outlook 2003, even in text mode, you only get the sanitis...

Partial Payments
I have a payment setup for some tenants. Sometimes they only pay a partial payment on the rent. How do I adjust this so that when a partial payment is made the reoccurring payment will adjust it self. Ex: Rent is $900.00 A reoccurring payment for the 1st of the month is $900.00 from tenant x Tennant x pays $700.00 on the first. I get a message asking if this is the payment scheduled, if I choose yes it asks me if I want to adjust the amount, but I don't want to do that because the rent is not paid in full and it will look like tenant x has paid the full payment. Also I will get n...

Tim Sneed: How do I restore/repair a partially converted database?
Tim, If you don't put your question in the Message area, many of us can't answer it. There's a little bug where hitting Reply with an empty Message causes an error. Also the Subject often get truncated. Please put a very brief description Subject and further explain in the Message area. -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder. ...

Send email without read access for queues
I got the problem that a user should be able to send emails with the webclient but he should not be able to see the defined queues. Thats not possible. In my opinion it does not make sense at all that you need read privileges on queues to send emails out of the web client. That should be changed. My suggestions are: 1. Let users send emails when they have the privilege to create activities. or 2. Define a new privilege for sending emails AND (I find that one pretty important) 3. Show only those items in the queue that a user has at least read privileges for. In my case the user doe...

SOAP xml
Fedex in the US is changing their method of dealing with their servers for submitting packages, tracking , etc. The old method was a formatted Xml file submitted via an HTTP Post. You then parsed the returned Xml that contained the information requested. Now they are phasing that out in favor of a web service using WSDL SOAP messages. I took one of their VB.Net samples and have sucessfully tracked packages and received Proof of Delivery Pdf files. However I have a problem when I deal with Fedex tech support when I have questions about some of their other services, for example Address ...

LINQ to XML and Amazon Webservices
Hi, I'm having a hard time in using LINQ on XML returned from Amazon Webservices. I'm using the 2008 beta 2 on an XP machine. the code I'm using is: ========= Dim s As String s = "http://ecs.amazonaws.com/onca/xml?" & _ "Service=AWSECommerceService&" & _ "AWSAccessKeyId=1234&" & _ "AssociateTag=my-tag&" & _ "ResponseGroup=Small&" & _ "Operation=ItemSearch&" & _ ...

new XmlDataDocument(DataSet) throws exception
hi if i try to synchronize a dataset with xml using XmlDataDocument dataDoc = new XmlDataDocument(dataSetName) it throws an exception saying Object reference not set to an instance of the object. WHY? my dataset has 4 tables not related to each other in any way. please respond! ...

reading file name from folder function
I am using Access 97. Just wonder if there is a fuction which can read all the file name from a folder and put it to a column in a table. Please let me know. Thanks. Hi. >I am using Access 97. Just wonder if there is a fuction which can read all >the file name from a folder and put it to a column in a table. Please see the getFileInfo( ) function in the tip, "How to compare the contents of two directories," on the following Web page for an example: http://www.access.qbuilt.com/html/vba1.html HTH. Gunny See http://www.QBuilt.com for all your database needs. See http...

Chunking out data from a huge xml file (Ajax)
Hi I am faced with quite a challenge. I need to open a 70-100 meg file and be able to chunk it out using AJAX back to the client but that isn't my problem really. What I need to do is open the file and get pieces of it out without loading the entire thing into memory. The pieces themselves are random although of a fixed size. If I tried to read an entire file into a stirng and parse pieces out I use too much memory and if I use the xmlTextReader and the skip method my memory problems are solved but it creates a huge performance issue. If I don't have to I don't want to ...

About XML scheme
Hi ! What is XML scheme ? What is a use of that ? Give me some idea... Thanks & Regards Elankathir, B'lore, India. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! ElanKathir .S.N <elankathirctech@yahoo.co.in> writes: > What is XML scheme ? Is an XML based standard to describe the structure of an XML document (more powerful than DTD) > What is a use of that ? Try to start with a tutorial: http://www.w3schools.com/schema/default.asp -- Lawrence "Avevo Halo, poi e` arrivata la mia fidanza...

Reading Outlook 2003 pst file in Outlook 2007
My computer recently died and has been replaced with a new one running Win 7 / Outlook 2007. Is there a way I can read my old Outlook 2003 emails without importing them into my current email folders? I don't want to clutter up my current inbox with old emails, but I still need access to them. I would like to import my contacts, however. Sure. Use file, open, outlook data file. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-r...

Reading Layout problem, and labels problem.
I am running XP Home Edition. I have Office 2003, Student and Teacher Edition, which has developed two Word problems. - The Reading Layout mode shows only one page instead of two. - When I define labels, there is no border around the labels on the screen. I only recently began creating labels, so I don't know when this came about. I have disabled System Restore, so that isn't an option. I reinstalled Office, but that didn't fix either of the Word problems. I used the Save My Settings Wizard for the reinstallation, and I wonder that that mi...

XML Format
I am looking for documentation on the XML format required to import Vendors into Great Plains and to import Vendor invoices into Great Plains. Is this documented somewhere? I already have the format for Sales but can't find the format for these types of transactions and vendor information. Our requirements are very simple and we do not need the enhanced features of Integration manager. Jean, Using what to import with? The only "built in" tool to GP is the Import Utility which only takes a flat csv or tab file and not XML. So I'm pretty sure that isn't what ...

xml question?
what is the equivalent of this in C# ? foreach (XmlNode xmlConfigNode in xmlConfigDoc["configuration"].ChildNodes) Thansk Sorry I made a mistake here is what I want to convert to C# For Each Node In XmlDocument.Item("configuration").Item("appSettings") "Ray5531" <Ray5531@microsoft.com> wrote in message news:elPIiezOFHA.3408@TK2MSFTNGP14.phx.gbl... > what is the equivalent of this in C# ? > > foreach (XmlNode xmlConfigNode in > xmlConfigDoc["configuration"].ChildNodes) > > > > Thansk > > Hi Ray,...

reading outlook file (email messages)
I would like to read outlook files from my previous computer that was saved onto a cd. How can I access or read these e-mail messages. Is it possible to retrieve attachement as well? Hearing you soon. SF You will need to copy the file to your hard drive, remove the read-only tick mark from the property page and use File->Open in Outlook to open the file. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the SWEN virus, all mail sent to my personal account will be deleted without reading. After searching google.groups.com and find...

Read Receipt Function in outlook
The read receipt option is no longer working in Outlook Small Business Edition for XP 2002. I have not made any recent changes to my outlook setup. Does anyone know how I can trouble shoot this? ...

XML XSL FO PDF
Can I use XML->XSL->FO->PDF in .NET? I have the XSL FO from XML, and now use client based FOP software. I have seen a few commercial packages for FO->PDF but they are costly (1000 dollars). news wrote: > Can I use XML->XSL->FO->PDF in .NET? Sure but only with some third-part library. .NET doesn't support XSL-FO natively. -- Oleg Tkachenko [XML MVP] http://blog.tkachenko.com I am using FOP which I downloaded from somewhere (forgotten), can you recommend anything for the FO handling? I found the XSL a dream in .NET and hoped that .NET had something intrinsic ...

Escape codes embedded in XML
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1 QID=\"55111\"><Tag2 AID=\"5511101\"></Tag2></Tag1><Tag1 QID=\"55112\"><Tag2 AID=\"5511217\"></Tag2></Tag1><Tag1 QID=\"5512282\"><Tag2 AID=\"551228206\"></Tag2></Tag1><Tag1 QID=\"55114\"><Tag2 AID=\"5511406\"></Ta...

How to create EXE having some XML files ?
Hello there I am designing one application that would create one exe and pack some resources in it(Like some XML files). Is there any way to do this ? If you are unable to understand it, please Let me know. I'd try to elaborate on it more. ...

Reading Last Row of Data
Is this possible? I have an excel document with two worksheets in it. Worksheet #2 is just a bunch of data sorted by date. Worksheet #1 displays data from the last row of worksheet #2. Is it possible to have excel detect the last row of data on Worksheet #2 and display it on Worksheet #1? Right now I am manually changing the cell references on worksheet #1 as I add data in worksheet #2. Any help would be greatly appreciated! -- sslack ------------------------------------------------------------------------ sslack's Profile: http://www.excelforum.com/member.php?action=getinfo&...

Mark as read
I am using outlook 2003 on winxp pro machine I have some vba coding that I use to strip the attachments off my email and place them into a specific folder. This is running fine, but I would like to fine-tune it a bit. Not sure how to do it and cannot find anything in my 2003 outlook vba book or when I google it, so here I am again. Here is my question Can I mark these emails as having been read during/after I have stripped the attachment off of them. They have never been clicked on so they never get marked as having been read which can become a bit confusing when the number of e...

MSXML2 to Load xml document using ISO-8859-1 encoding
HI My application connects to the UPS server which returns an ISO-8859-1 encoded XML response. I need a part of this response, ie. the AccessLicenseAgreement , which i need to display in my application and then return to the UPS server with the next request. Their server matches what they sent me with what i return back to them. Due to the difference in the encoding method it returns an Invalid AccessLicenseAgreement error back to me. I set my request Processing Instruction to ISO-8859-1 encoding, but i still get the same error from them. I am guessing the problem is when i read it in using Lo...

Strange Issues with Read Receipts Bouncing (Need expert help)
Hi, Currently migrating a company from NT 4 to Windows Server 2003, including an upgrade from Exchange 5.5 to Exchange 2003. The excistingDNS name space for Dns and mail is user@comany.com (old domain)The Dns name space for Dns and mail on the new Domain and AD Server and Exchange is user@company.local. The Dns namespace @company.com is registered on Internet but @company.local is purely for internal addresssing, We are busy with the Exchange Migration. We have setup custom contacts on Exchange 2003 viewable in address book for all users on 5.5 using user@company.com,also with an ad...