elementtree Questions
3
Solved
I have been transforming some of my original xml.etree.ElementTree (ET) code to lxml.etree (lxmlET). Luckily there are a lot of similarities between the two. However, I did stumble upon some strang...
Shote asked 7/6, 2018 at 20:47
2
Solved
When it comes to generating XML data in Python, there are two libraries I often see recommended: lxml and ElementTree
From what I can tell, the two libraries are very similar to each other. They b...
Macaronic asked 10/11, 2017 at 18:48
2
Solved
If I have an xml file like this:
<root>
<item>
<prop>something</prop>
</item>
<test>
<prop>something</prop>
</test>
<test2>
<...
Brina asked 21/3, 2014 at 13:57
2
Solved
I successfully added a new node to an Element using PY's ElementTree.
I now try to give it attributes, which fails, despite I'm following the tutorial.
my example xml:
<?xml version="1.0" enco...
Nata asked 12/9, 2014 at 11:36
2
I need to convert an XML ElementTree to a String after altering it. It's the toString part that isn't working.
import xml.etree.ElementTree as ET
tree = ET.parse('my_file.xml')
root = tree.getroo...
Schreiner asked 19/11, 2015 at 21:22
5
Solved
I am new to element tree,here i am trying to find the number of elements in the element tree.
from lxml import etree
root = etree.parse(open("file.xml",'r'))
is there any way to find the total ...
Emmer asked 1/7, 2016 at 6:41
3
Solved
Given an XML like the following:
<root>
<element>A</element>
<element>B</element>
</root>
How can I match the element with content A using ElementTree and i...
Bend asked 31/5, 2012 at 15:4
5
Solved
My XML file looks like the following:
<?xml version="1.0"?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2008-08-19">
<Items>
<Item>
<...
Bickering asked 23/8, 2009 at 19:48
1
Solved
I use the xml library in Python3.5 for reading and writing an xml-file. I don't modify the file. Just open and write. But the library modifes the file.
Why is it modified?
How can I prevent this?...
Olney asked 31/8, 2017 at 22:8
8
I scrapped some html via xpath, that I then converted into an etree. Something similar to this:
<td> text1 <a> link </a> text2 </td>
but when I call element.text, I only...
Cliffcliffes asked 22/1, 2011 at 19:56
3
Solved
import os
import xml.etree.ElementTree as et
for ev, el in et.iterparse(os.sys.stdin):
el.clear()
Running the above on the ODP structure RDF dump results in always increasing memory. Why is tha...
Femi asked 9/4, 2012 at 13:49
1
I am experimenting with lxml and python for the first time for a personal project, and I am attempting to strip tags from a bit of source code using etree.strip_tags().
For some reason, I keep get...
Chamberlain asked 7/4, 2017 at 14:20
1
Solved
XML file:
<?xml version="1.0" encoding="iso-8859-1"?>
<rdf:RDF xmlns:cim="http://iec.ch/TC57/2008/CIM-schema-cim13#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cim:Te...
Gambetta asked 31/5, 2017 at 11:0
2
Solved
I am new to xml parsing. This xml file has the following tree:
FHRSEstablishment
|--> Header
| |--> ...
|--> EstablishmentCollection
| |--> EstablishmentDetail
| | |-->...
| |...
Hyposensitize asked 11/5, 2017 at 16:40
1
Solved
I have a XML file:
<sentence id="en_BlueRibbonSushi_478218345:2">
<text>It has great sushi and even better service.</text>
</sentence>
<sentence id="en_BlueRibbonSushi_...
Vapid asked 29/3, 2017 at 14:7
2
I use python 2.7 with the lib ElementTree.
I can't use lxml lib.
I need to get the namespaces in a string namespace_string. In order to fill my namespace dictionary.
my xml:
<?xml version="...
Blacktail asked 18/2, 2017 at 21:16
1
Solved
I am using python the third and the ElementTree API. I have some xml of the form:
<root>
<item>Over the <ref id="river" /> and through the <ref id="woods" />.</item>...
Tetanize asked 11/2, 2017 at 9:9
3
Solved
I've Element of etree having some attributes - how can we delete the attribute of perticular etree Element.
Risner asked 27/4, 2010 at 10:31
3
I'm using the xml.etree.ElementTree module to create an XML document with Python 3.1 from another structured document.
What ElementTree function can I use that returns the index of an existing sub ...
Quire asked 21/9, 2010 at 17:54
4
Solved
I am trying to replace the element inside of bbox with a new set of coordinates.
my code :
# import element tree
import xml.etree.ElementTree as ET
#import xml file
tree = ET.parse('C:/hig...
Chau asked 2/7, 2013 at 22:51
1
Solved
I have an XML file, foo.xml:
<foo>
<bar>
<baz phrase="hello"/>
</bar>
<quux phrase="goodbye"/>
</foo>
I'm parsing it with this Python code:
import lxml.e...
Academician asked 14/11, 2016 at 5:21
1
I am attempting to parse the below XML file but having difficulty getting a specific element value. I am trying to specify element 'Item_No_2' to get the related value <v>2222222222</v>...
Asparagus asked 23/8, 2016 at 3:24
2
Solved
Python's built-in xml.etree package supports parsing XML files with namespaces, but namespace prefixes get expanded to the full URI enclosed in brackets. So in the example file in the official docu...
Foudroyant asked 16/5, 2016 at 21:14
3
Solved
I need to write a dynamic function that finds elements on a subtree of an ATOM xml by building dynamically the XPath to the element.
To do so, I've written something like this:
tree = etree.pars...
Acroter asked 30/10, 2012 at 9:47
4
Solved
So I'm parsing some XML files using Python 3.2.1's cElementTree, and during the parsing I noticed that some of the tags were missing attribute information. I was wondering if there is any easy way ...
Ockeghem asked 4/8, 2011 at 22:29
© 2022 - 2024 — McMap. All rights reserved.