I have an application that adds data to the 'rdf:localstore'.  When I add an
entry it looks something like this:

<RDF:Seq about="http://mozilla.org/package/jgillick/switchproxy/rdf/all";>
    <RDF:li
resource="http://mozilla.org/package/jgillick/switchproxy/rdf/all/test"/>
</RDF:Seq>
<RDF:Description
about="http://mozilla.org/package/jgillick/switchproxy/rdf/all/test";
                   NS4:name="test"

NS4:id="http://mozilla.org/package/jgillick/switchproxy/rdf/all/test";
                   NS4:proxy="test" />

When I try to remove
http://mozilla.org/package/jgillick/switchproxy/rdf/all/test, it only remove
the <RDF:LI> tag in the Seq block, but leaves the <RDF:Description> tag.
This causes problems when somebody tries to add an item later with the same
name, which coorisponds to the about attribute.  I need to be able to remove
the LI reference and the actual data.

The code I'm currently using to remove the item is below:

-----------------------------------------
const gRdfDataSouce = "rdf:localstore";
const gRdfRoot = "http://mozilla.org/package/jgillick/switchproxy/rdf/all";;

var oItem = document.getElementById('proxy-list').selectedItem;
var oRdf =
Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.i
nterfaces.nsIRDFService);
var oRdfC =
Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components
.interfaces.nsIRDFContainer);
var oDs = oRdf.GetDataSource(gRdfDataSouce);
var oRoot = oRdf.GetResource(gRdfRoot);
var oProxy = oRdf.GetResource(oItem.id);

oRdfC.Init(oDs, oRoot);

//Remove
oRdfC.RemoveElement(oProxy, true);
-----------------------------------------

In this example, oItem.id equals
"http://mozilla.org/package/jgillick/switchproxy/rdf/all/test";

Thanks,
Jeremy


_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to