473,387 Members | 1,535 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,387 software developers and data experts.

Problems with XPath


I decided to rewrite a parser that I wrote with XmlTextReader
cause I did have some problems with the pull model, but now I can't
start coding it 'cause even the simplest XPath query doesn't work,
and I don't know why :(

I have an xml document such as mine: http://loluyede.blogspot.com/atom.xml
(you have to view the source cause blogger.com applies a css stylesheet)

I tried to "query" simple elements like <title> with (/feed/title) but I
get no nodes with .NET XPath Select*() functions :( What I'm doing wrong?

The strange thing is that if I try with a xml doc like this:

<entry>
<title>The title of the entry.</title>
<link rel="alternate" type="text/plain" href="http://www.w3.org/" title="The title of the link." />
<contributor>
<name>Uncle Bob</name><url>http://people.w3.org/</url><email>fo*@bar.com</email></contributor>
<id>http://localhost/foo/id</id><modified>2004-02-12T17:43:22+01:00</modified>
<issued>2004-02-12T17:43:22+01:00</issued>
<created>2004-02-12T17:43:22+01:00</created>
<summary>The summary of the entry.</summary>
<content>The content of the entry.</content>
</entry>

/entry/title works well :(

Bye

--
Lawrence
Nov 12 '05 #1
5 1283

Nov 12 '05 #2

Mmm have you made an empty post? I don't read anything...

--
Lawrence
Nov 12 '05 #3
"Lawrence Oluyede" <ra***@dot.com> wrote in message
news:87************@mobile.foo...

I decided to rewrite a parser that I wrote with XmlTextReader
cause I did have some problems with the pull model, but now I can't
start coding it 'cause even the simplest XPath query doesn't work,
and I don't know why :(

I have an xml document such as mine: http://loluyede.blogspot.com/atom.xml
(you have to view the source cause blogger.com applies a css stylesheet)

I tried to "query" simple elements like <title> with (/feed/title) but I
get no nodes with .NET XPath Select*() functions :( What I'm doing wrong?

The strange thing is that if I try with a xml doc like this:


The document in question has a default namespace set to
"http://purl.org/atom/ns#" so you need to add and a dummy prefix this using
a namespace manager before you can query the document.

--
Joe
Nov 12 '05 #4
Lawrence Oluyede wrote:
I decided to rewrite a parser that I wrote with XmlTextReader
cause I did have some problems with the pull model, but now I can't
start coding it 'cause even the simplest XPath query doesn't work,
and I don't know why :(

I have an xml document such as mine: http://loluyede.blogspot.com/atom.xml
(you have to view the source cause blogger.com applies a css stylesheet)


That's a FAQ. Search in archives about default namespace and XPath.
See documentation on XmlNode.SelectNodes Method (String,
XmlNamespaceManager) method.

--
Oleg Tkachenko [XML MVP, XmlInsider]
http://blog.tkachenko.com
Nov 12 '05 #5
"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> writes:
That's a FAQ. Search in archives about default namespace and XPath.
See documentation on XmlNode.SelectNodes Method (String,
XmlNamespaceManager) method.


Thank you very much!

--
Lawrence
Nov 12 '05 #6

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

Similar topics

3
by: Alan Krueger | last post by:
Greetings, I've been able to cache Transformer objects in a Tomcat-based servlet application to avoid unnecessary Transformer rebuilding, except for certain ones on certain machines. I'm...
5
by: John Bailo | last post by:
I wrote a webservice to output a report file. The fields of the report are formatted based on information in an in-memory XmlDocument. As each row of a SqlDataReader are looped through, a...
2
by: David Williams | last post by:
I have a simple XML file that I have been using: <component name="test"> <class name="class"/> <component> Up till now, the Xpath of "//component/class" worked well to select the <class>...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
5
by: Chua Wen Ching | last post by:
Hi, I read from this tutorial at codeproject Question A: http://www.codeproject.com/csharp/GsXPathTutorial.asp regarding xpath.. but i try to apply in my situation, and can't get it...
7
by: John Bowman | last post by:
Hi All, I'm fairly new to XML, so I presume I'm doing something obviously dense here, but here it goes. Below is an XML file that was extracted from a test Windows Installer .MSP (patch) file...
4
by: jasonnerothin | last post by:
I'm trying to figure out exactly what's going wrong with an xpath keyref validation scenario. In brief, I have something like the following in my xsd: <xs:schema> <xs:complexType...
0
by: Torsten Munkelt | last post by:
Hi, I want to write an XML-schema saying that this document <root> <edge type="special"> <target type="one"/> </edge> <edge type="special"> <target type="one"/>
0
by: peterpeter | last post by:
Hi. There is a XML schema problem that I have with key/keyref: I have a complex type "AExtended" which inherits from a base type "ABase". Both are allowed to be instantiated under the "Root"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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
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...

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.