I'm new to this and working from a tutorial. I have a variation on the following code:
Dim xDoc As XPathDocument Dim xNav As XPathNavigator xDoc = New XPathDocument("xxxxxxx.xml") xNav = xDoc.CreateNavigator()
However, "CreateNavigator" returns: 'debuggerDisplayProxy' is a type and cannot be used as an expression.This seems like something basic and it's stopping me from continuing with a lot of other stuff that I know works.
I have the following 2 lines of code:[code]I'm looking to get the value for first instance of lastWriteTime which should be 2011-10-13T10: 48: 48. 3833771-04:00 but the code just pops up an empty string. Sorry for the big post but here is the entire XML file for reference. Can anyone see why this isn't working, or give me an example of how to make it work some other way? [code]
I have an XElement and an XPath expression that selects a node from it. It works fine in the original program that I wrote it in but doesnt work if I paste it to another program. I've checked the references and import statements.
I think the problem might be that the original program had the code within the class of a wpf window while it was moved to a abstract class where it doesnt work.[code...]
I have a XPath expression that is supposed to return/get only one node out of the XML document. But it is getting more than the one. I don't understand why.
Code-behind:
Dim xmlNameTbl As XmlNameTable = rootDoc.NameTable Dim xmlNS As XmlNamespaceManager = New XmlNamespaceManager(xmlNameTbl) xmlNS.AddNamespace("asp", "http://test.com/asp")
There are multiple occurances of the PLUS_BORROWER data. For each occurence of PLUS_BORROWER, I want to save the CREDIT_SCORE and DAYTIME_PHONE_NBR when the Type= And SOCIAL_SECURITY_NBR are certain values. Then I want to execute a loop and extract the Credit_Score and Daytime_Phone_Nbrs.
I have the following code that will pull off the first PLUS_BORROWER if the Type='Primary', but I am having trouble expanding it.
oExtraData.Load(myXMLFile) 'only select nod with type attribute equal primary Dim oNode As Xml.XmlNode = oExtraData.SelectSingleNode("//PLUS_BORROWER[@Type='Primary']") 'get credit score node Dim scoreNode As Xml.XmlNode = oNode.SelectSingleNode("CREDIT_SCORE") MsgBox("I have the Primary") MsgBox("Credit score is " & scoreNode.InnerText)
There are multiple occurances of the PLUS_BORROWER data. For each occurence of PLUS_BORROWER, I want to save the CREDIT_SCORE and DAYTIME_PHONE_NBR when the Type= And SOCIAL_SECURITY_NBR are certain values.Then I want to execute a loop and extract the Credit_Score and Daytime_Phone_Nbrs.[code]
I'm trying to get the value of a specific <div> from an html. This div has a class attribute of "itemPrice6", but problem is that this class appears few more times for other <div>s in which i'm not interested in. Best thing for me is if I am able to access the needed <div> using something like XPATH so I can target only those I need.
My Code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim web As New HtmlAgilityPack.HtmlWeb Dim doc As HtmlAgilityPack.HtmlDocument = web.Load("[URL]") Dim prices As HtmlAgilityPack.HtmlNodeCollection = [Code] .....
I am using the httplistener to grab xml off a POST.. so I dont have a file.. I just take the xml string and put to string.. but I tried to use this code..
Trying to figure out XPath and I have successfully create an XPathExpression that lets me grab the events, but any nested sub groups seem to be unavailable to the query, I can get all the children on the Events group, but the LocationName field I can not access.[code]...
Given the xml below why does the first selectsinglenode call not work but the second one does? Are the single quotes specifying a string type or something? Dim dbglvlnode As Xml.XmlNode = doc.SelectSingleNode(String.Format("Config/Scanner[DeviceID = '{0}']/DebugLevel", XMLstuff.DeviceID)) Dim dbglvlnode As Xml.XmlNode = doc.SelectSingleNode(String.Format("Config/Scanner[DeviceID = {0}]/DebugLevel", XMLstuff.DeviceID)) <?xml version="1.0" standalone="yes"?> [Code] ......
The xml document is like so: ... I would like to use XPath to Navigate but I am not sure where to get started. Can anyone point me to some examples of traversing the nodes? I have the first part figured out but not sure how to iterate through all l1,l2,l3,l1 nodes...
which is working, but it returns a NodeIterator that only contains the first Row node in the first record!? As far as I can tell, that's the proper syntax for an xpath expression of "return all Row nodes with a parent table name anywhere in the document".
I have the following XML from Amazon's Marketplace API. I need to sum all the values of Item/ItemPrice/Component[type='Principal']/Amount for all Items to compute an order total. Is this possible to do using LINQ to XML in VB.NET?
I have an XML file (attached) that I need some help/advice xpath coding for different sections of the xml code.Below is a snippet (example) of the xml
<properties> <list id="hnls"> <!-- START OF GUI HINTS AND TIPS --> <record>
<string id="text" value="Selecting the national flag icon on any screen will take you to the senior national team screen.[COMMENT: Hints and Tips, GUI, Beginner Level, Note: tells the user how to use a shortcut to browse to national squad screens]" />
Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents.selecting the preceding-sibling of div class="address" in this url[url].....The sibling that I want is h3 class="listingTitleLine" Here is a screenshot:
Using VB.Net,I have an XmlNode object, xNode.I need to select an attribute of this node if it has a particular value.
e.g. xNode.SelectSingleNode(".[@attr1='1']")
I would expect this statement to return the attribute "attr1", only if it has a value of "1". However, I get an error - Expression must evaluate to a node-set.When I tried this - xNode.SelectSingleNode("@attr1[@attr1='1']")It always returns Nothing, even if the attribute has a value of 1.
I have been at it for few weeks now and just learning XML and VB but seems like I hit a road block. I tried a few different attempts at doing this and I have no problem displaying the XML file on a webpage using the xpathnavigator class. But then i needed to format into an html table so i took another route and just added the xmldatasource with a formview. So here is my code for that
I've converted an html to XML and now i want to get all the child nodes nested within a DIV element with a specific attribute (class="itemInfo").Because the html that the XML is based on changes from time to time i want to use a more "safe" relative root, (something like : "//div[@class='itemInfo']").Problem is that i always get 0 nodes ...
Dim doc As New System.Xml.XmlDocument() doc.Load("products.xml") Dim root As System.Xml.XmlElement = doc.DocumentElement
My goal is to just select the 2nd one, the <span> tag and am not sure why <p> tag is also being selected. If it selects <p>, but why wouldn't it also select the <strong> or <a>, and why not the <table> or <td> that contain the <p>?
expression in a custom XSLT Context Function (implementing IXsltContextFunction like this MSDN example) in .Net but the Invoke function gets called one result at a time so I have no visibility of the other results to find duplicates.
1) Is there a way of doing this using a single XPath 1.0 expression?
2) Is there a way of passing in an array of elements into a single Invoke call of the custom XSLT Context Function class? I'm working in VB.Net but am happy with any C# examples anyone can share.
this list has tried to mix numerical variable, such as 1, 2,3 within an xpath expression. [code] For some reason, item_ number_ first and item_number_last appear to have no value in the above code snippet, when they do have values they get printed as in the [code]Could anyone please give me some hints on what to modify here to make the numerical data be able to mix within my xpath?
I have spent the last 20 plus hours trying to parse a incredibly small XML file with Xpath. I understand that it is a ready only, extremely fast way to pull values out of an xml file. Here is the string I am working with. I have a 3rd party function that returns results, based on these xml results i would like to retrieve certain vaules.
I'm looking for the actual index position in a given source string.I have the following string
"<a> <b>zyx</b> <b>wvu</b>
[code]....
I'm loading that string into a .NET XmlDocument object. Carriage Returns and Line Fees may be a factor here.
Dim xmlSearchText As New XmlDocument() xmlSearchText.LoadXml(SearchTextBox.Text) Dim selectedNode As XmlNode = xmlSearchText.SelectSingleNode(txtSearch.Text)
The following XPath Statement could be used to find the 3rd node:
a/b[.='tsr']
However, I need it to return a string index of 23 rather than the ordinal position of 3.