storing in-memory RDF

[email protected] Thu, 12 Jul 2007 10:08:18 +0200
Newsgroups gmane.comp.mozilla.devel.rdf
Message-ID <[email protected]>
hi,
i've found in mozilla XPFE toolkit (http://www.mozilla.org/xpfe/xulrdf.htm)
a few words about storing RDF to XUL
"[...]If the XUL stream came from a remote site, then RDF has no choice 
but to make a local annotation on the graph. If the XUL stream came from 
a local file, then RDF can either locally annotate the graph (just as 
before), or it can serialize the XUL and write over the original file 
(thus allowing local changes to a local file to be reflected right in 
the XUL).[...]".

Could You explain me how to get to RDF created by XUL file loaded to chrome.

this is my sample code. what's wrong

-- start here --
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="w1" align="start" 
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

     <script type="application/x-javascript">
<![CDATA[
     var file_to_save='d:\\test001.xul';

     function m1(event)
     {
         var file = 
Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
         file.initWithPath(plik_do_zapisu);
         if(!file.exists()) {
             file.create( 
Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 );
         }
         var output = 
Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance( 
Components.interfaces.nsIFileOutputStream );
         output.init( file, 0x04 | 0x08 | 0x20, 420, 0 );

         var 
RDF=Components.classes['@mozilla.org/rdf/rdf-service;1'].getService(Components.interfaces.nsIRDFService);

         serializer = '@mozilla.org/rdf/xml-serializer;1';
         s = 
Components.classes[serializer].createInstance(Components.interfaces.nsIRDFXMLSerializer);
         s.init(RDF);
 
s.QueryInterface(Components.interfaces.nsIRDFXMLSource).Serialize(output);

         output.close();
     }
]]>
</script>
     <button label="{button label}" onclick="m1(event);"/>
</window>

-- cut here --

thanks

	regards

		pawel