Re: XML

Discussion in 'Python' started by Paul Boddie, Jun 24, 2003.

  1. Paul Boddie

    Paul Boddie Guest

    Roman Suzi <> wrote in message news:<>...
    >
    > OK. When I was talking about plain text, I had in mind that it
    > has some proprietary format. For example, I can easily write:
    >
    > ------------------
    > foo = "123"
    > bar = "456"
    > zoo = "la\"lala"
    > ------------------
    >
    > And it's not very hard to parse that.


    Well, you can just write that in a module and have Python import it.
    ;-) And I don't see anything wrong with that, actually. In various
    situations, particularly the oft-quoted configuration file example,
    this is a lot more interesting than XML, for Python applications at
    least.

    > In case of XML I will need something like
    >
    > <?xml version="1.0"?>
    > <foo>123</foo><bar>456</bar><zoo>la&quot;lala</zoo>
    >
    > - not a big deal, but it's harder to parse. And also XML software keeps
    > changing (or so it seems), and this gives a sense of instability.


    How hard is it to call a parse function on some XML module? (Bearing
    in mind that your example isn't a well-formed XML document since it
    doesn't have a single root element, even though I do like using "zoo"
    elements in examples myself. :) )

    > XML always gives me a feeling that I do not fully master it (especially it's
    > DTD part)! And this is after two years of trying to understand it. (Cf: with
    > Python felt at home after a week or two!)


    It can often be a question of ambition, since I can imagine that many
    people don't really use DTDs or XML Schemas to get their work done. In
    any case, it isn't clear what the corresponding technology to DTD is
    in the Python environment - optional, but not yet invented, static
    type annotations?

    > P.S. Just look at the neighboor thread:
    > Subject: minidom toxml() not emitting attribute namespace qualifier
    >
    > > Using Python 2.2.3, with this example code:

    >
    > [Code elided]
    >
    > > The output is missing the "myns" namespace qualifier on the "att"
    > > attribute. Can someone tell me what I'm doing wrong?


    Could be that if one is calling setAttributeNS on an element, one has
    to specify the prefix as part of the name parameter - that isn't
    obvious and I made that mistake before I became more acquainted with
    the API.

    > That's a bug in minidom.
    >
    > I reported it back in November 2002, but I wasn't precise enough about version
    > numbers, so it went unaddressed.


    Well, I was convinced about the bug status until I looked deeper and
    realised that I was doing stuff wrong. Perhaps it's a documentation
    issue, and perhaps the maintainers of PyXML really have a lot of work
    to do, and perhaps it isn't easy to maintain various standard API
    implementations (as Andrew Kuchling suggests), but I do believe that
    the various XML technologies available for Python are very useful
    things to be familiar with, despite what people may claim.

    It may be the case that you don't see a need for XML in your work. In
    my opinion it's completely acceptable to not use XML if you find it
    completely irrelevant, unfathomable or opaque, but I respect your
    desire to become aware of what the technology can offer. I'm reminded
    of the occasional article written by people who ask others to
    "convince me why I should run Linux" - the only useful response is
    that if one can't see a need to try it without writing a public
    document asking others to persuade them, then they probably shouldn't
    be spending too much time worrying about it.

    Paul
    Paul Boddie, Jun 24, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bomb Diggy
    Replies:
    0
    Views:
    431
    Bomb Diggy
    Jul 28, 2004
  2. Tony Prichard
    Replies:
    0
    Views:
    715
    Tony Prichard
    Dec 12, 2003
  3. Mark Van Orman

    embedding xml in xml as non-xml :)

    Mark Van Orman, Sep 14, 2004, in forum: XML
    Replies:
    5
    Views:
    464
    Patrick TJ McPhee
    Sep 15, 2004
  4. Andy
    Replies:
    0
    Views:
    525
  5. Erik Wasser
    Replies:
    5
    Views:
    430
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page