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. LINQ
  4. Detect a special node in a XML file !

Detect a special node in a XML file !

Scheduled Pinned Locked Moved LINQ
algorithmsxmltutorialquestion
4 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.
  • M Offline
    M Offline
    Mohammad Dayyan
    wrote on last edited by
    #1

    I have a XML file that its nodes have sorted by ID attribute .

    <Information>
    <Data ID="1" />
    <Data ID="2" />
    <Data ID="3" />
    <Data ID="4" />
    <Data ID="15" />
    <Data ID="7" />
    <Data ID="8" />
    <Data ID="9" />
    <Data ID="10" />
    <Data ID="11" />
    </Information>

    But there are some nodes in the XML file that broken this sorting. I'm going to detect them, but I don't know how I can do it ! e.g : in this case <Data ID="15" /> broken the sorting. I don't want to sort them again, because the ID numbers are valuable and I shouldn't miss them. Could you guide me ? Thanks in advance.

    H 1 Reply Last reply
    0
    • M Mohammad Dayyan

      I have a XML file that its nodes have sorted by ID attribute .

      <Information>
      <Data ID="1" />
      <Data ID="2" />
      <Data ID="3" />
      <Data ID="4" />
      <Data ID="15" />
      <Data ID="7" />
      <Data ID="8" />
      <Data ID="9" />
      <Data ID="10" />
      <Data ID="11" />
      </Information>

      But there are some nodes in the XML file that broken this sorting. I'm going to detect them, but I don't know how I can do it ! e.g : in this case <Data ID="15" /> broken the sorting. I don't want to sort them again, because the ID numbers are valuable and I shouldn't miss them. Could you guide me ? Thanks in advance.

      H Offline
      H Offline
      Howard Richards
      wrote on last edited by
      #2

      You are not clear on what you want to do. Do you want to: a) remove ID="15" ? b) find Data elements out of sequence? c) re-order? d) renumber?

      'Howard

      M 1 Reply Last reply
      0
      • H Howard Richards

        You are not clear on what you want to do. Do you want to: a) remove ID="15" ? b) find Data elements out of sequence? c) re-order? d) renumber?

        'Howard

        M Offline
        M Offline
        Mohammad Dayyan
        wrote on last edited by
        #3

        Thanks Howard. I want to remove ID="15"

        H 1 Reply Last reply
        0
        • M Mohammad Dayyan

          Thanks Howard. I want to remove ID="15"

          H Offline
          H Offline
          Howard Richards
          wrote on last edited by
          #4

          I assume (as you have not explained) that you want to fix the sequence so that it is correct. ID="15" is out-of-sequence but then so are all the remaining items after it. Unless your example is also wrong. Please explain your objectives.

          'Howard

          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