Tagged Questions
6
votes
2answers
7k views
Parse XML file into Python object
I have an XML file which looks like this:
<encspot>
<file>
<Name>some filename.mp3</Name>
<Encoder>Gogo (after 3.0)</Encoder>
...
13
votes
5answers
34k views
UnicodeEncodeError: 'ascii' codec can't encode character u'\xef' in position 0: ordinal not in range(128)
I want to parse my XML document. So I have stored my XML document as below
class XMLdocs(db.Expando):
id = db.IntegerProperty()
name=db.StringProperty()
content=db.BlobProperty()
...
15
votes
4answers
5k views
lxml etree xmlparser namespace problem
I have an xml doc that I am trying to parse using Etree.lxml
<Envelope xmlns="http://www.xxx.com/zzz/yyy">
<Header>
<Version>1</Version>
</Header>
<Body>
...
5
votes
1answer
474 views
How to efficiently store this parsed XML document in MySQL Database using Python?
Following is the XML file : book.xml
<?xml version="1.0" ?>
<!--Sample XML Document-->
<bookstore>
<book _id="E7854">
<title>
Sample XML Book
...
2
votes
3answers
669 views
Python to parse non-standard XML file
My input file is actually multiple XML files appending to one file. (It's from Google Patents). It has below structure:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE us-patent-grant ...
2
votes
1answer
81 views
Unicode Encoding Errors Python - Parsing XML can't encode a character (Star)
I am a beginner to Python and am currently parsing a web-based XML file from the eventful.com API however, I am receiving some unicode errors when retrieving certain elements of the data.
I am able ...
0
votes
1answer
210 views
Parsing XML with namespace in Python ElementTree
I have the following xml, which I want to parse using Python's ElementTree
<rdf:RDF xml:base="http://dbpedia.org/ontology/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ...
0
votes
4answers
244 views
Parsing blank XML tags with LXML and Python
When parsing XML documents in the format of:
<Car>
<Color>Blue</Color>
<Make>Chevy</Make>
<Model>Camaro</Model>
</Car>
I use the ...
-1
votes
3answers
151 views
save data in xml file to mysql database(xml parsing)
I am new to xmp paring,i am trying to save the data from xml file to mysql database.
I learned about deserialization in django
my book.xml is
<?xml version="1.0"?>
<bookstore>
...
3
votes
1answer
125 views
python lxml with py2exe
I have Generated an XML with dom and i want to use lxml to pretty print the xml.
this is my code for pretty print the xml
def prettify_xml(xml_str):
import lxml.etree as etree
root = ...
3
votes
1answer
586 views
Why is ElementTree.iterparse() raising a ParseError?
import xml.etree.ElementTree as ET
xmldata = file('my_xml_file.xml')
tree = ET.parse(xmldata)
root = tree.getroot()
root_iter = root.iter()
Now I can call root_iter.next() and get my Element ...
2
votes
1answer
530 views
Python - Which is faster to parse Json or XML? [closed]
From my observations overall JSON is faster to Parse than XML. I have found two good question regarding this. One is asked for PHP and other is asked for JavaScript. I want to know about python, how ...
1
vote
1answer
154 views
Python XML parsing not working for some sites
I have a very basic XML parser based on the tutorial provided here, for the purpose of reading RSS feeds in Python.
def GetRSS(RSSurl):
url_info = urllib.urlopen(RSSurl)
if (url_info):
...
1
vote
4answers
317 views
parsing an xml file for unknown elements using python ElementTree
I wish to extract all the tag names and their corresponding data from a multi-purpose xml file. Then save that information into a python dictionary (e.g tag = key, data = value). The catch being the ...
1
vote
3answers
449 views
Commenting and uncommenting XML via Python
I would like to know of a way to comment and uncomment an element in XML using Python.
<target depends="create-build-dir" name="build-Folio">
<property name="project.name" ...