XML Java API Standardization
Steven Ball
steve at cs.anu.edu.au
Mon Jun 23 01:56:53 BST 1997
> (I am not a Java person so I don't know the syntax for doing the following
> in Java...)
I'm no Java-phile either ;-)
> The idea is to
>
> 1) have a textual representation of an XML document as a Python program
> 2) be able to re-create textual representations of XML document structures
> as Python programs
I've done essentially the same thing for Tcl. My XML parser emits a
"Heirarchical Tcl List Representation" of an XML document. For example:
set doc {<?XML VERSION="1.0"?>
<!DOCTYPE MEMO SYSTEM "memo.dtd">
<MEMO REF="1234">
<TO>Audience</TO>
<FROM>Steve</FROM>
<MESSAGE>This is XML!</MESSAGE>
</MEMO>}
XML::parse $doc
returns ==>
parse:pi ?XML {VERSION 1.0} {}
parse:pi !DOCTYPE {SYSTEM memo.dtd} {}
parse:elem MEMO {REF 1234} {
parse:elem TO {} {
parse:text Audience {} {}
}
parse:elem FROM {} {
parse:text Steve {} {}
}
parse:elem MESSAGE {} {
parse:text {This is XML!} {} {}
}
}
(above has been edited slightly for email-readability)
This representation has two features: it can be easily manipulated
as a list, especially with the dummy arguments to parse:pi and parse:text,
and it can be passed to the `eval' command for execution - the element contents
are themselves scripts.
> 1) Such structures give an immediate API in the form of Lispy list
> processing stuff.
> 2) Such structures allow parsers to be compared / checked for correct
> interpretation of XML.
> 3) Such structures give developers something to aim at when developing XML
> markup aware tools.
Agreed, and the similarity of our (independent) approaches is noteworthy.
My only comment is that (2) is modulo list syntax.
Cheers,
Steve Ball
xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list