elementtree Questions
1
Solved
I am able to read the xml file in a using 'import xml.etree.ElementTree as et'. But my problem is to read the commented text given in the data file, how to read this:
For example in the below xml, ...
Outdistance asked 31/12, 2019 at 11:55
2
Solved
I'm trying to write an ElementTree object to disk. Everything works, except that the output file looks like this:
<html:html lang="en-US" xml:lang="en-US" xmlns:html="http://www.w3.org/1999/xht...
Chatman asked 22/5, 2011 at 14:51
1
Solved
I am creating a xml file. i am done with the root element creation and i am able to define xml declaration. But i need to create anther tag, which looks like
<?xml version="1.0" encoding="UTF-8...
Athelstan asked 31/10, 2019 at 11:20
5
Solved
Got a Problem with generating a .SVG File with Python3 and ElementTree.
from xml.etree import ElementTree as et
doc = et.Element('svg', width='480', height='360', version='1.1', xmlns='http://ww...
Bourassa asked 27/2, 2017 at 7:57
4
Solved
I'm having a problem outputting even the simplest Element(Tree) instances. If I try the following code in Python 2.7.1
>>> from xml.etree.ElementTree import Element, SubElement, tostring
...
Encephaloma asked 30/6, 2011 at 10:52
6
Solved
I need to write a parser in Python that can process some extremely large files ( > 2 GB ) on a computer without much memory (only 2 GB). I wanted to use iterparse in lxml to do it.
My file is of t...
Arielariela asked 24/8, 2011 at 6:7
1
Our project gets from upstream XML of this form:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&g...
Mickeymicki asked 18/7, 2016 at 14:10
2
Solved
As mentioned, I need to get the list of XML tags in file, using library xml.etree.ElementTree.
I am aware that there are properties and methods like ETVar.child, ETVar.getroot(), ETVar.tag, ETVar....
Milker asked 13/4, 2015 at 1:21
2
Solved
How would you get the source of an ElementTree as a string in Python?
Liberate asked 23/11, 2012 at 16:55
4
Solved
I have tried to use the answer in this question, but can't make it work: How to create "virtual root" with Python's ElementTree?
Here's my code:
import xml.etree.cElementTree as Ele...
Diarmuid asked 15/1, 2012 at 7:38
2
Solved
I am working with a huge xml-file and try to extract information from different elements.
import xml.etree.ElementTree as ET
tree = ET.parse('t.xml')
root = tree.getroot()
To find the elements I...
Inconsolable asked 16/6, 2014 at 8:29
1
I am trying to check whether an xml file contains the necessary xml declaration ("header"), let's say:
<?xml version="1.0" encoding="UTF-8"?>
...rest of xml file...
I am using xml Element...
Rotten asked 22/2, 2019 at 10:29
4
I need help adjusting my XML file with Python and the elementTree library.
For some background, I am not a student and work in industry. I hope to save myself a great deal of manual effort by makin...
Stableboy asked 20/5, 2016 at 0:1
1
Solved
Assume that I've the following XML which I want to modify using Python's ElementTree:
<root xmlns:prefix="URI">
<child company:name="***"/>
...
</root>
I'm...
Underplot asked 30/1, 2019 at 11:15
2
Solved
I just started learning Python and have to write a program, that parses xml files. I have to find a certain Tag called OrganisationReference in 2 different files and return it. In fact there are mu...
Faro asked 25/1, 2019 at 8:14
2
Solved
I'm trying to create an XML file so that it has the following skeleton, preferably using the xml.etree modules in Python 2.7:
<?xml version="1.0"?>
<foo xmlns:xsi="http://www.w3.org/2001/...
Motionless asked 13/6, 2013 at 10:0
1
I have a string variable contents with following value:
<ph type="0" x="1"></ph>
I try to write it to a XML element as follows:
elemen_ref.text = contents
After I write XML tree t...
Hamlet asked 9/12, 2018 at 11:40
1
I'm trying to make more dataset to train my model in Tensorflow for data augmantaion. I added the labels of boundary boxes to original image. I want to rotate image 45 degree and modify the xml fil...
Tso asked 1/10, 2018 at 16:7
3
Solved
With ElementTree in Python, how can I extract all the text from a node, stripping any tags in that element and keeping only the text?
For example, say I have the following:
<tag>
Some <...
Sanitarium asked 14/10, 2013 at 21:53
2
Solved
There are times that you want to parse some reasonably well-formed HTML pages, but you are reluctant to introduce extra library dependency such as BeautifulSoup or lxml. So you will probably like t...
Pontius asked 24/2, 2016 at 1:14
4
Solved
I'm trying to parse content in an OpenOffice ODS spreadsheet. The ods format is essentially just a zipfile with a number of documents. The content of the spreadsheet is stored in 'content.xml'.
i...
Pricking asked 18/11, 2010 at 1:7
5
Solved
I want to find a way to get all the sub-elements of an element tree like the way ElementTree.getchildren() does, since getchildren() is deprecated since Python version 2.7.
I don't want to use it a...
Mcmillen asked 2/5, 2012 at 6:43
3
Solved
I use ElementTree to parse/build a number of slightly complicated but well-defined xml files, and use mypy for static typing. I have .find statements strewn all over the place, which leads to thing...
Those asked 13/7, 2018 at 21:0
2
from xml.etree.ElementTree import ElementTree, Element, SubElement, dump
elem = Element('1')
sub = SubElement(elem, '2')
tree = ElementTree(elem)
dump(tree)
dump(elem)
In the code above, dumpin...
Circinate asked 12/6, 2015 at 22:38
3
Solved
In Python 2.6 using ElementTree, what's a good way to fetch the XML (as a string) inside a particular element, like what you can do in HTML and javascript with innerHTML?
Here's a simplified samp...
Pharmacology asked 9/8, 2010 at 20:18
© 2022 - 2024 — McMap. All rights reserved.