How to retrieve data ?

KDO <[email protected]>
Newsgroups gmane.comp.mozilla.devel.rdf
Organization Nerim -- xDSL Internet Provider
Message-ID <[email protected]>
Hi all,

I have some trouble to retrieve data from an RDF file. The structure of my
RDF looks like this:

<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM "chrome://foxguardian/locale/foxguardian.dtd">
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:MYINFOS="http://www.myurl.com/rdf#">
	
<RDF:Seq RDF:about="http://www.myurl.com/myinfos">
	<RDF:li>
	<RDF:Description about="http://www.myurl.com/myinfos/ADMIN">
		<MYINFOS:name>ADMIN</MYINFOS:name>
		<MYINFOS:description>short description for admin</MYINFOS:description>
	</RDF:Description>
	</RDF:li>
	<RDF:li>
	<RDF:Description about="http://www.myurl.com/myinfos/USER">
		<MYINFOS:name>USER</MYINFOS:name>
		<MYINFOS:description>short description for user</MYINFOS:description>
	</RDF:Description>
	</RDF:li>
</RDF:Seq>
</RDF:RDF>

i have a JS function whith a string param which can be 'ADMIN' or 'USER'
and i want to retrieve the 'description' value.

My JS function looks like this :

function getDescription(usertype) {
  var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].
      getService(Components.interfaces.nsIRDFService);
 
  var infos =  rdfService.GetResource("http://www.myurl.com/myinfos/"+usertype);
 
  var desc = rdfService.GetResource("http://www.myurl.com/myinfos/description");
  
  var target = dsource.GetTarget(infos, desc, true);
 
  alert(target);
}
but target is always null. What's wrong ?

NB: dsource has been retrieve during onload event of my xul form


KDO
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.