Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Rebol & XML

From: AJMartin::orcon::net::nz at: 5-Aug-2003 22:04

Thanks, Bryan and Will! Bryan wrote:
> I've thought about doing the same, mainly cause I want to have xpath in
Rebol, and to do that I need a decent xml parser. I'm sure you're better qualified than me for doing it but if you need any help on the project I'd be glad to help. I've discovered that Gavin's parse-xml is based on SAX or the event model of processing XML. At the moment, my thoughts are going towards a DOM model, because Rebol is oriented that way, I feel, in reading and writing all of a file at once. The DOM model builds a tree in memory. I want to access the various values with path! values in Rebol. Here's a little XML (XMLSS from MS Excel 2002): XML: {<?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"> <Author>Andrew John Martin</Author> <LastAuthor>Andrew John Martin</LastAuthor> <Created>2003-08-05T02:10:56Z</Created> <LastSaved>2003-08-05T02:10:57Z</LastSaved> <Company>Colenso High School</Company> <Version>10.4219</Version> </DocumentProperties> <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"> <DownloadComponents/> <LocationOfComponents HRef="file:///\\"/> </OfficeDocumentSettings> </Workbook> } I'd like to processs the above and then access the author's name with Rebol script like: XML/Workbook/DocumentProperties/Author And set it with Rebol script like: XML/Workbook/DocumentProperties/Author: "Andrew Martin" Also we should think about several tags at the same level of nesting, like in table: row cell cell cell Unfortunately, there's a problem with accessing the attributes of a tag! For example, what's the path! value for accessing the value of the "xmlns" attribute in the "DocumentProperties" tag? XML/Workbook/DocumentProperties/________ Or perhaps I could use: XML/Workbook/DocumentProperties/_Attribute/xmlns Where "_Attribute" is the magic word for accessing attributes of a tag? What do people think? Is there a better or more simpler way that I've overlooked? Andrew J Martin ICQ: 26227169 http://www.rebol.it/Valley/ http://valley.orcon.net.nz/ http://Valley.150m.com/