XML

Sean Ross sross at connectmail.carleton.ca
Fri Jun 20 22:02:53 CEST 2003


"Roman Suzi" <rnd at onego.ru> wrote in message
news:mailman.1056133597.28230.python-list at python.org...
> I am trying to find use of XML in my doings for 2 years already and every
time
> I find XML not appropriate for the task. XML is human readable but I think
it
> is still hard to edit XML files by hand. This is not the problem with
> machine-generated/read data but other, adhoc formats (like plain Python)
are
> even less problem. What is the niche of XML? I do not believe it makes
> interapplication communication more robast (I think it's of the same
quality
> as OOP helping code reuse). Dealing with XML requires more effort than
dealing
> with ASCII texts by grep or re.search().

Well, recently I did a honour's project where I designed and implemented a
little language for describing circuits. The language was something like a
cross between Applescript and Python. When the program was translated, it
generated an XML application that described the circuitry with all of its
components and connections spelled out. My "compiler" was written in Python
(using SPARK). Another student, working under the same supervisor as myself,
implemented a program to display the circuitry, and lay it out in a
satisfactory manner. His program was written in Java. We chose to use XML
for describing the circuitry for precisely this reason: although the work of
finding the connections and describing the circuits was done using my
program written in Python, the results of that effort could then be used by
anyone else using whichever language they liked to display those results in
a pleasing manner. Because, although you *could* actually assemble the
circuitry by following the XML, it was much easier to do so by following a
diagram.

Take from this anecdote what you will - for me, the point is this: making
the output of my program use XML allowed another programmer, unfamiliar with
Python, to access and use my data in an unsuperficial manner. There may have
been other ways to have done this (for instance, in this case, I could have
used Jython and ported SPARK), but this way worked for me.

As an aside - Funnily enough, I did this project while completely unaware of
the existence of Verilog and VHDL. If I were to do it over again, I would
probably have made a translator for one of those langauges, instead of
making my own. Or, failing that, designed mine better, as there were several
issues I missed that seeing these languages made me aware of. Making a
translator for one of the existing languages would have been better, as my
program would've served an existing target community. Ah well...









More information about the Python-list mailing list