2009-01-04 11 views

Respuesta

4

AFAIK Google App Engine proporciona un entorno de Python bastante completo para su uso. Dado que Python viene con "baterías incluidas" es posible que desee evaluar las diferentes API que Python le ofrece: http://docs.python.org/library/markup.html

8

Eche un vistazo a existing answers on XML and Python.

Algo como esto podría funcionar:

from cStringIO import StringIO 
from xml.etree import cElementTree as etree 

xml = "<a>aaa<b>bbb</b></a>" 

for event, elem in etree.iterparse(StringIO(xml)): 
    print elem.text 

Imprime:

bbb 
aaa 
20

Desde que se hizo la pregunta, Google ha whitelisted pyexpat, que incluye minidom, por lo que puede utilizar el siguiente código sin tener que cargar cualquier biblioteca:

from xml.dom import minidom 

dom = minidom.parseString('<eg>example text</eg>') 

Más información: http://docs.python.org/library/xml.dom.minidom.html

Cuestiones relacionadas