Re: Some Issues while testing
Martin Klang <[email protected]> Thu, 17 Jul 2003 23:05:33 +0000 (GMT)
| Newsgroups | gmane.text.xml.o-xml |
|---|---|
| Message-ID | <[email protected]> |
> 5. Reading/Writing files
>
> I really need to just manipulate an xml file on disk by updating the
> lastupdate node and adding a new blog entry. How can I do this? I would
> expect to be able to do something like:
>
> - Open a file and assign a pointer to it to a variable
> - Update the contents of the variable
> - Save and close the file
Have a look at the vendue lib directory:
http://cvs.pingdynasty.com/viewcvs/vendue/site/lib/
if you copy the file io.lib, you get a very useful File type.
for example you can do, to read, update and save an xml file:
<o:set file="io:File('filename.xml')"/>
<!-- parse -->
<o:set content="$file.parse()"/>
<!-- do some changes -->
<o:for-each select="$content//text()">
<o:do select="current().replace(current().upper())"/>
</o:for-each>
<!-- save -->
<o:do select="$file.serialize($content)"/>
note: you need to have Java Extensions enabled
a more complete io library is coming!
regards,
/m