elementtree Questions

1

Solved

I am trying to convert my script (https://github.com/fletchermoore/n2c2) to use the default package xml.etree instead of lxml. This was an oversight on my part, but now I am realizing it would be i...
Subtangent asked 22/10, 2012 at 19:4

2

I'm using Python 3.2's xml.etree.ElementTree, and am attempting to generate XML like this: <XnaContent xmlns:data="Model.Data"> <Asset Type="data:MyData"> ... The format is out of ...
Fencesitter asked 20/10, 2012 at 11:21

1

How do you search for namespace-specific tags in XML using Elementtree in Python? I have an XML/RSS document like: <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:conten...
Dilorenzo asked 12/10, 2012 at 14:56

2

Solved

I have to handle xml documents that are big enough (up to 1GB) and parse them with python. I am using the iterparse() function (SAX style parsing). My concern is the following, imagine you have an ...
Britney asked 9/10, 2012 at 4:51

1

Solved

I'm using python to create an element in an xml document and then insert it as the FIRST CHILD of the document. So, if I were creating an elment named newChild I would want xml like this... <ro...
Numerable asked 5/10, 2012 at 22:32

4

Solved

I'm running Python 2.5.4 on Windows and I keep getting an error when trying to import the ElementTree or cElementTree modules. The code is very simple (I'm following a tutorial): import xml.etree....
Blearyeyed asked 18/6, 2010 at 20:57

1

Solved

I am experiencing some trouble using the Python 2.6.5 xml.etree.ElementTree library. In particular, if I setup a simple xml element like the following >>> import xml.etree.ElementTree as ...
Discomfit asked 26/7, 2012 at 12:10

2

Solved

Possible Duplicate: When using lxml, can the XML be rendered without namespace attributes? How can I strip the python attributes from an lxml.objectify.ObjectifiedElement? Example: ...
Diapause asked 26/5, 2011 at 15:56

3

Solved

I want to add doctypes to my XML documents that I'm generating with LXML's etree. However I cannot figure out how to add a doctype. Hardcoding and concating the string is not an option. I was e...
Unhandled asked 14/6, 2009 at 0:41

2

Solved

Is there a way to ignore the XML namespace in tage names in elementtree.ElementTree? I try to print all technicalContact tags: for item in root.getiterator(tag='{http://www.example.com}technicalC...
Puerilism asked 27/6, 2012 at 12:30

1

I need to check certain attributes for existence. Like: if "blah-blah-blah" is None: print "there is no such attribute" else: print "The attribute exists"
Baillargeon asked 21/6, 2012 at 15:25

2

Solved

Using the elementtree package in nodejs, I'm trying to verify the existence of a certain xml attribute in an xml file (specifically an android manifest file). var manifestTxt = fs.readFileSync('An...
Derivative asked 20/6, 2012 at 21:33

5

I'm trying to parse, manipulate, and output HTML using Python's ElementTree: import sys from cStringIO import StringIO from xml.etree import ElementTree as ET from htmlentitydefs import entitydefs...
Wellthoughtof asked 18/5, 2012 at 13:40

1

Solved

with this python 2.7.3 (or 2.7.0) code I want to change the value of the attribute "android:versionCode='2'", which has the namespace prefix "android": #!/usr/bin/python from xml.etree.ElementTree...
Merras asked 25/5, 2012 at 15:58

3

Solved

It's easy to completely remove a given element from an XML document with lxml's implementation of the ElementTree API, but I can't see an easy way of consistently replacing an element with some tex...
Kirkkirkcaldy asked 24/3, 2011 at 11:11

1

Solved

I would like to parse an HTML document using lxml. I am using python 3.2.3 and lxml 2.3.4 ( http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml ) I am using the etree.iterparse to parse the document, ...
Proximity asked 20/4, 2012 at 7:48

1

I am working with some XML data that, in some locations in each file, redefines the namespace. I'm trying to pull all tags of a specific type from the document regardless of the namespace that's ac...
Glabrescent asked 20/11, 2011 at 5:49

1

Solved

I'm trying to write an xml file with utf-8 encoded data using ElementTree like this: #!/usr/bin/python # -*- coding: utf-8 -*- import xml.etree.ElementTree as ET import codecs testtag = ET.Ele...
Forgotten asked 6/4, 2012 at 17:12

2

Solved

I have looked at the documentation here: http://docs.python.org/dev/library/xml.etree.elementtree.html#xml.etree.ElementTree.SubElement The parent and tag argument seems clear enough, but what fo...
Hardesty asked 2/4, 2012 at 6:1

1

Solved

Here is a part of XML: <item><img src="cat.jpg" /> Picture of a cat</item> Extracting the tag is easy. Just do: et = xml.etree.ElementTree.fromstring(our_xml_string) img = et....
Reachmedown asked 12/3, 2012 at 19:58

1

Solved

I'm trying to use Python 2.7's ElementTree library to parse an XML file, then replace specific element attributes with test data, then save this as a unique XML file. My idea for a solution was to...
Carrollcarronade asked 7/2, 2012 at 13:46

1

Solved

I am trying to write a small script for interacting with the last.fm API. I have a small bit of experience working with ElementTree, but the way I used it previously doesn't seem to be working, i...
Samons asked 2/2, 2012 at 12:13

3

The following test code reads a file, and using lxml.html generates the leaf nodes of the DOM/Graph for the page. However, I'm also trying to figure out how to get the input from a "string&quo...
Bluejacket asked 12/1, 2012 at 2:52

2

Solved

I have a string containing XML data that is returned from an http request. I am using ElementTree to parse the data, and I want to then search recursively for an element. According to this questi...
Deliver asked 20/12, 2011 at 18:33

1

Solved

I'm using xml in my postgresql database and I need a custom type could handle xml data in SQLAlchemy. So I made XMLType class communicating with xml.etree, but It doesn't work as I wished. here`s...
Fructidor asked 16/12, 2011 at 7:2

© 2022 - 2024 — McMap. All rights reserved.