On Sunday, March 10, 2002, at 07:02 PM, David Megginson wrote:

Jonathan Polley writes:

I have some experience with Tkinter. but my GUIs tend to be a bit
"functional" (OK, ugly), and I will be learning XML at the same
time. Any, and all, help will be greatly appreciated.

If you know LISP (CommonLISP, InterLISP, Scheme, E-LISP, or what-have
you), you're most of the way there.


Now I am going to have nightmares ). LISP and I were not the best of friends in college (things like caadaddaddr gives me chills).

Think of an XML document as a single toplevel LISP list containing any
number of nested sublists. The top-level list and every sublist are
called 'elements' in XML, and each starts with <NAME> and ends with
</NAME>, where NAME represents the name of the element. So, what you
might represent in LISP as

('person ('name "David Megginson") ('citizenship "Canadian"))

you can represent in XML as

<person>
<name>David Megginson</name>
<citizenship>Canadian</citizenship>
</person>


I believe that python maps dictionaries to XML. The above would be something like:

Someone = {'person': {'name': 'David Megginson',
'citizenship': 'Canadian'}
}

print Someone['person']['name'] would yield
'David Megginson'

Since python has a nice mapping between class membership and dictionaries, it may be cleaner than that.


Jonathan Polley

Reply via email to