[Project_owners] Persisting some data

Bradley Rintoul brintoul at sbcglobal.net
Tue Mar 8 22:58:36 EST 2005


Eric Jung wrote:

>The are code samples, as well as JS classes for file IO at:
>
>http://kb.mozillazine.org/Dev_:_Extensions_:_Example_Code_:_File_IO
>
>You might also be interested in saving the strings as user
>preferences. In that case, check out:
>
>http://kb.mozillazine.org/Dev_:_Using_preferences
>
>--- Christopher Ottley <xknight at users.sourceforge.net> wrote:
>  
>
>>Bradley Rintoul wrote:
>>
>>    
>>
>>>I would like to persist a simple array of strings to use between 
>>>invocations of the browser.  I would like to save this
>>>      
>>>
>>information 
>>    
>>
>>>locally - is RDF my only option?
>>>      
>>>
>>No. Have a look at the components    @mozilla.org/file/local;1    
>>@mozilla.org/network/file-output-stream;1    
>>@mozilla.org/network/file-input-stream;1    and 
>>@mozilla.org/scriptableinputstream;1
>>
>>These will let you read and write any data you want to a local
>>file. 
>>Once you know where you want to store it and how to parse the
>>stored 
>>file, you should have your alternative.
>>
>>Regards,
>>Christopher.
>>_______________________________________________
>>Project_owners mailing list
>>Project_owners at mozdev.org
>>http://mozdev.org/mailman/listinfo/project_owners
>>
>>    
>>
>
>
>	
>		
>__________________________________ 
>Celebrate Yahoo!'s 10th Birthday! 
>Yahoo! Netrospective: 100 Moments of the Web 
>http://birthday.yahoo.com/netrospective/
>_______________________________________________
>Project_owners mailing list
>Project_owners at mozdev.org
>http://mozdev.org/mailman/listinfo/project_owners
>
>  
>
Thanks for the help.  I've got the file saved and reloaded as XML now 
and I can getElementsByTagName.

Now I have, say, 300 nodes with an "href" attribute set to a URI.  Given 
a URI, how can I best tell if one of my nodes has an href that matches 
it?  I'm pretty sure going one-by-one and doing a comparison is not the 
best way...  what is a better way?  Is there some sort of XPath 
expression that I can use...how?

Thanks again,

B. Rintoul



More information about the Project_owners mailing list