Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Sub-query with XmlNodeList

Sub-query with XmlNodeList

Scheduled Pinned Locked Moved XML / XSL
questiondatabasexmltutorialcsharp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Atropus
    wrote on last edited by
    #1

    Hi. I'm writing a C# program and I'm using XML like a DB for storing structured information. After a query in XPath, I obtain a list of XmlNode (or, in other words, an instance of XmlNodeList) and I would like to make another query inside this list. Maybe this is confused; here's an example. Let's suppose we have this XML fragment:

    <items>
    <item val="1"/>
    <item val="0"/>
    <item val="1"/>
    </items>

    and after a query like ./item[@val='1'] we retrive this list:

    <item val="1"/>
    <item val="1"/>

    Now, How can I convert easily this XmlNodeList in a node without creating a new XmlDocument (I need to have the right reference to nodes) so I will make another query on it? Or maybe how to call SelectNodes directly in the XmlNodeList (Yeah, I know: there's no SelectNodes in XmlNodeList)? Again, maybe it is possible to create a temporary node and insert the selected nodes into it. Thanks in advance, Atropo P.S. Sorry if the question is a bit confusing: I'm not very good with english.

    L 1 Reply Last reply
    0
    • A Atropus

      Hi. I'm writing a C# program and I'm using XML like a DB for storing structured information. After a query in XPath, I obtain a list of XmlNode (or, in other words, an instance of XmlNodeList) and I would like to make another query inside this list. Maybe this is confused; here's an example. Let's suppose we have this XML fragment:

      <items>
      <item val="1"/>
      <item val="0"/>
      <item val="1"/>
      </items>

      and after a query like ./item[@val='1'] we retrive this list:

      <item val="1"/>
      <item val="1"/>

      Now, How can I convert easily this XmlNodeList in a node without creating a new XmlDocument (I need to have the right reference to nodes) so I will make another query on it? Or maybe how to call SelectNodes directly in the XmlNodeList (Yeah, I know: there's no SelectNodes in XmlNodeList)? Again, maybe it is possible to create a temporary node and insert the selected nodes into it. Thanks in advance, Atropo P.S. Sorry if the question is a bit confusing: I'm not very good with english.

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Atropus wrote:

      How can I convert easily this XmlNodeList in a node

      That does not make sense, I can't understand what you want. Perhaps you could have provided the resultant example xml that you desire to create?

      led mike

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups