ho provato ad aggiungere questo, però ottengo un errore:
A script from "http://localhost" was denied UniversalXPConnect privileges
codice:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="example-window" title="Example 6.8.2"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"><![CDATA[
var tree;
var out;
var datasource;
var Observer = {
onBeginLoad: function(aSink) { out.label = 'Begin refresh';},
onInterrupt: function(aSink) { out.label = 'Refresh interrupted!';},
onResume: function(aSink) { out.label = 'Refresh resume!';},
onEndLoad: function(aSink) { tree.builder.rebuild(); out.label = 'Refresh done'; },
onError: function(aSink, aStatus, aErrorMsg) { alert('Error! ' + aErrorMsg); }
};
function reloadTree(treeId)
{
try {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var sink = datasource.QueryInterface(Components.interfaces.nsIRDFXMLSink);
sink.addXMLSinkObserver(Observer);
datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Refresh(false);
tree = document.getElementById(treeId);
}
catch(e) {
alert(e);
}
}
]]></script>
<button label="Refresh" oncommand="reloadTree('tree')" />
<tree id="tree" flex="1" width="200" height="200"
datasources="dati.rdf" ref="http://www.badessa.it/tutti-artisti">
<treecols>
<treecol id="aritsta" label="Artista" primary="true" flex="1"/>
<treecol id="durata" label="Durata" flex="1"/>
</treecols>
<template>
<rule>
<treechildren>
<treeitem uri="rdf:*">
<treerow>
<treecell label="rdf:http://www.badessa.it/rdf#artista"/>
<treecell label="rdf:http://www.badessa.it/rdf#durata"/>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
</tree>
<statusbar flex="1"><statusbarpanel flex="1" id="out" label=""/></statusbar>
</window>