Linked Questions
162 questions linked to/from How can I parse XML and get instances of a particular node attribute?
13 votes
1 answer
89k views
Xml - Find Element By tag using Python [duplicate]
I am trying extract some data from a bunch of xml files. Now, the issue is the structure of all the files is not exactly the same and thus, just iterating over the children and extracting the values ...
4 votes
4 answers
14k views
python parse xml text [duplicate]
I would like to parse xml in python, but as a string, not taken from a file. Can someone help me do this?
9 votes
2 answers
27k views
Python XML Parsing [duplicate]
*Note: lxml will not run on my system. I was hoping to find a solution that does not involve lxml. I have gone through some of the documentation around here already, and am having difficulties ...
1 vote
3 answers
13k views
Convert Deeply Nested XML to CSV in Python [duplicate]
I'm new to Python and have heard that it is one of the best ways to parse fairly large XML files (150MB). I can't get my head around how to iterate through the tags and extract only the <hw> and ...
1 vote
1 answer
11k views
How do I parse XML with attribute in python? [duplicate]
I have an xml which has many number of rows. For a particular given attribute id, the element name and price value should be queried. For instance, my tree looks like: <menu> <food id="1"&...
0 votes
1 answer
8k views
Read an XML file with tags and indentation into a python variable [duplicate]
Is there a way to read an entire XML file into a Python variable with tags and indentation? data = """<?xml version="1.0" encoding="UTF-8" ?> <uimap> <page name="login"> ...
0 votes
1 answer
6k views
Parsing XML using Python to print values [duplicate]
I have an XML file that contains file names and file extensions that are commonly associated with ransomware and malware. Using Python, I want to parse the "Pattern Value" to simply print the value ...
0 votes
3 answers
2k views
Regex include line breaks [duplicate]
I have the following xml file <p style="1"> A </p> <div xml:lang="unknown"> <p style="3"> B C </div> <div xml:lang="English"> <p style="5"> D </p> <...
0 votes
2 answers
3k views
Reading XML data in a REST API [duplicate]
So I am building a REST API in Python/Flask and I have already handled the part that enables me to read data in JSON format as follows: data = request.get_json() I was wondering if there was an xml ...
-1 votes
1 answer
3k views
Python: Extract values from XML file [duplicate]
I have a XML file and I need to extract some numeric values. I would like to write a simple Python script, which open/reads the file and extracts these values. How can I do that? thank you very much!!...
0 votes
2 answers
2k views
Get value from xml response in Python [duplicate]
I need to rewrite scripts from PowerShell to python and I'm new to python. How can I get value from XML response in python e.g I have a response in XML: <?xml version="1.0" encoding="utf-8"?> &...
-1 votes
1 answer
1k views
How to parse xml using python [duplicate]
I have the below xml file : <?xml version="1.0" encoding="UTF-8"?> <jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://...
1 vote
1 answer
587 views
Get a json dictionary from xml file [duplicate]
Possible Duplicate: easiest way to parse xml in python I need to parse a file which looks like an xml file but have no XML declaration. Here is an example of XML file: <connection name="...
0 votes
2 answers
955 views
How to read the filename from an XML file [duplicate]
I am trying to read the filename of an image from the XML file I run the following code: import xml.etree.ElementTree as ET tree = ET.parse(r'...\57128.xml') root = tree.getroot() a = root.find('.//...
-1 votes
2 answers
809 views
Using regular expression to replace xml in Python [duplicate]
I want to convert the .mdx file to the .dictionary used by the MAC. So, I need to read and replace many lines in a .xml file. But my problem is there are so many different lines to replace. This is ...