Reading data from firefox install.rdf with Javascript
"programmer" <[email protected]> Sun, 03 Apr 2005 10:13:55 GMT
| Newsgroups | gmane.comp.mozilla.devel.rdf |
|---|---|
| Organization | TIN |
| Message-ID | <[email protected]> |
I'm very new to RDF and I don't understand how I can determine the value (called literal??) associated
to an attribute.
Suppose I have this RDF
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{11111111-2222-3333-4444-555555555555}</em:id>
<em:name>Extension name</em:name>
...
...
...
<em:homepageURL>http://asimpleurl.com</em:homepageURL>
How can I obtain the value http://asimpleurl.com??
I tried code similar to this below but doesn't work.
var rdfs = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var ds = rdfs.GetDataSourceBlocking("file:///tmp/install.rdf");
var extension = rdfs.GetResource("11111111-2222-3333-4444-555555555555");
var homepageArc = rdfs.GetResource("http://www.mozilla.org/2004/em-rdf#homepageURL");
var homepage = ds.GetTarget(extension, homepageArc, true);
may use help me to understand how to handle RDFs?
many thanks,
davide