Questions tagged [lxml.objectify]

48 questions
0
votes
0 answers

AWS Glue ImportError: cannot import name objectify from lxml

Environment: Glue 3.0, Python 3.7 Downloaded and added wheel file in Glue's Python library path of lxml-4.8.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl which I downloaded from pypi. I am trying to run: from lxml…
Aakash Basu
  • 1,689
  • 7
  • 28
  • 57
0
votes
1 answer

python lxml.objectify gives no attribute access to gco:CharacterString node

I have a geometadata file 2ce585df-df23-45f6-b8e1-184e64e7e3b5
0
votes
1 answer

equivalent of lxml.objectify cleanup_namespaces in defusedxml

I am getting below error in bandit. Using lxml.etree.parse to parse untrusted XML data is known to be vulnerable to XML attacks. Replace lxml.etree.parse with its defusedxml equivalent function. I want the below code's equivlent with…
0
votes
2 answers

Objectify xml string with dashes in tags and attributes names

I am using lxml to objectify xml string with dashes in the tags. For example: from lxml import objectify xml_string = """
0
votes
0 answers

Avoid deep copy when adding attribute lxml.objectify

lxml.objectify's documentation states that any subtrees that are added as an attribute will be deep copied. Is there a way to avoid this? I am trying to mimic SQL-style relationships using XML, and I want any changes in a subtree object to change…
Vishnu S.
  • 141
  • 1
  • 2
  • 8
0
votes
1 answer

How to append data to a parsed XML object - Python

I am trying to take an xml document parsed with lxml objectify in python and add subelements to it. The problem is that I can't work out how to do this. The only real option I've found is a complete reconstruction of the data with objectify.Element…
Gunty
  • 1,841
  • 1
  • 15
  • 27
0
votes
0 answers

How can I read an XML and also preserve the sequence of tags so that the meaning is intact?

I have been using lxml and objectify to read XMLs thus far: I created custom classes with the same name as tags I used for loops to read the objectified xml-tags and mapped them into my custom classes The above technique worked as I didn't need to…
user366312
  • 16,949
  • 65
  • 235
  • 452
0
votes
1 answer

How can I read 3 kinds of XML files using only one function?

Suppose, I have the following 3 kinds of XML files: file1.xml abc12300xyz__param -> type file2.xml abc12300xyz__param -> type
user366312
  • 16,949
  • 65
  • 235
  • 452
0
votes
1 answer

How I can take XML data using lxml.objectify into the DataFrame pandas and show it in table format?

This is an XML file that has data in which I want to perform the task using lxml.objectify & pandas.DataFrame File: students.xml Information Technology
0
votes
1 answer

Creating python objectify Element and then adding attributes

I am trying to serialize a python class named Origin, containing a dictionary as an attribute, into an xml with lxml objectify. This dictionary is initialized with the value "default" for each key. class Origin: def __init__(self): dict…
Ekica
  • 73
  • 1
  • 8
0
votes
1 answer

How to set the content of a markup called "text" with lxml.objectify?

I am trying to parse an XML File in python with lxml.objectify, modify the text from and then put back together the XML. This is a short overview of my XML file:
Ekica
  • 73
  • 1
  • 8
0
votes
1 answer

Issues Parsing Multi Nested Childs in XML using lxml

Im having issues parsing out each child node within an xml file. The number of nodes can change per Instrument_Root. For instance, Instrument_Watch is NULL here, but will be populated in other instances after this. My goal is to have each child node…
murkcity
  • 69
  • 1
  • 7
0
votes
1 answer
0
votes
1 answer

Can't set children's values in lxml.objectify

I am trying to work with a restful interface which uses XML. I have narrowed my choice of XML library down to two. lxml.objectify seems to be my preferred option based on the documentation but I am struggling. Xmltodict seems to generate more…
Dkellygb
  • 866
  • 2
  • 8
  • 24
0
votes
1 answer

Unexpected results parsing XML in Python

I'm trying to parse the following text from the XML title_text = word1 Word2 word3 word4 The problem is that with the code below I'm getting title_text = 'word1'. How can I achieve that? XML: ............ …