Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: How to query and edit nodes in an xml doc /dataset?

Thread Tools

Re: How to query and edit nodes in an xml doc /dataset?

Posts: n/a
use xpath
xpath staments will be your queries into your xml instance.

XmlDocument doc = new XmlDocument(xmlInstance);
String xpath = "/station/@label";

if ( doc.SelectSingleNode(xpath).Value == myVar )
//do something or check something


"KathyB" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> Hi, I'm working with an xml structure that is NOT database
> does not fit the column/rows model.
> I need to be able to load an xml doc file into memory, then query that
> info and update/add nodes as needed. For example:
> <station name="label">
> <work_instructions order="1" title="Apply Labels">
> <boards>
> <board serial_no="111">
> <board serial_no="222">
> </boards>
> </work_instructions>
> </station>
> I need to be able to say: if station @name = varStation (variable)
> then
> do something, or check something, etc.
> Could someone please point me to some examples? I'm only finding
> database-structured xml used as examples and it isn't helping me!
> Thanks.
> Kathy

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataset Question - Odd results with single xml nodes vs multiple nodes th3dude ASP .Net 0 01-03-2007 03:24 PM
Text nodes and element nodes query asd Java 3 05-23-2005 10:01 AM
Snapshot restraint - edit, edit, edit Alan Browne Digital Photography 24 05-10-2005 10:15 PM
String[] files = {"a.doc, b.doc"}; VERSUS String[] files = new String[] {"a.doc, b.doc"}; Matt Java 3 09-17-2004 10:28 PM
Reality check: Is it sensible to link XML nodes to other XML nodes in the same file? gavnosis XML 0 08-02-2003 08:22 AM