David Lucena | 14 Sep 12:40 2008
Picon
Picon

PyXML and DOM example 'generate_xml1.py'

I've started to use PyXML because I needed a xml library for a tool I am making. Due to lack of documentation, I
have been looking for the examples, but I've found some of them does not work. In fact, the fist I tested was
the one on the Subject. I have made some modifications get it to work. Here I paste the full file contents:

"""
A basic example of using the DOM to create an XML document from scratch.
"""

from xml.dom import ext
from xml.dom import implementation

if __name__ == '__main__':

    #Create a doctype using document type name, sysid and pubid
    dt = implementation.createDocumentType('mydoc', '', '')

    #Create a document using document element namespace URI, doc element
    #name and doctype.  This automatically creates a document element
    #which is the single element child of the document
    doc = implementation.

( None, 'mydoc', dt)

    #Get the document element
    doc_elem = doc.documentElement

    #Create an element: the Document instanmce acts as a factory
    new_elem = doc.createElementNS( None, 'spam')

    #Create an attribute on the new element
(Continue reading)

Fredrik Lundh | 14 Sep 13:35 2008

Re: PyXML and DOM example 'generate_xml1.py'

David Lucena wrote:

> I've started to use PyXML because I needed a xml library for
 > a tool I am making.

if you're writing new code, I strongly suggest using a library based on 
the ElementTree API instead of struggling with an old, unmaintained and 
rather unwieldy XML library.

if I'm reading things correctly, your entire example boils down to

     import xml.etree.ElementTree as ET

     elem = ET.Element("spam", eggs="sunny side up")
     elem.text = "some text here..."

     print ET.tostring(elem)

with the ET API.

The standard implementation of ET is included in Python 2.5 and later:

    http://docs.python.org/dev/library/xml.etree.elementtree.html

and is available for Python 1.5.2 and newer from here:

    http://effbot.org/zone/element-index.htm

and there's also a separate implementation based on the libxml2 and 
libxslt libraries, which adds validation and lots of other goodies:
(Continue reading)

Natassa Gioti | 19 Sep 16:20 2008
Picon
Picon

Problem installing Pyxml


Hallo,
 I have Python 2.5 version on a MacOSX, and tried to install Pyxml:
python setup.py build

error: command 'gcc' failed with exit status 1

I previously had problems with other programs I tried to install, as if no
gcc compiler could be found, but do not know how to check that indeed ( I
used alternative programs previously).
Could you please help me with that? I am a newbie in such issues...
Thank you in advance,

Natassa Gioti
Research Associate - Bioinformatics
Institute of Healthy Ageing, and GEE
Room 324, The Darwin Building
University College London
Gower Street, London WC1E 6BT, UK.

_______________________________________________
XML-SIG maillist  -  XML-SIG <at> python.org
http://mail.python.org/mailman/listinfo/xml-sig

Stephane Bortzmeyer | 19 Sep 17:04 2008
Picon

Re: Problem installing Pyxml

On Fri, Sep 19, 2008 at 03:20:58PM +0100,
 Natassa Gioti <a.gioti <at> ucl.ac.uk> wrote 
 a message of 23 lines which said:

> I have Python 2.5 version on a MacOSX,

I do not know MacOSX (I use only free software) but isn't there a
packaging system with already-made Pyxml packages?

http://py-xml.darwinports.com/

Compiling by yourself (if you are not a developer) is quite 20th
century :-)

> I previously had problems with other programs I tried to install, as
> if no gcc compiler could be found, but do not know how to check that
> indeed

~ % cat > test.c
main () {}

~ % gcc test.c

~ % ./a.out 

_______________________________________________
XML-SIG maillist  -  XML-SIG <at> python.org
http://mail.python.org/mailman/listinfo/xml-sig

(Continue reading)

Jim Tittsler | 19 Sep 23:57 2008
Picon

Re: Problem installing Pyxml

On Sep 20, 2008, at 02:20, Natassa Gioti wrote:
> error: command 'gcc' failed with exit status 1
>
> I previously had problems with other programs I tried to install,  
> as if no
> gcc compiler could be found, but do not know how to check that  
> indeed ( I
> used alternative programs previously).

gcc is included in the Apple developer toolset known as Xcode.  Xcode  
is available as a free download from http://developer.apple.com/

--

-- 
Jim Tittsler     http://www.OnJapan.net/      GPG: 0x01159DB6
Python Starship  http://Starship.Python.net/crew/jwt/
Mailman IRC      irc://irc.freenode.net/#mailman

_______________________________________________
XML-SIG maillist  -  XML-SIG <at> python.org
http://mail.python.org/mailman/listinfo/xml-sig

Darren Hart | 21 Sep 20:57 2008

Choosing an XML method for a backing store

I'm writing a simple application that has a tree-like data structure.
I'd like to be able to eventually easily synchronize this data from
one client to another.  With that in mind, I have a few questions
regarding how I should best store my data and whether DOM or SAX is a
more appropriate choice.  I am new to XML and am trying to make sure
I'm headed in the right direction before I make any pervasive changes
to my application.  If I'm barking up the wrong tree, can someone
point me in the right direction?

Example data structure

list of type A
  type A
    data
  type A
    data

tree of types B,C,D,E
type B
  data
  list of type C
    type C
      data
      type B ref
      list of type D
        type D
          data
          type C ref
          list of type E
            data
(Continue reading)


Gmane