Note that there are some explanatory texts on larger screens.

plurals
  1. PORemoving childnodes using HAP
    primarykey
    data
    text
    <p>When i'm trying to remove a childnode from my xpath i'm getting a weird error:-</p> <p>System.ArgumentOutOfRangeException was unhandled Message=Node "" was not found in the collection</p> <p>I know there an issue with HAP childremoving but idk if they have fix it with the new release or not. My question is it my code that is wrong or is it HAP? In either way is there any way to get around that and remove those childnode?</p> <p>Here is my code:-</p> <pre><code> List&lt;MediNetScheme&gt; medinetScheme = new List&lt;MediNetScheme&gt;(); HtmlDocument htdoc = new HtmlDocument(); htdoc.LoadHtml(results); foreach (HtmlNode table in htdoc.DocumentNode.SelectNodes("//table[@class='list-medium']/tbody[1]/tr[@class]")) { string itemValue = string.Empty; HtmlNode ansvarig =table.SelectSingleNode("//table[@class='list-medium']/tbody[1]/tr[@class]/td[4]"); table.RemoveChild(ansvarig, true); itemValue = table.InnerText; medinetScheme.Add(new MediNetScheme(){Datum=itemValue.Remove(15),Sections=itemValue.Remove(0,15)}); } MediNetScheme.ItemsSource = medinetScheme; </code></pre> <p>Edit:-</p> <p>My HTML document has a table with several rows that have this xpath :- "//table[@class='list-medium']/tbody<a href="https://i.stack.imgur.com/LEZif.jpg" rel="nofollow noreferrer">1</a>/tr[@class]". Each row in this table have 5 columns td<a href="https://i.stack.imgur.com/LEZif.jpg" rel="nofollow noreferrer">1</a>...td[5]. In my first foreach loop i'm using selectnodes to get the HTMLcode of each row in the table. What i want to do is to get only the innertext from the first 3 td in each row, which means i need to get rid of td[4] and td[5] from each row. When i used your edited code, i was able to get rid of td[4] and td[5] in the first row but not other rows that follows the first row.</p> <p>Here is a pic of my HTML:- <img src="https://i.stack.imgur.com/LEZif.jpg" alt="enter image description here"> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload