elementtree Questions

1

Solved

I am a python newbie. I am trying to parse through an xml file and count all text inputs that are all numeric including approximated values using e- or e+. E.g. Given the psuedo code below (jerry.x...
Methacrylate asked 17/2, 2015 at 18:44

1

Currently using Python 2.4.3, and not allowed to upgrade I want to change the values of a given attribute in one or more tags, together with XML-comments in the updated file. I have managed to cr...
Jeroboam asked 17/12, 2010 at 21:7

4

Solved

In python 2.7 (with etree 1.3), I can suppress the XML prefixes on elements like this: Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 233...
Contraoctave asked 13/11, 2011 at 17:24

2

Solved

I'm trying to parse the following feed into ElementTree in python: "http://smarkets.s3.amazonaws.com/oddsfeed.xml" (warning large file) Here is what I have tried so far: feed = urllib.urlopen("ht...
Derbyshire asked 18/10, 2014 at 0:0

1

Solved

I created an xml tree with something like this top = Element('top') child = SubElement(top, 'child') child.text = 'some text' how do I dump it into an XML file? I tried top.write(filename), but ...
Madalynmadam asked 15/9, 2014 at 20:56

1

Solved

I want to add a subelement to an xml file, but in a very specific position, not appended to the end. The standard way is: subi = ET.SubElement(root[0][0], 'subi') which is fine. but: Let's sa...
Interflow asked 13/9, 2014 at 15:51

1

Solved

I'm currently writing a script to convert a bunch of XML files from various encodings to a unified UTF-8. I first try determining the encoding using LXML: def get_source_encoding(self): tree = e...
Ria asked 12/9, 2014 at 0:24

1

Solved

I must be missing something. I'm attempting to set up a google product feed, but am having a hard time registering the namespace. Example: Directions here: https://support.google.com/merchants/...
Luann asked 10/8, 2014 at 5:47

2

Solved

I have the following xml file <?xml version="1.0"?> <data> <country name="Liechtenstein"> <rank updated="yes">2</rank> <year>2008</year> <gdppc&gt...
Wilhoit asked 4/8, 2014 at 2:55

1

Solved

This is follow on question for Modify a XML using ElementTree I am now having namespaces in my XML and tried understanding the answer at Parsing XML with namespace in Python via 'ElementTree&#...
Pinebrook asked 31/7, 2014 at 22:47

1

Solved

<grandParent> <parent> <child>Sam/Astronaut</child> </parent> </grandParent> I want to modify the above XML by adding another child tag inside parent tag. I...
Passe asked 31/7, 2014 at 20:46

2

Solved

I am trying to write an xml file using the code below: def make_xml(a_numpy_array): from lxml import etree as ET root = ET.Element('intersections') intersection = ET.SubElement(root, 'interse...
Dimpledimwit asked 15/7, 2014 at 17:6

0

I'm trying to create shibboleth configuration files using xml.etree in python, and I'm having problems with it omitting namespace assignments when it output the finished document. I'm pretty sure t...
Kobi asked 3/7, 2014 at 14:59

6

I'm interested in equivalence of two xml elements; and I've found that testing the tostring of the elements works; however, that seems hacky. Is there a better way to test equivalence of two etree...
Apiarist asked 26/10, 2011 at 15:57

1

Solved

In Python 2.7, when passing a unicode string to ElementTree's fromstring() method that has encoding="UTF-16" in the XML declaration, I'm getting a ParseError saying that the encoding specified is i...
Charissacharisse asked 4/6, 2014 at 19:25

3

I wanted to parse a fairly huge xml-like file which doesn't have any root element. The format of the file is: <tag1> <tag2> </tag2> </tag1> <tag1> <tag3/> </...
Dominions asked 27/5, 2014 at 13:50

1

Solved

I have tried parsing the file using lxml iterparse since the actual file would be huge. I have the following code: import xml.etree.cElementTree as etree filename = r'D:\test\Books.xml' context = ...
Coh asked 14/3, 2014 at 16:50

1

Solved

I have an XML file of the form: <PlayersList> <player> <username>Someuser</username> <network>Somenetwork</network> <country>France</country> &...
Agnosticism asked 14/3, 2014 at 11:42

6

Solved

I have this char in an xml file: <data> <products> <color>fumè</color> </product> </data> I try to generate an instance of ElementTree with the following c...
Jeane asked 10/9, 2012 at 10:23

1

Solved

Problem: When whitespace is insignificant, representation may be very significant. Explanation: In XML Schema Part 2: Datatypes Second Edition the constraining facet whiteSpace is defined for ty...
Fokine asked 7/6, 2013 at 1:36

1

Solved

I need help to understand why parsing my xml file* with xml.etree.ElementTree produces the following errors. *My test xml file contains arabic characters. Task: Open and parse utf8_file.xml fil...
Faceplate asked 11/2, 2014 at 9:36

2

E.g. consider parsing a pom.xml file: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4...
Beecham asked 15/1, 2014 at 19:26

1

Solved

Using the following code I would expect to be able to search for the target tag, if I specify the namespace. import xml.etree.ElementTree as ET xml = """<?xml version="1.0" encoding="UTF-8"?&g...
Sophistication asked 8/1, 2014 at 15:5

5

Solved

I have been developing an application with django and elementtree and while deploying it to the production server i have found out it is running python 2.4. I have been able to bundle elementtree b...
Seminar asked 1/7, 2009 at 11:2

2

Solved

I'm new to xml parsing and Python so bear with me. I'm using lxml to parse a wiki dump, but I just want for each page, its title and text. For now I've got this: from xml.etree import ElementTre...
Telangiectasis asked 6/12, 2013 at 23:36

© 2022 - 2024 — McMap. All rights reserved.