Trying to Get Subset of XML

I want to display a segment of an XML (see below) file in a datagrid. I want
to select a specific <EventID> and get
all of its children into a dataset so that I can bind a datagrid to those
values. I am trying an expression
as follows but I get an error "Value of type 'System.Xml.XmlNode' cannot be
converted to 'System.Xml.XmlNodeList'."


myNodes = xmldoc.ChildNodes("/Dataset/Events/[ShowName=Round 2]")

What is the correct way to "get" that set of nodes and convert them to a
dataset?

==================  Portion of XML File  ======================
<Dataset>
<Events>
    <EventID>Contest One</EventID>
    <SeqNbr>1</SeqNbr>
    <ShowName>Round 1</ShowName>
    <ShowDate>2005-02-12T00:00:00.0000000-07:00</ShowDate>
    <Type>SC</Type>
    <PorF>P</PorF>
    <RoundNbr>1</RoundNbr>
    <Judge1>SMITH S</Judge1>
    <Judge2>MASON M</Judge2>
    <Judge3>SHALLER S</Judge3>
    <PerfSched>
      <PerfTime>2005-02-12T08:00:00.0000000-07:00</PerfTime>
      <UnitID>368</UnitID>
      <Nickname>Dublin</Nickname>
      <Class>SA</Class>
    </PerfSched>
    <PerfSched>
      <PerfTime>2005-02-12T08:08:00.0000000-07:00</PerfTime>
      <UnitID>500</UnitID>
      <Nickname>Littlerock</Nickname>
      <Class>SA</Class>
    </PerfSched>
    <PerfSched>
      <PerfTime>2005-02-12T08:16:00.0000000-07:00</PerfTime>
      <UnitID>658</UnitID>
      <Nickname>Madison</Nickname>
      <Class>SA</Class>
    </PerfSched>
    .......
</Events>
<Events>
    <EventID>Contest Two</EventID>
    <SeqNbr>2</SeqNbr>
    <ShowName>Round 1</ShowName>
    <ShowDate>2005-02-12T00:00:00.0000000-07:00</ShowDate>
    <Type>SC</Type>
    <PorF>P</PorF>
    <RoundNbr>1</RoundNbr>
    <Judge1>JONES J</Judge1>
    <Judge2>MASON M</Judge2>
    <Judge3>GREEN G</Judge3>
    <PerfSched>
      <PerfTime>2005-02-12T09:00:00.0000000-07:00</PerfTime>
      <UnitID>361</UnitID>
      <Nickname>Elder</Nickname>
      <Class>SA</Class>
    </PerfSched>
    <PerfSched>
      <PerfTime>2005-02-12T09:08:00.0000000-07:00</PerfTime>
      <UnitID>434</UnitID>
      <Nickname>Ventura</Nickname>
      <Class>SA</Class>
    </PerfSched>
    <PerfSched>
      <PerfTime>2005-02-12T09:16:00.0000000-07:00</PerfTime>
      <UnitID>533</UnitID>
      <Nickname>Sparks</Nickname>
      <Class>SA</Class>
    </PerfSched>
    ......
</Events>
</Dataset>

===============================================================


0
10/7/2004 11:56:54 AM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
706 Views

Similar Articles

[PageSpeed] 33

Have you tried SelectNodes and SelectSingleNode?

-- 
Victor Hadianto
http://www.synop.com/Products/SauceReader/

"Wayne Wengert" <wayneDONTWANTSPAM@wengert.com> wrote in message 
news:%23KyBHTGrEHA.3488@TK2MSFTNGP11.phx.gbl...
>I want to display a segment of an XML (see below) file in a datagrid. I 
>want
> to select a specific <EventID> and get
> all of its children into a dataset so that I can bind a datagrid to those
> values. I am trying an expression
> as follows but I get an error "Value of type 'System.Xml.XmlNode' cannot 
> be
> converted to 'System.Xml.XmlNodeList'."
>
>
> myNodes = xmldoc.ChildNodes("/Dataset/Events/[ShowName=Round 2]")
>
> What is the correct way to "get" that set of nodes and convert them to a
> dataset?
>
> ==================  Portion of XML File  ======================
> <Dataset>
> <Events>
>    <EventID>Contest One</EventID>
>    <SeqNbr>1</SeqNbr>
>    <ShowName>Round 1</ShowName>
>    <ShowDate>2005-02-12T00:00:00.0000000-07:00</ShowDate>
>    <Type>SC</Type>
>    <PorF>P</PorF>
>    <RoundNbr>1</RoundNbr>
>    <Judge1>SMITH S</Judge1>
>    <Judge2>MASON M</Judge2>
>    <Judge3>SHALLER S</Judge3>
>    <PerfSched>
>      <PerfTime>2005-02-12T08:00:00.0000000-07:00</PerfTime>
>      <UnitID>368</UnitID>
>      <Nickname>Dublin</Nickname>
>      <Class>SA</Class>
>    </PerfSched>
>    <PerfSched>
>      <PerfTime>2005-02-12T08:08:00.0000000-07:00</PerfTime>
>      <UnitID>500</UnitID>
>      <Nickname>Littlerock</Nickname>
>      <Class>SA</Class>
>    </PerfSched>
>    <PerfSched>
>      <PerfTime>2005-02-12T08:16:00.0000000-07:00</PerfTime>
>      <UnitID>658</UnitID>
>      <Nickname>Madison</Nickname>
>      <Class>SA</Class>
>    </PerfSched>
>    .......
> </Events>
> <Events>
>    <EventID>Contest Two</EventID>
>    <SeqNbr>2</SeqNbr>
>    <ShowName>Round 1</ShowName>
>    <ShowDate>2005-02-12T00:00:00.0000000-07:00</ShowDate>
>    <Type>SC</Type>
>    <PorF>P</PorF>
>    <RoundNbr>1</RoundNbr>
>    <Judge1>JONES J</Judge1>
>    <Judge2>MASON M</Judge2>
>    <Judge3>GREEN G</Judge3>
>    <PerfSched>
>      <PerfTime>2005-02-12T09:00:00.0000000-07:00</PerfTime>
>      <UnitID>361</UnitID>
>      <Nickname>Elder</Nickname>
>      <Class>SA</Class>
>    </PerfSched>
>    <PerfSched>
>      <PerfTime>2005-02-12T09:08:00.0000000-07:00</PerfTime>
>      <UnitID>434</UnitID>
>      <Nickname>Ventura</Nickname>
>      <Class>SA</Class>
>    </PerfSched>
>    <PerfSched>
>      <PerfTime>2005-02-12T09:16:00.0000000-07:00</PerfTime>
>      <UnitID>533</UnitID>
>      <Nickname>Sparks</Nickname>
>      <Class>SA</Class>
>    </PerfSched>
>    ......
> </Events>
> </Dataset>
>
> ===============================================================
>
> 


0
synop (25)
10/11/2004 7:35:21 AM
Victor;

I'll give that a try

Wayne

"Victor Hadianto" <synop@nospam.nospam> wrote in message
news:uFbpXT2rEHA.1232@TK2MSFTNGP11.phx.gbl...
> Have you tried SelectNodes and SelectSingleNode?
>
> -- 
> Victor Hadianto
> http://www.synop.com/Products/SauceReader/
>
> "Wayne Wengert" <wayneDONTWANTSPAM@wengert.com> wrote in message
> news:%23KyBHTGrEHA.3488@TK2MSFTNGP11.phx.gbl...
> >I want to display a segment of an XML (see below) file in a datagrid. I
> >want
> > to select a specific <EventID> and get
> > all of its children into a dataset so that I can bind a datagrid to
those
> > values. I am trying an expression
> > as follows but I get an error "Value of type 'System.Xml.XmlNode' cannot
> > be
> > converted to 'System.Xml.XmlNodeList'."
> >
> >
> > myNodes = xmldoc.ChildNodes("/Dataset/Events/[ShowName=Round 2]")
> >
> > What is the correct way to "get" that set of nodes and convert them to a
> > dataset?
> >
> > ==================  Portion of XML File  ======================
> > <Dataset>
> > <Events>
> >    <EventID>Contest One</EventID>
> >    <SeqNbr>1</SeqNbr>
> >    <ShowName>Round 1</ShowName>
> >    <ShowDate>2005-02-12T00:00:00.0000000-07:00</ShowDate>
> >    <Type>SC</Type>
> >    <PorF>P</PorF>
> >    <RoundNbr>1</RoundNbr>
> >    <Judge1>SMITH S</Judge1>
> >    <Judge2>MASON M</Judge2>
> >    <Judge3>SHALLER S</Judge3>
> >    <PerfSched>
> >      <PerfTime>2005-02-12T08:00:00.0000000-07:00</PerfTime>
> >      <UnitID>368</UnitID>
> >      <Nickname>Dublin</Nickname>
> >      <Class>SA</Class>
> >    </PerfSched>
> >    <PerfSched>
> >      <PerfTime>2005-02-12T08:08:00.0000000-07:00</PerfTime>
> >      <UnitID>500</UnitID>
> >      <Nickname>Littlerock</Nickname>
> >      <Class>SA</Class>
> >    </PerfSched>
> >    <PerfSched>
> >      <PerfTime>2005-02-12T08:16:00.0000000-07:00</PerfTime>
> >      <UnitID>658</UnitID>
> >      <Nickname>Madison</Nickname>
> >      <Class>SA</Class>
> >    </PerfSched>
> >    .......
> > </Events>
> > <Events>
> >    <EventID>Contest Two</EventID>
> >    <SeqNbr>2</SeqNbr>
> >    <ShowName>Round 1</ShowName>
> >    <ShowDate>2005-02-12T00:00:00.0000000-07:00</ShowDate>
> >    <Type>SC</Type>
> >    <PorF>P</PorF>
> >    <RoundNbr>1</RoundNbr>
> >    <Judge1>JONES J</Judge1>
> >    <Judge2>MASON M</Judge2>
> >    <Judge3>GREEN G</Judge3>
> >    <PerfSched>
> >      <PerfTime>2005-02-12T09:00:00.0000000-07:00</PerfTime>
> >      <UnitID>361</UnitID>
> >      <Nickname>Elder</Nickname>
> >      <Class>SA</Class>
> >    </PerfSched>
> >    <PerfSched>
> >      <PerfTime>2005-02-12T09:08:00.0000000-07:00</PerfTime>
> >      <UnitID>434</UnitID>
> >      <Nickname>Ventura</Nickname>
> >      <Class>SA</Class>
> >    </PerfSched>
> >    <PerfSched>
> >      <PerfTime>2005-02-12T09:16:00.0000000-07:00</PerfTime>
> >      <UnitID>533</UnitID>
> >      <Nickname>Sparks</Nickname>
> >      <Class>SA</Class>
> >    </PerfSched>
> >    ......
> > </Events>
> > </Dataset>
> >
> > ===============================================================
> >
> >
>
>


0
10/11/2004 2:11:46 PM
Reply:

Similar Artilces:

2004 trial, how do I get rid of it?
My trial is over, and I want my Money 2002 back. Does anyone know how I can do that? The easiest way is to use control panel->add/remove programs to remove the 2004 trial pieces (there are two programs to uninstall). Then reinstall 2002 and use the backup file created when you first installed Money 2004 - it'll be named something like My Money.M10. Any transactions entered in the trial which you want to keep will need to be re-entered into the 2002 version, as you can't downgrade a file from 2004 to 2002. -- Glyn Simpson, Microsoft MVP - Money Check http://support.microsoft.co...

Where to get missing msvcp70.dll?
After I uninstalled a bunch of software, when I run an app it says app failed because msvcp70.dll was not found. Re-installing that app does not help. I guess I need to restore the missing msvcp70.dll. What is the official way to get it? Some sites offer this file for download but I'm not sure the files are genuine. In my system32 folder there is msvcp50.dll, msvcp60.dll, msvcp71.dll, but no msvcp70.dll. It is not in the recycle bin either :( "james" <nospam@nospam.com> wrote in message news:#XS21G1gKHA.5520@TK2MSFTNGP06.phx.gbl... > After I un...

get rid of macro option at startup
I created and then deleted a macro in an Excel file. Why do I still get the warning box (i.e. the one asking if I want to enable or disable macros) when I open the file? Is there a way to get rid of this since I no longer have macros in this file? Thanks. Brad You need to delete the empty module.! Bill K "Brad Rench" <brench@comcast.net> wrote in message news:kSOdnb0Jjst9afaiXTWJkg@comcast.com... > I created and then deleted a macro in an Excel file. > > Why do I still get the warning box (i.e. the one asking if I want to enable > or disable macros) when I o...

AOL IMAP account
I have set up AOL email account as IMAP type and keep getting pop up in outlook " your IMAP server wants to alert you the following: Can't read attachment for message 6438. this pops up for many times and each time the number is different. new profile same issue. Office Version:Office 2007 Operating System:Windows Vista / Windows 7 - same issue. Submitted using http://www.outlookforums.com Do you have a virus scanner installed which integrates itself with Outlook? Uninstall this integration part of your virus scanner and try again; you'd still be sufficiently p...

Exchange 2003 SP1 to get DST patch & Exchange 2000 patch is available to anyone for $4,000
This is a multi-part message in MIME format. ------=_NextPart_000_0006_01C746B0.CFF31030 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable http://blogs.technet.com/hied_west_blog/archive/2007/02/01/dst-2007-updat= e-outlook-time-zone-data-update-tool-released-february-1-2007.aspx In the "New Highlights" section: "Exchange Server 2003 SP1 will now be = supported for an updated version of the Exchange CDO patch to be = released shortly." and "DST Hotfixes for products in Extended Support can now be purchased for = ...

How to get only the year in the date format in Access
How to get only the year in the date format I.e in the table in need to display only year E.g 2005 - should be display " 05" automatically Custom format the cell as: yy -- HTH, RD --------------------------------------------------------------------------- Please keep all correspondence within the NewsGroup, so all may benefit ! --------------------------------------------------------------------------- "yanu" <yanu@discussions.microsoft.com> wrote in message news:14CE9F60-F7B9-467A-8C16-71088C31BEBA@microsoft.com... > How to get only the year in the date form...

Getting kicked of outlook2003
Every time I print directly after I get kicked offline Do you mean that Outlook closes? "jp614" <jp614@discussions.microsoft.com> wrote in message news:150AB89F-0A3D-4D31-B2EF-0E3E1A852199@microsoft.com... > Every time I print directly after I get kicked offline No, It completely boots me off the network. When I loose connection to Outlook it takes my computer offline--looses connection... "Vince Averello [MVP-Outlook]" wrote: > Do you mean that Outlook closes? > > "jp614" <jp614@discussions.microsoft.com> wrote in message > ...

Formatting cells and getting pound signs
I am using Excel 2003 with all updates as of 4/28/04 and trying to format a cell using the custom category and choosing the #,##0.00 type. I am trying to add the $ symbol at the beginning of the type and add text at the end of the type to look like this $#,##0.00 "text". When I do this however it shows up in my cell on my worksheet as ##########. It does know what the value is and shows as I would expect it to when I place mouse over cell in a balloon If I use only the $ symbol befor the type it shows fine. If I use only the "text" after the type is shows fine. Using the...

get rid of extra spaces between paragraphs worked only once.
Changed style from Word 7 to Word 3, used help online, but still have 2 left with spaces I cannot get rid of on my last page. Got any help for me? -- Only fools and bigots prefer French over Spanish to be taught in public or private schools. In the Styles pane (Ctrl+Alt+Shift+S), right-click the style name and choose Modify from the context menu. In the Modify Style dialog box, click Format, Paragraph. Make sure that Line Spacing is what you want, and that Spacing Before and Spacing After are both set to zero. Click OK. To transfer the style definition to the attached template, d...

trying to send out emails
Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: pop I am trying to send emails from my entourage account and each time an error message appears telling me- <br> Entourage cannot find the server. Verify the server information is entered correctly in account settings, and that your DNS settings in the network pane of system are correct. <br> I am not sure how to fix this please help. <br> Rebecca On 2010-01-28 10:18:12 -0500, reisrl15@officeformac.com said: > I am trying to send emails from my entourage account and each time an > e...

Trying to Create a pop-up form
Due to size limitations on my main form, I am trying to create a form that, when I select a button, it pops up like a dialog box with the main form, Frm_Escheat, in the background I've created a qry which is the record source on my pop-up form. In the criteria of the query is: [Forms]![Frm_Escheat]![statecode] where [statecode] is the field from the Master Form. So, my "pop-up" form is activated when I select the button, but my problem is that it just goes to the pop-up form without the main form showing in the background. Thanks for your help. It would probably hel...

Get firefox- The fastest web browser in the world!
FireFox is a web browser created by Mozilla,it's the fatest web browser in whole world download now from site: http://hot-firefox.blogspot.com/ joke-master wrote: > FireFox is a web browser created by Mozilla,it's the fatest web > browser in whole world > download now from site: > http://hot-firefox.blogspot.com/ > If you don't mind it's memory leaks. If you re-boot each day it may not be a problem for you. Al ...

Error trying to make an account default
I have a new computer and my outlook 2003 is not letting me assign a default account to send and receive. I get this error: "The Specicied Account could not be found. It might have been deleted." I have four accounnts setup and have tried removing the accounts and recreating them and still get the error. when the account has been made, it tests fine. None of the four can be made default. Thanks in Advance! ...

Can we get newsgroups with Windows Live Mail?
Currently we have WindowsXP, SP3, OE. How will Windows7 get newsgroups? Will these be part of "Windows Live Mail" as they are in OE? Please help, Frank Newsgroups work virtually the same in WLMail as they do in OE. -- Bruce Hagen MS-MVP [Mail] Imperial Beach, CA "Frank Martin" <fm@general.com.au> wrote in message news:uybUM2d2KHA.2284@TK2MSFTNGP06.phx.gbl... > Currently we have WindowsXP, SP3, OE. > > How will Windows7 get newsgroups? Will these be part of "Windows Live > Mail" as they ...

Sending multiple Emails so each person does not get the list
We want to send out multiple emails to several email accounts. We dont want the accounts to see the list of accounts that the email went to. How does one do this in Outlook? In any contacts folder, Tools | Mail Merge is the best choice. --=20 Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx =20 "tom" <Spamblocker@ameritech.net> wrote in message = ...

How to prevent line breaks in XML file?
I am creating XML from SQL2000 using a vb.net page, then posting it to a remote server as a string. The remote server requires that the xml contain no line breaks, but there are some ntext fields in the database that contain long text with line breaks. How do I get rid of the line breaks? Can I do this with the XmlTextWriter, or do I need to handle each affected field seperately before handing it to the XmlTextWriter? Thanks Leslie les wrote: > How do I get rid of the line breaks? Can I do this with the > XmlTextWriter, or do I need to handle each affected field seperately > bef...

How do I get outlook 2002 to stop forwarding mail to my blackberr.
I had my outlook e-mail forwarding to my blackberry through vzw.blackberry.net, but when I switched to a different cellphone, my outlook continues to try to forward my mail and sends out responses that the e-mail is undeliverable. How do I get outlook 2002 to stop forwarding my mail? "MSOB" <MSOB@discussions.microsoft.com> wrote in message news:A6EC7EB6-1118-455E-AD62-6DE3D8A3A19E@microsoft.com... >I had my outlook e-mail forwarding to my blackberry through > vzw.blackberry.net, but when I switched to a different cellphone, my outlook > continues to try...

Transform fixed length text to xml
can i transform fixed length text to xml using XSL do i have to first load the text to xml and do the transformation? is there any other way to do it? ...

xml edit #2
I am trying to edit an xml receipt in notepad..whenever I try to save I can't save as a xml file ..it wants to save as a text file..How can I save as a xml file? -- billr You can just change the extension manually after you save it. Example - File saves as "report.txt" Rename it to "report.xml" and that's all there is to it. Billr, Try doing a Ctrl+S to save it. It should save it as the name it opened. Are you using a Notepad replacement program? Help | About | should say "Microsoft Notepad" -- * Get Secure! - www.microsoft.com/security Yo...

Exchange 2003 is getting hit hard as a relay
I am looking for the correct settings to stop my home exchange server from being a mail relay. What i am seeing? I see many emails sent out to people that show it was sent from my email address. I thought Exchange 2003 did not allow this by default? Please help. Exchange 2k3 isn't an open relay by default. Do you have Exchange aware antivirus software? Have you tried turning off authenticated relay in your SMTP server settings as well? Jeremy Hillin wrote: > I am looking for the correct settings to stop my home exchange server > from being a mail relay. > > What i am s...

office sr1--how do I get it?
Can anyone tell me how to get Office 2000 SR1, 2? I went to the office web site and ordered it but I got a few days later saying my order has been cancelled. Does anyone have it? I have SR3 (got that easy as pie). My wife and I have been having weird things going on with Outlook (constant crashing and error report dialog boxes appearing--fortunatey, we can still work with those boxes up, but it's annoying). http://www.microsoft.com/office/ork/2000/journ/sr1a.htm Don't forget the additional updates available ;-) -- Roady [MVP] www.sparnaaij.net Microsoft Office and Microsoft Offi...

XML in Worksheet w/o Looping
I am looking to find a way to insert the data from an XML file without having to loop. Just seeing if it's possible. The code I have is going to read an XML file that has the same headers as a worksheet in Excel. I use the code below to pull the XML file into a DOMDocument, then into a ADO Recordset object. When I generate an XML file, I can just query the worksheet and get a recordset, no looping needed. Why can't I do it backwards. I want to do an insert SQL statement or combine 2 recordsets or something else. as the data can get really long. Thanks for any help! ...

Updating links
Hi, In one of our office spreadsheets, everytime it is opened it asks do you want to update cells from another spreadsheet. I believe when this spreadsheet was set up, a work sheet was copied from another spreadsheet. I thought that all the references to that other spreadsheet had been removed. Is there anyway to identify (other than manually checking each cell) which cell has a formula linked to the old spreadsheet. Thanks in advance, George Download and install Bill Manville's FindLink add-in, which you can find at: http://www.bmsltd.ie/MVP/ In article <bYd1d.27315$Z14.90...

Trying to play file
I downloaded a visualization from the downloads site. I tried to open the file and got the following: "Windows Media Player cannot play file. Player might not support this file typeor the codec that was used to compress the file". his download was from Microsoft so I don't understand why it won't play. Do I need a newer version of the media player or what? Name: PsychedeliaVizPac.msi Type:Windows Insataller-package 5.53MB From: download microsoft.com Windows media player 11 32 bit dazed and confused papahyle wrote: > I downloaded a visualization from the ...

DataSet and XML Lesson 2
DataSet & XML Lesson 2 2*complex + 2*simple = 2much ? Hello, I have a XSD file with a valid schema (see below). I can see the schema-diagram in the XML-Designer of VisualStudio well, but when I call "Schema / DataSet-Preview" it fails with "Undefined datatype: 'baseTyp'." Why??? There is no problem (1*complex + 2*simple = OK), if I use <xs:element name="Elem" type="attribTyp" /> instead of <xs:element name="Elem" type="elemTyp" /> There is no problem (2*complex + 1*simple = OK), if I use &l...