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

[REBOL] parse-xml cannot be reversed

From: bhandley:zip:au at: 30-Jul-2000 1:56

I attempted to write a function that would take the structure that parse-xml generates and export it back into a valid xml file. But, I found that it cannot be reliably done. Here's an example.
>> parse-xml {<a>teststring<b/><c/></a>}
== [document none [["a" none ["teststring" ["b" none none] ["c" none none]]]]] Just looking at the structure would lead you (or your program) to conclude that "b" was an attribute of an element "teststring", until you realise that attribute lists should not have an odd number of elements. Maybe parse-xml should be creating a normal three element block for #PCDATA but use none for the first two elements. I haven't used this much so I would like to know if there are any comments or objections to this conclusion. Brett.