elementtree Questions

2

Solved

I've been using the lxml "E-Factory" (aka. ElementMaker) for creating xml documents. I'm trying to generate an xml document similar to this: <url> <date-added>2011-11-11</date-add...
Flatworm asked 9/11, 2011 at 6:37

2

Solved

I've been using minidom to parse XML for years. Now I've suddenly learned about Element Tree. My question which is better for parsing? That is: Which is faster? Which uses less memory? Do e...
Liquidate asked 5/11, 2011 at 18:56

2

Solved

I have this code with ElementTree that works well with Python 2.7. I needed to get all the nodes with the name "A" under "X/Y" node. from xml.etree.ElementTree import ElementTree verboseNode = t...
Jasisa asked 30/9, 2011 at 22:45

2

Solved

My question follows on from another stackoverflow question:- "How to get the root node of an xml file in Python?" from xml.etree import ElementTree as ET path = 'C:\cool.xml' et = ET.parse ( path ...
Baseless asked 19/9, 2011 at 0:43

1

Solved

I'm trying to create an in-memory xml document such that the root's child nodes all require a name space. The final document should look something like this: <Feed> <FeedEntity Id="0000...
Testimony asked 5/9, 2011 at 20:14

2

Solved

I am trying to open a directory that contains a series of XML's in one specific directory. In the following code, I am iterating through each XML document, and I'm setting some "if statements" to r...
Sanguine asked 20/7, 2011 at 22:13

2

Solved

since I had this annoying issue for the 2nd time, I thought that asking would help. Sometimes I have to get Elements from XML documents, but the ways to do this are awkward. I’d like to know a py...
Nourish asked 6/4, 2011 at 19:57

1

Solved

I'm getting this error in ElementTree when I try to run the code below: SyntaxError: cannot use absolute path on element My XML document looks like this: <Scripts> <Script> <St...
Absinthe asked 31/3, 2011 at 14:2

1

Solved

I have tho following code fragment: from xml.etree.ElementTree import fromstring,tostring mathml = fromstring(input) for elem in mathml.getiterator(): elem.tag = 'm:' + elem.tag return tostri...
House asked 23/3, 2011 at 17:21

1

Solved

I'm trying to use lxml.etree to parse a Wordpress export document (it's XML, somewhat RSS like). I'm only interested in published posts, so I'm using the following to loop through published posts: ...
Spectra asked 27/2, 2011 at 17:25

2

Solved

I am trying to emit an XML file with element-tree that contains an XML declaration and namespaces. Here is my sample code: from xml.etree import ElementTree as ET ET.register_namespace('com',"http...
Perihelion asked 14/2, 2011 at 22:8

1

I'm trying open and parse some html. So far, it was ok, I'm able to open the source and print it for example. But when it comes to parsing I'm stuck with "ElementTree instance has no attribute 'fro...
Adena asked 3/2, 2011 at 16:8

2

Solved

I want to retrieve a legacy xml file, manipulate and save it. Here is my code: from xml.etree import cElementTree as ET NS = "{http://www.somedomain.com/XI/Traffic/10}" def fix_xml(filename): f...
Reuben asked 3/2, 2011 at 12:33

2

Solved

I have the following XML. <?xml version="1.0" encoding="UTF-8"?> <testsuites tests="10" failures="0" disabled="0" errors="0" time="0.001" name="AllTests"> <testsuite name="TestOne"...
Digraph asked 26/1, 2011 at 19:2

3

Solved

Im trying to extract only the first hit from an NCBI xml BLAST file. next I would like to get only the first HSP. at the final stage I would like to get these based on best score. to make things cl...
Freezedry asked 20/12, 2009 at 9:44

2

Solved

I need to traverse the XML tree to add sub element when the value is less than 5. For example, this XML can be modified into <?xml version="1.0" encoding="UTF-8"?> <A value="45"> &lt...
Waltman asked 25/1, 2011 at 0:1

2

Solved

I'm given a XML file as follows. <?xml version="1.0" encoding="UTF-8"?> <A value="?"> <B value="?"> <C value="10"/> <C value ="20"/> </B> <B value="?"&g...
Iatry asked 24/1, 2011 at 23:54

2

Solved

I have a large number of .xml files (about 70) and i need to extract some co-ordinates from them. Apparently the best way to do this is to parse the xml file using element tree. I am new to python...
Cannon asked 18/1, 2011 at 10:6

2

Solved

For this following xml, how do I fetch the xml and then parse it to get out the value for <age>? <boardgames> <boardgame objectid="13"> <yearpublished>1995</yearpublis...
Grim asked 29/12, 2010 at 18:53

1

Solved

I'm using ElementTree to generate some HTML, but I've run into the problem that ElementTree doesn't store text as a Node, but as the text and tail properties of Element. This is a problem if I want...
Rheotropism asked 29/6, 2010 at 21:47

3

Solved

>>> import gdata.books.service >>> service = gdata.books.service.BookService() >>> results = service.search_by_keyword(isbn='0434003484') Traceback (most recent call last...
Couchant asked 28/5, 2010 at 0:38

2

Solved

I have written a small function, which uses ElementTree and xpath to extract the text contents of certain elements in an xml file: #!/usr/bin/env python2.5 import doctest from xml.etree import El...
Preconscious asked 14/6, 2010 at 16:9

1

Solved

I have a following xml document: <node0> <node1> <node2 a1="x1"> ... </node2> <node2 a1="x2"> ... </node2> <node2 a1="x1"> ... </node2> </no...
Unqualified asked 19/5, 2010 at 21:30

2

Solved

I am trying to use Python's ElementTree to generate an XHTML file. However, the ElementTree.Element() just lets me create a single tag (e.g., HTML). I need to create some sort of a virtual root or...
Unamerican asked 1/7, 2009 at 19:2

2

Solved

I'm having a hard time finding a good, basic example of how to parse XML in python using Element Tree. From what I can find, this appears to be the easiest library to use for parsing XML. Here is a...
Calumnious asked 23/11, 2009 at 22:24

© 2022 - 2024 — McMap. All rights reserved.