473,396 Members | 2,098 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,396 software developers and data experts.

Simple Xpath Query

Hello,
I am having the following XML file:
-----
<bibRecords xmlns="http://tempuri.org/bibrecords.xsd">
<bibRecord>
<entryID>1</entryID>
<tag>Shioura97</tag>
<entrytype>Conference Proceedings</entrytype>
</bibRecord>
</bibRecord>
------

Dim oNode As Xml.XmlNodeList
oNodes = xmldoc.SelectNodes("/bibRecords/bibRecord[entryID='1']")

The above 2 lines is returning oNodes.count=0, whereas the following line:

oNodes = xmldoc.GetElementsByTagName("bibRecord")

is returning oNodes.count=1 as expected. Seems like I am making some stupid mistake in the Xpath query, or may be missing something. Can somebody point it out?
Thanks and regards,
--
Samik Raychaudhuri
University of Wisconsin, Madison

To email me, replace 'K' with 'e' in the 'From' field.

Nov 11 '05 #1
1 3111
Well, the solution is more stupid :-( I had to remove the xmlns="http://tempuri.org/bibrecords.xsd" part from first line. Anybody knows why this was the problem?
-Samik

On 7/27/2003 6:51 PM, Samik Raychaudhuri wrote:
Hello,
I am having the following XML file:
-----
<bibRecords xmlns="http://tempuri.org/bibrecords.xsd">
<bibRecord>
<entryID>1</entryID>
<tag>Shioura97</tag>
<entrytype>Conference Proceedings</entrytype>
</bibRecord>
</bibRecord>
------

Dim oNode As Xml.XmlNodeList
oNodes = xmldoc.SelectNodes("/bibRecords/bibRecord[entryID='1']")

The above 2 lines is returning oNodes.count=0, whereas the following line:

oNodes = xmldoc.GetElementsByTagName("bibRecord")

is returning oNodes.count=1 as expected. Seems like I am making some
stupid mistake in the Xpath query, or may be missing something. Can
somebody point it out?
Thanks and regards,


Nov 11 '05 #2

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

Similar topics

1
by: Joshua Beall | last post by:
Hi All, I have a task that should be very simple but I'm running into trouble. All I want to do is query a document using XPath, and save the resulting XML in a string. Here's that I am trying...
6
by: 0wl | last post by:
Hi, I am trying to get the value of child from xmlstr = """<p:root xmlns:p="http://tempuri.org/string"><p:child DataType="String">Hellpppp</p:child></p:root>""" using...
2
by: R | last post by:
Hello everybody. I'm new to XML and I've got problem with one XPath query. This is my situation: <group> <test required='1'></test> <test required='1' noregexp='1'></test> </group> inside...
7
by: chris.millar | last post by:
The below xml is saved as a file, i want the quickest way in c# of reading just the DataSource section and returning it as a string, can anyone help me out. Cheers Chris. <NewDataSet>...
7
by: Ot | last post by:
I posted this to the wrong group. It went to m.p.dotnet.languages.vb. Ooops. -------------------------------------------------------------------- I have this tiny problem. I have learned...
10
by: Michael C# | last post by:
OK, here's the deal. I have a small XML file that represents a small database table. I load it into a System.XML.XMLDocument. So far so good. I run an XPath query against it to retrieve all the...
5
by: Gnic | last post by:
Hi , I have an XmlDocument instance, I want to find a node in the xml, but I don't know it's path until runtime, for example <aaa> <bbb name="x"/> <aaa attr="y"> <ccc>sometext</ccc> </aaa>
6
by: dotnetnoob | last post by:
i would like to know how i can build xpath expression dynamiclly. let's say i have a following xml file: <EventEnrollment InstanceNumber = "675"> <EventSource> <ObjectReference...
6
by: Armel Asselin | last post by:
Hello, I'm searching for a simple command line tool to manipulate XML files. The idea would be commands such as that: xmanip-tool set /document/xpath/@name="value" remove //wrong-nodes add...
3
by: Jason Mobarak | last post by:
Hello -- I'm attempting to get a handle on how to do xpath queries with System.Xml -- so far the biggest hurdle has been how to deal with a default namespace. If I use the test xml: <?xml...
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:
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.