elementtree Questions

2

Solved

I'm writing some XML with element tree. I'm giving the code an empty template file that starts with the XML declaration:<?xml version= "1.0"?> when ET has finished making its changes and wr...
Dunstan asked 27/9, 2012 at 1:6

2

Solved

When I try to read a text of a element who has a child, it gives None: See the xml (say test.xml): <?xml version="1.0"?> <data> <test><ref>MemoryRegion</ref> abcd&l...
Bearable asked 31/10, 2013 at 6:36

1

Solved

at the risk of getting yelled at for asking such a simple question, but I have been trawling the internet for answers and this particular case seems to be widely avoided and the docs are ambiguous:...
Longeron asked 23/10, 2013 at 6:24

1

Solved

I had to rewrite my python script from python 3 to python2 and after that I got problem parsing special characters with ElementTree. This is a piece of my xml: <account number="89890000" type=...
Kissel asked 14/10, 2013 at 19:17

3

Solved

I have an XML <root> element with several attributes. I've been using the ElementTree package. After I've parsed a tree from an xml file, I'm getting the document root, but I want to get the...
Halford asked 14/1, 2013 at 17:18

1

I need to change the value of an attribute named approved-by in an xml file from 'no' to 'yes'. Here is my xml file: <?xml version="1.0" encoding="UTF-8" ?> <!--Arbortext, Inc., 1988-2008...
Locoweed asked 29/7, 2013 at 10:48

2

i am very new to programming and python. I am trying to find and replace a text in an xml file. Here is my xml file <?xml version="1.0" encoding="UTF-8"?> <!--Arbortext, Inc., 1988-2008, ...
Gebler asked 29/7, 2013 at 8:30

2

Solved

I am trying to use xml.etree.ElementTree to write out xml files with Python. The issue is that they keep getting generated in a single line. I want to be able to easily reference them so if i...
Weixel asked 1/7, 2013 at 10:30

4

I'm trying to parse an XML document I retrieve from the web, but it crashes after parsing with this error: ': failed to load external entity "<?xml version="1.0" encoding="UTF-8"?> <?xml-...
Fink asked 4/5, 2012 at 23:57

2

I'm trying to parse XML string which I get from youtube video feeds, using Python 3.3.1. Here is the code: import re import sys import urllib.request import urllib.parse import xml.etree.ElementTr...
Diaphragm asked 7/5, 2013 at 12:58

2

Solved

I am having trouble using the attribute XPath Selector in ElementTree, which I should be able to do according to the Documentation Here's some sample code XML <root> <target name="1&...
Ruphina asked 21/10, 2008 at 15:52

4

Solved

I'm a programming novice and only rarely use python so please bear with me as I try to explain what I am trying to do :) I have the following XML: <?xml version = "1.0" encoding = "utf-8"?>...
Highchair asked 26/3, 2013 at 17:1

2

Solved

from lxml import etree root = etree.Element('root1') element = etree.SubElement(root, 'element1') root.write( 'xmltree.xml' ) Error: AttributeError: 'lxml.etree._Element' object has no ...
Culbreth asked 26/3, 2013 at 10:21

2

I need to parse a very large (~40GB) XML file, remove certain elements from it, and write the result to a new xml file. I've been trying to use iterparse from python's ElementTree, but I'm confused...
Lanti asked 14/3, 2013 at 2:4

4

Solved

Python has several ways to parse XML... I understand the very basics of parsing with SAX. It functions as a stream parser, with an event-driven API. I understand the DOM parser also. It reads the...
Rondelet asked 10/10, 2008 at 20:22

1

I've a xml file, and I'm trying to add additional element to it. the xml has the next structure : <root> <OldNode/> </root> What I'm looking for is : <root> <OldNod...
Heterogynous asked 21/1, 2013 at 14:7

1

Solved

I am trying to write a python script to standardise generic XML files, used to configure websites and website forms. However to do this I would like to either maintain the original attribute orderi...
Zeebrugge asked 10/1, 2013 at 12:28

4

Solved

My XML string is - xmlData = """<SMSResponse xmlns="http://example.com" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Cancelled>false</Cancelled> <MessageID>0000...
Cantara asked 4/1, 2013 at 9:0

1

I tried to register namespace with this: ET.register_namespace("inv", "http://www.stormware.cz/schema/version_2/invoice.xsd") but it doesn't work: Traceback (most recent call last): File "C:\...
Strati asked 2/1, 2013 at 15:10

2

Solved

I've read the remove example here and the example here is not applicable to me. My xml file reads: <A> <B>some text</B> <B>other text</B> <B>more text</B...
Bryna asked 27/12, 2012 at 8:9

1

Solved

I am getting a path separator error in python 2.6.1. I have not found this issue with python 2.7.2 version, but unfortunately I need this in 2.6.1 only. Is there any another way to achieve the same...
Borough asked 2/12, 2012 at 9:28

1

Solved

I have a dict that's feed with url response. Like: >>> d { 0: {'data': u'<p>found "\u62c9\u67cf \u591a\u516c \u56ed"</p>'} 1: {'data': u'<p>some other data</p>'} ....
Gastroenterostomy asked 21/11, 2012 at 12:38

2

Solved

I am new to python and would like to understand parsing xml. I have not been able to find any great examples or explanations of how to create a generic program to walk an XML nodeset. I want...
Jonathonjonati asked 20/11, 2012 at 2:36

1

A simplified version of my XML parsing function is here: import xml.etree.cElementTree as ET def analyze(xml): it = ET.iterparse(file(xml)) count = 0 for (ev, el) in it: count += 1 print('...
Sat asked 8/10, 2011 at 15:12

1

Solved

I need to write a dynamic function that finds elements on a subtree of an ATOM xml document. To do so, I've written something like this: tree = etree.parse(xmlFileUrl) e = etree.XPathEvaluator...
Dichogamy asked 26/10, 2012 at 17:36

© 2022 - 2024 — McMap. All rights reserved.