Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parse XML with Namespaces
#5
Hello -
Thanks so much. I just did a quick test and this works great. I will try it on a few other parts of the xml file as well.

One question, as a test, I changed to using lxml and the same code works. But, you also suggested using xpath for my searching/parsing. In my example, would it be something like:
conn_mgrs = root.xpath('XYZ:ConnectionManagers/XYZ:ConnectionManager/XYZ:ObjectData/XYZ:ConnectionManager', namespaces=ns)
I did try that and the output was the same as using the builtin xml.etree. Just wanted to make sure I was understanding your advice.

thank you!
Reply


Messages In This Thread
Parse XML with Namespaces - by dwill - Apr-11-2018, 09:51 PM
RE: Parse XML with Namespaces - by Larz60+ - Apr-12-2018, 01:13 AM
RE: Parse XML with Namespaces - by dwill - Apr-12-2018, 03:25 AM
RE: Parse XML with Namespaces - by stranac - Apr-12-2018, 07:58 AM
RE: Parse XML with Namespaces - by dwill - Apr-12-2018, 04:10 PM
RE: Parse XML with Namespaces - by stranac - Apr-12-2018, 06:51 PM
RE: Parse XML with Namespaces - by dwill - Apr-12-2018, 08:08 PM
RE: Parse XML with Namespaces - by dwill - Apr-12-2018, 09:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Still not completely clear about namespaces... bytecrunch 3 2,033 Oct-07-2022, 05:44 PM
Last Post: bytecrunch
  Modules and namespaces (again?) ptrivino 1 1,907 Oct-24-2020, 10:37 PM
Last Post: Larz60+
  namespaces in comprehension in exec() Skaperen 4 4,835 Mar-28-2017, 03:31 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020