[REBOL] Re: XML-Parsing?!?
From: brett:codeconscious at: 26-Oct-2000 1:50
Just to add to Joel's comprehensive description.
You can also you the parse function to deal with the structure returned by
the parse-xml function.
Here an example which Martin Johannesson described some time back.
Just copy and paste this into a Rebol console session.
xml-structure: ['document none! xml-element-contents]
xml-element-node: [into [xml-element-name xml-element-attributes
xml-element-contents]]
xml-element-name: [set elt-name string! (print elt-name)]
xml-element-attributes: [none! | block!]
xml-element-contents: [none! | into [some [xml-element-node |
string! ]]]
xml-target: http://p.moreover.com/cgi-local/page?index_devoper+xml
parse parse-xml read xml-target xml-structure
I put in a bit of code into xml-element-name in order to print the element
names as they occur.
You could go on to adjust the parse rule for a specific dtd. Which is what I
did for moreover.com.
It would be nice if some wrote a DTD to parse-rule translator :)
Brett.