473,395 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XMLDocument Parsing Issue in VB.NET

Hi,

I am trying to parse a xmldocument and to get value of a name tag
"techlanguage" is "vbdotnet".

Here i need to select the propername tag which is "techlanguage" and
the propervalue which is "vbdotnet"

Here is the structure of my XML

<?xml version="1.0" encoding="utf-8" ?>
<filters>
<filter customFilterType="">
<name>techdatabase</name>
<value>sqlserver</value>
</filter>
<filter customFilterType="">
<name>techlanguage</name>
<value>vbdotnet</value>
</filter>
<filter customFilterType="">
<name>techjava</name>
<value>j2ee</value>
</filter>
</filters>

Here is the code that tries to get the techlanguage as vbdotnet

Dim XMLValidateDoc As New XmlDocument
Dim Selectedtechlanguage As
System.Xml.XmlNode
Dim techlanguage As String
Try
XMLValidateDoc.Load(New
StringReader(Me.ucFilterSelector1.FilterXML.ToStri ng()))
Selectedtechlanguage =
XMLValidateDoc.SelectSingleNode("///name[@name=techlanguage ]")
If Not Selectedtechlanguage Is Nothing
Then
'here i need to assign vbdotnet as
the techlanguage
' techlanguage = "vbdotnet" this is
what i exactly want
techlanguage =
Selectedtechlanguage.InnerText
End If

' bla bla

What is exact XPATH query i need to make to get the techlanguage valus
which is vbdotnet.please let me know what is the right code to do
this..

thanks
satish

Jan 12 '07 #1
1 3069
* rajesh wrote in microsoft.public.dotnet.xml:
>I am trying to parse a xmldocument and to get value of a name tag
"techlanguage" is "vbdotnet".

Here i need to select the propername tag which is "techlanguage" and
the propervalue which is "vbdotnet"

Here is the structure of my XML

<?xml version="1.0" encoding="utf-8" ?>
<filters>
<filter customFilterType="">
<name>techdatabase</name>
<value>sqlserver</value>
</filter>
<filter customFilterType="">
<name>techlanguage</name>
<value>vbdotnet</value>
</filter>
>XMLValidateDoc.SelectSingleNode("///name[@name=techlanguage ]")
Try: /filters/filter[ name = 'techlanguage' ]/value
--
Björn Höhrmann · mailto:bj****@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Jan 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Martin Honnen | last post by:
With both .NET 1.0 and 1.1 I have found the following strange behaviour where System.Xml.XmlDocument.LoadXml doesn't throw an error when parsing a text node with a character reference to an invalid...
13
by: Matthew Wieder | last post by:
In my C# application, I have class which has method that opens an XML document, modifies it and saves it out. I run that method for several different XML documents. What I've found is that the...
1
by: RiceGuy | last post by:
Hi, I'm wondering on how to go about writing a simple XML parser, one that doesn't use the XmlDocument class (DOM API) and relies only on (in-built, so to say low-level) file system and string...
7
by: Mark | last post by:
Hi... A colleague just referred this question to me. He's getting an xml file from another party, which he's trying to process into another dom using an XmlTextReader and...
1
by: Peter Nofelt | last post by:
Hey All, I'm running into this issue with parsing through an xml document by tag name. Below is an example xml document: File Name: things.xml <things> <people> <name>Peter</name>
4
by: David Grogan | last post by:
Hi, 2 questions.... 1. I'm parsing an XHTML document that contains both the default namespace (xmlns="http://www.w3.org/1999/xhtml") and a custom one (xmlns:r="...") - both of these being...
2
by: Phil Galey | last post by:
I'm using the followg code to add the attribute overwrite='true" to a select list of XML tags in an XML document. The document is loaded from a file and just the tags with names matching what's in...
2
by: rajesh | last post by:
Hi, I am trying to parse a xmldocument and to get value of a name tag "techlanguage" is "vbdotnet". Here i need to select the propername tag which is "techlanguage" and the propervalue...
3
MrMancunian
by: MrMancunian | last post by:
Hi, I've created an HTTP connection with a server. I send a WebRequest in XML to the server (see strReq in code) and it returns me a WebResponse. This response is inserted in a string, which is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.