Tagged Questions
0
votes
2answers
30 views
Python Scrapy Dynamic Web Sites
I am trying to scrape a very simple web page with the help of Scrapy and it's xpath selectors but for some reason the selectors I have do not work in Scrapy but they do work in other xpath utilities
...
0
votes
0answers
23 views
python append content in xml file
in python i'm tring to append some xml in a existing xml file. This is my function:
from lxml import etree as ElementTree
import os
import string
import sys
path = "file.xml"
def addEntries(data): ...
1
vote
0answers
35 views
Validating SAML signature in python
I need to implement authentication in python from a 3rd party by using SAML2. I have looked into pysaml2 and found that to be quite confusing, and decided to give M2Crypto a chance after I found this ...
1
vote
3answers
21 views
Python - RSS Web Scraping - Selecting Correct Elements
I posted an article to help with the output format of data I had scraped from an RSS feed.
The answer I received was exactly what I needed and the output format is now as required.
The updated code ...
2
votes
2answers
26 views
Pass a file as a parameter in two Python Scripts
New Python'er has a question "hand raised".
I have two Python Scripts and a XML file. "mysecondpython.py" needs to call "myfirstpython.py" with a parameter of "data.xml" so that it can write ...
0
votes
2answers
42 views
Python - Scraping website data - formatting printed results
I have been experimenting on python 2.7.3 to extract data from an RSS feed so I can output it to the python shell.
I found a video on you tube on the subject and copied the code from their tutorial.
...
1
vote
1answer
18 views
django rest framework - XML formatting
Can someone explain why the format of the XML looks great in the browser -
<job id="blah" name="string2" master="string3" dbversion="string4" xmlversion="string5">
<jobmst>
...
1
vote
1answer
27 views
BeautifulSoup going directly into first child's children instead of indexing immediate children
I'm trying to get to a specific tag in an xml file loaded into a BS object, but when I get to a specific tag, BS is going into the first child when I try an access the children using square brackets ...
0
votes
1answer
13 views
Parsing a URL XML with the The ElementTree XML API
Below is my sample code where in the background i am downloading statsxml.jsp with wget and then parsing the xml. My question is now i need to parse multiple XML URL and as you can see in the below ...
2
votes
1answer
22 views
Sibling nodes in ElementTree in Python
I am looking at a piece of XML that I want to add a node in.
<profile>
<dog>1</dog>
<halfdog>0</halfdog>
<cat>545</cat>
...
-1
votes
0answers
19 views
Sort XML by element name in different files
I have a project which has XML in different order and one file has comments in XML.
What I need to do is this:
Compare original strings to new project structure
Take strings by their element name ...
2
votes
1answer
45 views
How to copy multiple XML nodes to another file in Python
Bare in mind I am very new to Python. I'm trying to copy few XML nodes from sample1.xml to out.xml if it doesn't exist in sample2.xml.
this is how far I got before I'm stuck
import ...
1
vote
1answer
22 views
No output in XML file using XMLITEMEXPORTER
I am beginner to python and I am working with scrapy. I have used xmlitemexporter to export my scraped data to xml file. But i get only "<"/item"">" in the xml file.
My items.py is like follow:
...
1
vote
1answer
40 views
Parsing from a stream of XML string fragment in Python
I have an eye-tracker uses TCP/IP communication and XML to send data between client (application) and server (eye-tracker). The following is an example of the XML data string I receive continuously ...
3
votes
1answer
13 views
How to escape parent attribute in BeautifulSoup ISO tag actually named <parent>?
OK, this is kind of funny. Here is the XML:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...
1
vote
1answer
28 views
Adding XML data from a XML file to an existing XML file
I'm very new to Python, only read the Learn Python the Hard Way. But I think this is still way out of my scope. My skills are in XML/XSL, not Python. I need a little help to get started.
Overview: I ...
2
votes
1answer
12 views
Finding a nonrecursive DOM subnode in Python using BeautifulSoup
Is there any way to find a nonrecursive DOM subnode in Python using BeautifulSoup?
E.g. consider parsing a pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" ...
1
vote
2answers
26 views
Simple dom traversing in Python using xml.etree.ElementTree
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"
...
1
vote
1answer
19 views
Not recursive (single node level) getElementsByTagName in Python xml.dom
Is there any way to use getElementsByTagName only at a single node level and not recursively?
E.g. consider parsing a pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" ...
1
vote
0answers
10 views
lxml: keep the same tags in fromstring and tostring
I'm using lxml to parse an XML message. What I want to do is convert the string into an xml message, extract some informations thanks to xpath directives, edit a few attributes and then dump the XML ...
0
votes
0answers
12 views
Python: How to make python tree type data using xsd (xml schema file) file?
Now I'm going on the research about xml schema matching.
So I want to parse two xsd into tree-type data to comapring each tree element.
Or just dot- separated string is OK.
(Like this form : ...
0
votes
2answers
17 views
Specific pathing to find XML elements using minidom in Python
As per this thread, I am using xml.dom.minidom to do some very basic XML traversing, read-only.
What confuses me is why its getElementsByTagName is finding nodes several hierarchy levels deep without ...
0
votes
2answers
58 views
extracting specific data from a xml file
I have a xml file like this
<pr_id>01</pr_id>
<uniprot>O11482</uniprot>
<uniprot>O96642</uniprot>
<uniprot>Q67845</uniprot>
...
0
votes
1answer
58 views
inheritance of customized module in openerp
I have successfully created module and it is working absolutely fine. Now from that module i have inheritated another module for which i need your support for xml genaration. I have given original ...
0
votes
0answers
31 views
Python: SUDS performance
I'm consuming web service with SUDS and have undesired delay (around 10 secs) after I recieved XML.
client = Client(URL) # WSDL is ~800kB, but initialization is less then 1s
...
1
vote
0answers
31 views
Error in escaping XML for a KML file
Some time ago I asked a question trying to figure out why modifying a KML file increased the file size.
After poking around, I've found that the issue had to do with escaping XML.
Essentially, the ...
0
votes
0answers
30 views
python xml delete element with attribute <hidden> [on hold]
starting in XML, I would like to delete elements depending on attibute value. In my example, I would like to delete which have 1 atribute.
Could you help me to begin ?
Which method use : dom minidom ...
0
votes
1answer
35 views
Easiest way to sort XML in Python? [Skype Bot]
I'm making a Skype bot and one of my commands is !trace ip_or_website_here
However, I see to be having an issue sorting out my XML Responses.
Commands.py:
elif msg.startswith('!trace '):
...
3
votes
1answer
74 views
'ascii' codec can't decode byte 0xe2 in position 5367: ordinal not in range(128)
Django 1.6.1
Python 3.2.3
Apache 2.2.2
Ubuntu 12.04
Postgres 9.1.11
I'm getting this error when trying to import a serialized XML file. I exported it from one database that I was using for a ...
0
votes
0answers
13 views
Error when converting blogger xml file to wordperss xml file (wxr)
I wanted to convert my blogger xml file to a wordpress one with the blogger2wordpress application. Now I'm getting this error:
Traceback (most recent call last):
File ...
0
votes
0answers
28 views
Python to write to change the images [duplicate]
i'm building a navigatable menu in xml which is included the background and the images. I have also created the python script to allow me to use the keyboard control.
Here's the xml file:
<?xml ...
0
votes
1answer
20 views
how to recursively iterate over XML tags in Python using ElementTree?
I am trying to iterate over all nodes in a tree using ElementTree.
I do something like:
tree = ET.parse("/tmp/test.xml")
root = tree.getroot()
for child in root:
### do something with ...
1
vote
1answer
16 views
Select all siblings (including text) of comment in xpath
I have an XML document, a fragment line of which could look like this:
<p>Some text <!--a comment --> some more text <b>some bold text</b> something else etc</p>
I ...
-1
votes
1answer
53 views
Python+Qt what library/module use for reading and writing XML [closed]
For my application I am using a combination of Python+Qt(PySide). I need to read from and write to XML. Currently I have implemented some part of functionality using Python's standard ElementTree ...
-1
votes
0answers
22 views
Python csv writerows method misses out dot character from the end of a number
I find it rather strange and it may sound trivial to many of you!
Here's my issue:
I'm reading an xml file and writing the entries to a csv file. The xml has values like "3.", "2011." etc. These ...
1
vote
2answers
31 views
Merging XML files using Python's ElementTree and maintaining CDATA tags
I pretty much reused the same bit of code from here merging xml files using python's ElementTree and I got it working. The XML files I am trying to merge look like this
A.xml
<root>
...
-1
votes
1answer
50 views
xml parser in python for xbmc
I would like to get your help with my .py script.
I'm using xml file to store the parser path for the images.
Here's the xml file that I use:
<?xml version="1.0" encoding="utf-8"?>
...
-2
votes
0answers
22 views
how to create a key-value pairs from XML in Python
I have an xml document and i am trying to create a key value pair from it by making container as key and content as value, but not able to do that can i get some help.
0
votes
1answer
21 views
numpy.int64' object has no attribute 'replace' while writing xml file using minidom
I've an xml file to be parsed. I did this using minidom parser of python. I had to add an attribute to a particular element which I did after the parsing. Now, I want to write the file back. I am not ...
0
votes
0answers
45 views
OpenERP 6.1 : Domain,Context from Python Method
I have a created an extra column in res_users and i want to filter all my further views based on that field for the user logged in. I am new to this and couldn't find how filter my view based on a ...
2
votes
1answer
22 views
ElementTree find()/findall() can't find tag with namespace?
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"?>
...
0
votes
0answers
14 views
Can't get Google Adwords demo to work on Google Appengine
Hi all,
I am new to Google Appengine and I am trying to use it to create an app to automatically manage campaigns. The problem I have is I can't get the demo program to run.
If I don't install PyXML ...
1
vote
0answers
30 views
Python web-service reveive and send xml (no wsdl?) complex data structure
I`m a newbie in programming and also in python. My task is to build a web service, which receives xml document transforms them to some data structure and sends some OK (XML) messages back.
Example of ...
0
votes
2answers
15 views
how to handle duplicate tags in beautifulsoup
<system>
<load><avg01>0.03</avg01><avg05>0.15</avg05><avg15>0.16</avg15></load>
<cpu><user>7.4</user>
...
0
votes
1answer
40 views
Get all attribs from element and his child using Python
I'm trying to perform some kind of XMLs (now with xml.etree.ElementTree) to JSON (and to study Python, using it in my real noncritical tasks). Example of XML:
<ExportData name="ExportData" ...
1
vote
1answer
52 views
Modify namespaces in a given xml document with lxml
I have an xml-document that looks like this:
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://someurl/Oldschema"
xsi:schemaLocation="http://someurl/Oldschema ...
0
votes
1answer
47 views
Add new Element to xml using Elementtree
I have the following xml structure.(this is part of it) . actually it has TVEpisode','TVShow','Movie','TVSeries','TVSeason', i need to go through the xml file and check for the decription element. ...
2
votes
1answer
40 views
lxml attributes require full namespace
The code below reads the a table from an Excel 2003 XML workbook using lxml (python 3.3). The code works fine, however in order to access the Type attribute of the Data element via the get() method I ...
3
votes
1answer
47 views
Process XML by chunks in Python
I have a series of large XML files (~3GB each) that I'm trying to process. The rough format of the XML is
<FILE>
<DOC>
<FIELD1>
Some text.
</FIELD1>
...
0
votes
1answer
34 views
How do I limit a loop over xml-elements by its attributes?
I feel like I'm stuck and would really appreciate all forms of help and guidance.
I have an XML downloaded from yr.no (norweigan weather report). It contains several elements with weather reports ...