473,795 Members | 3,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namespaces & Atom feeds

I'm new to XML namespaces, and I seem to be missing something obvious
in this code snippet, which is trying to retrieve the feed/entry nodes
from an XPathNavigator document:

XmlNamespaceMan ager mgr = new
XmlNamespaceMan ager(xpNav.Name Table);
mgr.AddNamespac e("atom", "http://www.w3.org/2005/Atom");

XPathExpression itemsExpr = xpNav.Compile("/atom:feed/
atom:entry/");
itemsExpr.SetCo ntext(mgr);

XPathNodeIterat or items = xpNav.Select(it emsExpr);

The error comes back...

"The expression passed to this method should result in a NodeSet." --
and, indeed, the XPathNodeIterat or doesn't result in any entries.

I'm using .Net 1.1. I believe this might affect the final code.

Thanks for any pointers.

--Brent
Jul 1 '08 #1
2 1806
* Brent wrote in microsoft.publi c.dotnet.xml:
>I'm new to XML namespaces, and I seem to be missing something obvious
in this code snippet, which is trying to retrieve the feed/entry nodes
from an XPathNavigator document:

XmlNamespaceMan ager mgr = new
XmlNamespaceMa nager(xpNav.Nam eTable);
mgr.AddNamespac e("atom", "http://www.w3.org/2005/Atom");

XPathExpression itemsExpr = xpNav.Compile("/atom:feed/
atom:entry/");
Remove the final slash.
--
Björn Höhrmann · mailto:bj****@h oehrmann.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/
Jul 1 '08 #2
Thank you! This fix resolved my issue completely.

--Brent

On Jul 1, 12:35*am, Bjoern Hoehrmann <bjo...@hoehrma nn.dewrote:
* Brent wrote in microsoft.publi c.dotnet.xml:
I'm new to XML namespaces, and I seem to be missing something obvious
in this code snippet, which is trying to retrieve the feed/entry nodes
from an XPathNavigator document:
* * * *XmlNamespaceMa nager mgr = new
XmlNamespaceMan ager(xpNav.Name Table);
* * * *mgr.AddNamespa ce("atom", "http://www.w3.org/2005/Atom");
* * * *XPathExpressio n itemsExpr = xpNav.Compile("/atom:feed/
atom:entry/");

Remove the final slash.
--
Björn Höhrmann · mailto:bjo...@h oehrmann.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/
Jul 2 '08 #3

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

Similar topics

3
2036
by: luc wastiaux | last post by:
Hello, I have a website with image galleries and users can post comments for the pictures. I want to make the comments available over an RSS-type feed so that I can check what comments have been posted. I would like to include a thumbnail of the picture being commented in the feed data. What feed type should I choose ? RSS 0.9x, 1.0, 2.0 or Atom ? thanks. --
0
1375
by: banjolibrarian | last post by:
I have been setting up RSS and Atom feeds for our library's podcasts. The RSS feed works fine, but when I subscribe to the Atom feed (via Bloglines), the link to the file itself defaults to blogspot.com. Any help would be appreciated. The full contents of southlakelibrary.atom are listed below: <atom:feed xmlns:atom="http://www.w3.org/2005/Atom"> <atom:id>http://www.cityofsouthlake.com/library/podcasts.asp</atom:id>
0
1693
by: S.T | last post by:
Hi! I've spend this weekend trying and coding a php-based atom- and rss-feed writer. I don't know if this is the right place for my questions. However, since both feeds are based on xml, maybe someone can help. I understand that I have to replace all unknown entities, such as "&auml;". I wonder what's the common way to do so. For XML-Documents, I'd prefer to make use of an external DTD, say, referring to
0
1336
by: =?Utf-8?B?bWF2cmlja18xMDE=?= | last post by:
Hi, I'm creating a ASP.net page to read different feeds. The reader works fine for RSS 1.0 and 2.0 feeds but breaks when I try to read some ATOM feeds.. for example... http://feeds.feedburner.com/TheGlobeAndMail-Business and I get the following error. Cannot add a column named 'link': a nested table with the same name already
0
10436
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9040
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.