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

Read RDF ?

Hello,

I can easily read an RSS sheet, but I am not able able
to read a RDF sheet. Each time I try to read it returns me
0 nodes. Here is how I try it.

Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs)
ReadRDF("http://www.xsltblog.com/index.rdf")
End Sub

Private function ReadRDF(byval strRDF as string)
Dim reader as new XmlTextReader(strRDF)
Dim xmlDoc as new XmlDocument

Dim nsmRequest as New XmlNamespaceManager
(xmlDoc.NameTable)
nsmRequest.AddNamespace
("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-
ns#")
Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("//xmlns:rdf/rdf", nsmRequest)
response.write(nodes.Count.ToString())
end function

Can somebody tell me what I do wrong?
Nov 12 '05 #1
4 3175
If that's the code you're using you need to associate the reader with
the doc :-) i.e. using "xmlDoc.Load(reader)"

// pt

Nov 12 '05 #2
Vishal wrote:
Private function ReadRDF(byval strRDF as string)

Dim reader as new XmlTextReader(strRDF)
Dim xmlDoc as new XmlDocument

Dim nsmRequest as New XmlNamespaceManager
(xmlDoc.NameTable)
nsmRequest.AddNamespace
("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-
ns#")
Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("//xmlns:rdf/rdf", nsmRequest)
response.write(nodes.Count.ToString())
end function

Can somebody tell me what I do wrong?


Where is the Load() call? And //xmlns:rdf/rdf is weird. Most likely you
meant //rdf:rdf

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Nov 12 '05 #3
Oleg,

I forgot Load in this post, but I had it in my code. The
rdf:rdf you suggested doesnt work either. I get the error:

Prefix 'rdf' is not defined.

My code again:

Private function ReadRDF(byval strRDF as string)
Dim reader as new XmlTextReader(strRDF)
Dim xmlDoc as new XmlDocument
xmlDoc.Load(strRDF)

Dim nsmRequest as New XmlNamespaceManager
(xmlDoc.NameTable)
nsmRequest.AddNamespace
("rdf:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("//rdf:rdf", nsmRequest)

response.write(nodes.Count.ToString())
end function

Thanks

-----Original Message-----
Vishal wrote:
> Private function ReadRDF(byval strRDF as string) Dim reader as new XmlTextReader(strRDF)
Dim xmlDoc as new XmlDocument

Dim nsmRequest as New XmlNamespaceManager
(xmlDoc.NameTable)
nsmRequest.AddNamespace
("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-
ns#")
Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("//xmlns:rdf/rdf", nsmRequest)
response.write(nodes.Count.ToString())
end function

Can somebody tell me what I do wrong?


Where is the Load() call? And //xmlns:rdf/rdf is weird.

Most likely youmeant //rdf:rdf

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
.

Nov 12 '05 #4
Try this:

Dim nsmRequest as New XmlNamespaceManager(xmlDoc.NameTable)
nsmRequest.AddNamespace
("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
nsmRequest.AddNamespace
("rss", "http://purl.org/rss/1.0/")

Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("/rdf:RDF//rss:item/rss:title", nsmRequest)
Sonu
-----Original Message-----
Oleg,

I forgot Load in this post, but I had it in my code. Therdf:rdf you suggested doesnt work either. I get the error:

Prefix 'rdf' is not defined.

My code again:

Private function ReadRDF(byval strRDF as string)
Dim reader as new XmlTextReader(strRDF)
Dim xmlDoc as new XmlDocument
xmlDoc.Load(strRDF)

Dim nsmRequest as New XmlNamespaceManager
(xmlDoc.NameTable)
nsmRequest.AddNamespace
("rdf:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("//rdf:rdf", nsmRequest)

response.write(nodes.Count.ToString())
end function

Thanks

-----Original Message-----
Vishal wrote:
> Private function ReadRDF(byval strRDF as string)
Dim reader as new XmlTextReader(strRDF)
Dim xmlDoc as new XmlDocument

Dim nsmRequest as New XmlNamespaceManager
(xmlDoc.NameTable)
nsmRequest.AddNamespace
("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-
ns#")
Dim nodes as XmlNodeList = xmlDoc.SelectNodes
("//xmlns:rdf/rdf", nsmRequest)
response.write(nodes.Count.ToString())
end function

Can somebody tell me what I do wrong?


Where is the Load() call? And //xmlns:rdf/rdf is weird.

Most likely you
meant //rdf:rdf

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
.

.

Nov 12 '05 #5

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

Similar topics

2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
2
by: Sandman | last post by:
Just looking for suggestion on how to do this in my Web application. The goal is to keep track of what a user has and hasn't read and present him or her with new material I am currently doing...
4
by: Ollie Cook | last post by:
Hi, I am having some difficulty with read(2) and interrupting signals. I expect I am misunderstanding how the two work together, so would appreciate some guidance. I am trying to 'time out' a...
6
by: BBM | last post by:
I have an object that has a fairly complex construction sequence, so I have written a dedicated "factory" class that invokes the constructor of my object class (which does nothing but instantiate...
8
by: a | last post by:
I have a struct to write to a file struct _structA{ long x; int y; float z; } struct _structA A; //file open write(fd,A,sizeof(_structA)); //file close
1
by: Jose Reckoner | last post by:
I'm running python 2.3 on Windows XP. Anyone have a quick small script to convert .DT1 and .DEM data to ASCII or some other format? I don't need a viewer. Thanks!
0
by: phplasma | last post by:
Hey, I am currently attempting to implement a multi-threaded C# socket, using SSL (.pem file/certification/private key combo) server using Visual Studio C# Express. I have successfully made...
6
by: arnuld | last post by:
This works fine, I welcome any views/advices/coding-practices :) /* C++ Primer - 4/e * * Exercise 8.9 * STATEMENT: * write a program to store each line from a file into a *...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.