Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have not used SqmlReader, but every time I have seen this problem it has been due to namespaces. A quick look at the HTML on www.arrow.com shows that this node has a namespace (note the xmlns:javaurlencoder):</p> <pre><code>&lt;form name="CatSearchForm" method="post" action="http://components.arrow.com/part/search/OP295GS" xmlns:javaurlencoder="java.net.URLEncoder"&gt; </code></pre> <p>This code is how I loop through all nodes in a document to see which ones have namespaces and which don't. If the node you are looking for or any of its parents have namespaces, you must create a <code>XmlNamespaceManager</code> and pass it along with your call to <code>SelectNodes()</code>.</p> <p>This is kind of annoying, so another idea might be to strip all the xmlns: attributes out of the XML before loading it into a <code>XmlDocument</code>. Then, you won't need to fool with <code>XmlNamespaceManager</code>!</p> <pre><code>XmlDocument doc = new XmlDocument(); doc.Load(@"C:\temp\X.loadtest.xml"); Dictionary&lt;string, string&gt; namespaces = new Dictionary&lt;string, string&gt;(); XmlNodeList nlAllNodes = doc.SelectNodes("//*"); foreach (XmlNode n in nlAllNodes) { if (n.NodeType != XmlNodeType.Element) continue; if (!String.IsNullOrEmpty(n.NamespaceURI) &amp;&amp; !namespaces.ContainsKey(n.Name)) { namespaces.Add(n.Name, n.NamespaceURI); } } // Inspect the namespaces dictionary to write the code below XmlNamespaceManager nMgr = new XmlNamespaceManager(doc.NameTable); // Sometimes this works nMgr.AddNamespace("ns1", doc.DocumentElement.NamespaceURI); // You can make the first param whatever you want, it just must match in XPath queries nMgr.AddNamespace("javaurlencoder", "java.net.URLEncoder"); XmlNodeList iter = doc.SelectNodes("//ns1:TestProfile", nMgr); foreach (XmlNode n in iter) { // Do stuff } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      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