Tagged Questions
1
vote
2answers
20 views
Processing XML file with networkx in python
I need to process a graphml (XML) file created by a yEd graph in order to get the node and edges attributes of that graph. I need to do that using the networkX library. I'm new at Python and I have ...
0
votes
1answer
20 views
parsing xml tags in a specific order in python
I want to load some tags with a specified order from an xml file into python as below:
<data>
<testset name="ts1" order="1" descrption="this is ts1 descrption">
<testcase ...
-3
votes
0answers
30 views
Revising python code to pass variable to xml document
How can I re-write this so that my list imports successfully into a xml file. companyInfo has a matching variable in the xml template (which is a word document) which gets replaced during running of ...
1
vote
1answer
28 views
Use lxml to read xml and compare elements
I've tried searching various questions and answers here on StackOverflow and cannot find a solution that works for my situation, so here is my issue.
I have 3 xml files that I am attempting to ...
0
votes
2answers
24 views
Retrive subset of xml nodes with python
xml very newbie here.
I have an xml file, which is quite big with this form:
<a>
<b>
<id>1</id>
...
</b>
<b>
<id>2</id>
...
...
2
votes
0answers
25 views
Python: xpath.find() won't find new elements if they were added without namespace
Today I stumbled upon a peculiar behaviour of the xml.dom and xpath modules and it took me a while to figure out it had to do with XML namespaces:
from xml.dom import minidom
import xpath
zooXml = ...
2
votes
0answers
38 views
How do I handle whitespace with Python's elementtree?
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 types ...
1
vote
3answers
38 views
How do I parse some of the data from a large xml file?
I need to extract the location and radius data from a large xml file that is formatted as below and store the data in 2-dimensional ndarray. This is my first time using Python and I can't find ...
0
votes
1answer
47 views
Mapping user id onto a dict comparing to see if user is already in dict
I have code which currently prints out data for each user from an XML file (obtained from a website) the XML updates as more users interact with it throughout the day. I currently have my code looping ...
-2
votes
1answer
21 views
Merging XML files using python
I have two XML files:
The first one contains the following tags:
<book id=1>
<chpater id=1>
<sentence id = 1>
blaa blaa blaa blaa
</sentence>
<sentence id = 2>
blaa ...
1
vote
0answers
33 views
Read XML file like text file
is there any way to read xml file like reading text file(line by line)?
In my work for some cases i have to read only specific lines. I'm using minidom for parsing xml.
0
votes
2answers
20 views
Grab Content from XML using Python? almost there
I'm using ElementTree and I can get tags and attributes but not that actual content between elements.
from this XML:
<tag_name attrib="1">I WANT THIS INFO HERE</tag_name>
here's my ...
0
votes
1answer
31 views
Stopping a looping script from returning duplicate entries
I have code which currently prints out data for each user from an XML file (obtained from a website) the XML updates as more users interact with it throughout the day. I currently have my code looping ...
1
vote
2answers
37 views
How to find the character position of something specified with a <tag>…</>? Python
I am trying to get the position of the < and > that are realtag when they are embedded in something like this <tag "510270">calculate</>.
I have sentences like these:
sentence = ...
0
votes
1answer
63 views
How to add a newline to a long multi-line string?
I have a string like this :
my_xml = '''
<?xml version="1.0" encoding="utf-8" ?> \n
<entries> \n
<entry>1</entry> \n
...