Selecting XML Nodes Using XPath Syntax
Nov 9, 2011
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] ......
View 1 Replies
ADVERTISEMENT
Mar 28, 2009
Is the following possible in one XPath expression (see sample below) Select all (span tags of class msg) AND all ((img tags that have a non-empty alt attribute) AND (are NOT located inside a span tag of class msg))
[Code]...
View 1 Replies
Aug 12, 2010
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]...
View 1 Replies
May 12, 2011
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...
[Code]...
View 2 Replies
Nov 1, 2011
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?
<?xml version="1.0"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
[code]....
View 1 Replies
Jun 27, 2012
I am trying to identify duplicate serial numbers from the following xml using XPath 1.0 and then evaluating it in .Net using an XPathNavigator.
<?xml version="1.0" encoding="utf-16"?>
<Inventory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Items>
[code]....
I tried to do this by evaluating this
//Items/Item/SerialNumber
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.
View 2 Replies
Oct 10, 2011
I'm simply trying to parse a SOAP Response and pull out the ResponseCode and UnconfirmedReasonCode Elements out of the following XML:
[code]...
View 1 Replies
Jan 31, 2012
I have following xml:
[Code]....
and I need to pick node from Id 25 to id 75. It is a portion of XML. Original XML is very long. How to do it without XPath? Dim nodeList As XmlNodeList = xmlDoc.SelectNodes("//Node[@id >" & 25 & " and @id <" & 75 & "]") Dim sb As StringBuilder = New StringBuilder For Each childNode As XmlNode In nodeList sb.Append(childNode.InnerText) Next but it is not working ...
View 1 Replies
Feb 15, 2010
I am using 1 listbox and 4 text box. I want to retrieve data from my database i.e. ms access database into listbox I am firing the select query by using this code on Page Load event and list box selecetedindex change event which is following.[code]...
View 3 Replies
May 16, 2010
I am using 1 listbox and 4 text box. I want to retrieve data from my database i.e. ms access database into listbox I am firing the select query by using this code on Page Load event and list box selecetedindex change event which is following.
The following code is load in Page load event
Private Sub PopulateProductList()
Dim con As OleDbConnection
[code].....
View 4 Replies
Aug 27, 2010
I am new to nodes() method. I am getting the foloowing syntax when trying to create a stored procedure using the nodes() method.
The syntax error:
Msg 170, Level 15, State 1, Procedure spmTestSelect, Line 19
Line 19: Incorrect syntax near '.'.
[code]...
View 2 Replies
Sep 13, 2011
What is the proper syntax for this:
Dim qry As <??> = From f In dirInfo.GetFiles("*.QBW") Select File = f.FullName, Include = True
Dim dt As DataTable = qry.CopyToDataTable()
I tried as "IEnumerable(Of DataRow)" but that didn't work. At runtime it said:
Unable to cast object of type
'WhereSelectArrayIterator2[System.IO.FileInfo,VB$AnonymousType_02[System.String,System.Boolean]]'
to type
'System.Collections.Generic.IEnumerable`1[System.Data.DataRow]'.
View 5 Replies
Aug 31, 2011
I'm all new to this treeview business. I have a fixed treeview, very simple and basic. Only two levels, parent and child nodes. I just need two things out of this treeview.
1) If parent is checked, check all child nodes.
2) If just one child node is unchecked, uncheck parent node.
That's it! I've been looking for this for 30 mins and I cant find it. Maybe because my vb.net is old, it doesnt seem to be the same as others =/ I'm using vb.net 2003.
View 2 Replies
Dec 15, 2011
I have a problem with my treeview. I have two child nodes with different parents which contains a literal (*x). In this case (*1) (view image)
[Code]...
View 1 Replies
Dec 16, 2010
I have a treeview that is populated from a HDD folder collection. Its structure is similar to the following (however the structure is dynamic):
My Disk:
|
|--folder1(tag:folder)
| |--subfolder1(tag:folder)
[code]....
I call the sub as follows:
deleteNode(treeview1.Nodes(0).Nodes)
However, the above is not working properly. It deletes only some nodes and not all the targeted nodes.
View 2 Replies
Mar 14, 2009
how to add treeview nodes and sub sub nodes using functions
View 1 Replies
Mar 14, 2010
I'm running out of walls to bang my head against. Okay new windows form with a textbox, button and TreeView Populate the TreeView.nodes with the default nodes via properties
[Code]...
I want to click button1 and have the name of the childnode? Node3? placed in the textbox. Not via selection, I can do that. But via index or item number. The code I have is as follows
[Code]...
View 7 Replies
Oct 17, 2011
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]
View 2 Replies
Feb 1, 2010
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...]
View 1 Replies
Feb 7, 2012
Basically I have an XML file that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<data>
<sender sndid="FT">
[code].....
View 1 Replies
Nov 3, 2011
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")
[code]....
View 1 Replies
Apr 24, 2009
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.
<PLUS_BORROWER Type="Primary"> <SOCIAL_SECURITY_NBR>123459999</SOCIAL_SECURITY_NBR> <CREDIT_SCORE ModelName="Emperica">793</CREDIT_SCORE> <DAYTIME_PHONE_NBR>4077889999</DAYTIME_PHONE_NBR> <DAYTIME_PHONE_EXT>101</DAYTIME_PHONE_EXT></PLUS_BORROWER>
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)
View 5 Replies
Apr 24, 2009
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]
View 3 Replies
Sep 13, 2009
I have successfully loaded my .xml file into a listview using the
vb.net
'// Create an instance of the XML
Dim XMLItem As New Xml.XmlDocument
[Code]....
This load the "name" of the city into the listview, but i also need to load the "code" into the next column in the listview
View 4 Replies
Oct 28, 2011
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] .....
View 3 Replies
May 18, 2009
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..
[Code]...
View 5 Replies
Oct 12, 2011
I am having an issue trying to figure this out. I am writing a script editor that uses tabs (a tab control) and I want to implement syntax highlighting. My issue is that every sample I can find on syntax highlighting uses
Private Sub RichTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged
View 1 Replies
Feb 19, 2012
trying to parse this:
<?xml version="1.0" encoding="UTF-8"?>
<directoryresponse xmlns="https://www.sisow.nl/Sisow/REST" version="1.0.0">
<directory>[code]......
Here's my code:
XPath = "//directoryresponse/directory/issuer/issuerid"
Dim nodeList As XmlNodeList = XML.SelectNodes(XPath)
but nodelist.count=0...why?
View 3 Replies
Jan 11, 2011
I'm using this code in my ASP.NET/VB.NET project:
Dim sourceFile as String = "http://xml.weather.yahoo.com/forecastrss?p=94704"
Dim xPath As New XPath.XPathDocument(sourceFile)
and the second line gives the error: "Unable to connect to the remote server"
When I browse the url (sourceFile) in web browser, it opens the RSS feeds page finely. How can I remove this error?
View 1 Replies
Feb 17, 2011
We want to get XPath of highlighted text from a web page. How to do, pls guide us.
Currently we are using GeckoFX layout engine to display web page. Its a windows application using VB.Net
We have to get selected text/object full html tag ..
ex: If I an selecting a list item which is under a body and div tag the I have to get like this \bodydivulli
View 1 Replies