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.
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>
An element name must begin with an alpha or '_', and may contain only
alphabetic characters (actually, most Unicode ones, including Chinese,
Arabic, etc.), numerals, '_', '-', or '.'. Technically, they can also
include ':', but that can cause conflicts and should be avoided.
The text inside an element can contain pretty-much all printing
characters, but '&' and '<' (and sometimes '>') must be escaped, like
this:
& = &
< = <
> = >
So in XML text, for "a < b && c > d", you'd have
a < b && c > d
It's a bit ugly, but it works.
Comments in XML start with <!-- and end with -->; they may not contain
the string "--" in-between.
You can attach variables, called 'attributes', to each element by
putting a name=value pair in the start tag, like this:
<a href="http://www.flightgear.org/">FlightGear</a>
The attribute name is "href" (follows the same rules as element
names), and the value is "http://www.flightgear.org/". The value must
always be quoted with "..." or '..', and in addition to the special
character escapes I mentioned above, you can also use the following:
' '
" "
To encode
He said "it's best to buy AT&T"
in an attribute value, you'd do something like
<quotation text="He said "it's best to buy AT&T""/>
or
<quotation text='He said "it's best to buy AT&T"'/>
How elements and attributes are interpreted is almost entirely up to
the application -- XML says how to encode data, but not what the data
means or how it should be processed. In the property manager, we've
decided to treat the XML document like a file system: the root element
("PropertyList") is the filesystem root, and everything else is a
subdirectory or a file (leaf data).
All the best,
David
--
David Megginson
[EMAIL PROTECTED]
_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel