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. C#
  4. C# code to relate two nodes

C# code to relate two nodes

Scheduled Pinned Locked Moved C#
csharphtmlcomalgorithmsjson
5 Posts 4 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
    AshwiniSH
    wrote on last edited by
    #1

    I am working with C# windows application. I have html source, which im converting to html node collection using htmlagilitypack. I am parsing through each node and searching for a text. I want to get the relation between two nodes.

    For eg:

    <div>

    <a href="www.google.com"></a>

    </div>

    <div>

    <a href="www.abc.com">structure</a>

    </div>

    My node1 = <a href="www.google.com"></a>. I will search for text "structure" in other nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

    Can i relate these two nodes? say node2 is sibling or parent or child or descendant of node1.

    Please help me...

    My node1 = <a href="www.google.com"></a>. I will search for text "structure" in remaining nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

    Can i relate these two nodes? Like node2 is in sibling or parent or child or descendant etc of node1.

    Please help me...

    B OriginalGriffO L 3 Replies Last reply
    0
    • A AshwiniSH

      I am working with C# windows application. I have html source, which im converting to html node collection using htmlagilitypack. I am parsing through each node and searching for a text. I want to get the relation between two nodes.

      For eg:

      <div>

      <a href="www.google.com"></a>

      </div>

      <div>

      <a href="www.abc.com">structure</a>

      </div>

      My node1 = <a href="www.google.com"></a>. I will search for text "structure" in other nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

      Can i relate these two nodes? say node2 is sibling or parent or child or descendant of node1.

      Please help me...

      My node1 = <a href="www.google.com"></a>. I will search for text "structure" in remaining nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

      Can i relate these two nodes? Like node2 is in sibling or parent or child or descendant etc of node1.

      Please help me...

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      How do you determine whether a node is a sibling/parent/child of another node? By its location in the same container (div) element? Something else? Not clear to me.

      A 1 Reply Last reply
      0
      • B Bernhard Hiller

        How do you determine whether a node is a sibling/parent/child of another node? By its location in the same container (div) element? Something else? Not clear to me.

        A Offline
        A Offline
        AshwiniSH
        wrote on last edited by
        #3

        It can be in the same container or different. I want to relate the nodes. Say node1's parent's sibling is node2 or node1's sibling is node2 or any scenario that gives the connection between the two nodes. For Ex: <div> <node1/> </div> <div> <node2/> </div> node2 is node1's parent's (div1) sibling's (div2) child I hope this is clear.

        1 Reply Last reply
        0
        • A AshwiniSH

          I am working with C# windows application. I have html source, which im converting to html node collection using htmlagilitypack. I am parsing through each node and searching for a text. I want to get the relation between two nodes.

          For eg:

          <div>

          <a href="www.google.com"></a>

          </div>

          <div>

          <a href="www.abc.com">structure</a>

          </div>

          My node1 = <a href="www.google.com"></a>. I will search for text "structure" in other nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

          Can i relate these two nodes? say node2 is sibling or parent or child or descendant of node1.

          Please help me...

          My node1 = <a href="www.google.com"></a>. I will search for text "structure" in remaining nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

          Can i relate these two nodes? Like node2 is in sibling or parent or child or descendant etc of node1.

          Please help me...

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          Logically, the only relation between the two is that they are siblings - they are both children of the parent node that encompases them. Neither of these is a parent or child to the other.

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          1 Reply Last reply
          0
          • A AshwiniSH

            I am working with C# windows application. I have html source, which im converting to html node collection using htmlagilitypack. I am parsing through each node and searching for a text. I want to get the relation between two nodes.

            For eg:

            <div>

            <a href="www.google.com"></a>

            </div>

            <div>

            <a href="www.abc.com">structure</a>

            </div>

            My node1 = <a href="www.google.com"></a>. I will search for text "structure" in other nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

            Can i relate these two nodes? say node2 is sibling or parent or child or descendant of node1.

            Please help me...

            My node1 = <a href="www.google.com"></a>. I will search for text "structure" in remaining nodes and as a result i get node2 = <a href="www.abc.com">structure</a>

            Can i relate these two nodes? Like node2 is in sibling or parent or child or descendant etc of node1.

            Please help me...

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            AshwiniSH wrote:

            Can i relate these two nodes?

            Yes, but how do you determine the relationship? As it stands there is nothing to connect the two nodes, they are just independent URIs; you need to set some rules that specify how they relate to each other.

            Veni, vidi, abiit domum

            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