I'm new to mozilla app dev. I want to manipulate a rdf seq container through nsIRDFContainerUtils interface, I just asserted a statement and query for it, but the result is always "false". Could anyone show me some light on this problem? Thank you.
function test(){
var rdfService=Components.classes["@ mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var rdfCUtils=Components.classes["@ mozilla.org/rdf/container-utils;1"]
.getService()
.QueryInterface(Components.interfaces.nsIRDFContainerUtils);
var dataSource=rdfService.GetDataSource("chrome://encodinglock/content/encodingMapping.rdf");
var namespace="http://encodinglock.mozdev.com/el#";
var elements = dataSource.GetAllResources();
var container=null;
var node=null;
while (elements.hasMoreElements()) {
var seq = elements.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
if( rdfCUtils.IsSeq(dataSource, seq)) {
container=Components.classes['@mozilla.org/rdf/container;1'].createInstance()
.QueryInterface( Components.interfaces.nsIRDFContainer);
seq=rdfService.GetResource("el:mappinglist");
container.Init(dataSource,seq);
node = rdfService.GetAnonymousResource();
container.AppendElement(node);
}
}
dataSource.Assert(node, rdfService.GetResource(namespace+"urlpattern"),
rdfService.GetLiteral("http://testpattern"), true);
var asserted=dataSource.HasAssertion(node, rdfService.GetResource(namespace+"urlpattern"),
rdfService.GetLiteral("http://testpattern"), true);
alert(asserted);
}
_______________________________________________ Project_owners mailing list [email protected] http://mozdev.org/mailman/listinfo/project_owners
