OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XML.Net find node by content and change attribute

[ Lists Home | Date Index | Thread Index ]

Greetings

I'm trying to build a nav bar from an xml file.  I've got an xml file as
below sitting on the server.  I'm using XML.Net and what I want to do is
load in the page, then find the "Page" node that contains a
"<name>$current_page</name>" node.  Then create an attribute (active) on
the Page tag.

What I haven't figure a good way to do is what XML.net objects and methods
I need to locate the node the node I want.

<NavList>
  <Page>
    <url>contact.asp</url>
    <name>Contacts</name>
  </Page>
  <Page>
    <url>rel.asp</url>
    <name>Providers</name>
  </Page>
  <Page>
    <url>incident.asp</url>
    <name>Incidents</name>
  </Page>
  <Page>
    <url>lit.asp</url>
    <name>Correspondence</name>
  </Page>
</NavList>


// psuedo code

XDoc.Load(m_server.MapPath(nav_file));

// this is the code I don't know how to do
XmlElement Xname = XDoc.FindElementWithValue("Page/name", current);
XmlElement XPage = Xname.ParentElement();
// end unknown

XElement.SetAttribute("active", 1);

Thanks for any help.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+      Mattison Narramore                  peacock@panix.com      +
+-----------------------------------------------------------------+
+ The most likely way for the world to be destroyed, most experts +
+ agree, is by accident. That's where we come in; we're computer  +
+ professionals. We cause accidents.                              +
+                   -Nathaniel Borenstein                         +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS