Parsing XML response from net.httpClient

Greetings humans
I've managed to use system.net.httpClient to make a soap request to a WSDL (that took a while, but I got there, forum trawling for the win).
I'm failing to trawl the forum sufficiently well to manage to parse the responses though.

I've looked at Parsing XML with Java Libraries | Ignition User Manual (inductiveautomation.com), and at Simple xml parsing question - Ignition - Inductive Automation Forum and at Download file as xml - Ignition - Inductive Automation Forum, and but I can't really work out how to adapt these to what I'm getting through.

I'm making three kinds of soap request, and a sample of the responses for each are:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <GetSlaveResponse xmlns="http://www.resourcedm.com/RDMServices/2022/01/26/">
         <GetSlaveResult>
            <Description>system 2 evap 2</Description>
            <Network>
               <Status>Online</Status>
               <Time>2024-04-25T12:40:39+01:00</Time>
            </Network>
            <Items>
               <Item>
                  <Class>Input</Class>
                  <Name>Control temp.</Name>
                  <Value>5.1</Value>
                  <Units>C</Units>
               </Item>
               <Item>
                  <Class>Output</Class>
                  <Name>Run Time</Name>
                  <Value>16</Value>
                  <Units>K Hrs</Units>
               </Item>
               <Item>
                  <Class>Parameter</Class>
                  <Name>Cut-in temp</Name>
                  <Value>4.0</Value>
                  <Units>C</Units>
                  <Detail>
                     <Type>Numeric</Type>
                     <Min>-42.0</Min>
                     <Max>30.0</Max>
                     <Step>0.1</Step>
                  </Detail>
               </Item>
              </Items>
         </GetSlaveResult>
      </GetSlaveResponse>
   </soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <GetSlaveListResponse xmlns="http://www.resourcedm.com/RDMServices/2022/01/26/">
         <GetSlaveListResult>
            <Slave>
               <Name>101</Name>
               <Description>system 1 evap 1</Description>
               <Value>3.1</Value>
               <State>Normal</State>
            </Slave>
            <Slave>
               <Name>102</Name>
               <Description>system1 evap 2</Description>
               <Value>4.0</Value>
               <State>Normal</State>
            </Slave>
            <Slave>
               <Name>201</Name>
               <Description>system 2 evap 1</Description>
               <Value>3.7</Value>
               <State>Normal</State>
            </Slave>
            <Slave>
               <Name>202</Name>
               <Description>system 2 evap 2</Description>
               <Value>5.0</Value>
               <State>Normal</State>
            </Slave>
         </GetSlaveListResult>
      </GetSlaveListResponse>
   </soap:Body>
</soap:Envelope>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <GetLogDataResponse xmlns="http://www.resourcedm.com/RDMServices/2022/01/26/">
         <GetLogDataInlineResult>
            <Controller>101</Controller>
            <Step>3600</Step>
            <Start>2024-04-29T13:06:00+01:00</Start>
            <End>2024-04-29T14:06:00+01:00</End>
            <LogData><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
<Data>
<Fields>
<Field>Control temp.</Field>
<Field>Display temp.</Field>
<Field>Air on Probe</Field>
<Field>Air off Probe</Field>
<Field>Evaporator Probe</Field>
<Field>Suc. Line Probe</Field>
<Field>Superheat</Field>
<Field>Defrost Probe</Field>
<Field>Logging Probe</Field>
<Field>Alarm temp.</Field>
<Field>Plant Fault 1</Field>
<Field>Plant Fault 2</Field>
<Field>Plant Fault 3</Field>
<Field>Door Sensor</Field>
<Field>Person Trapped</Field>
<Field>Case Clean</Field>
<Field>Monitor Probe</Field>
<Field>Ext Defrost</Field>
<Field>MOP</Field>
<Field>Load Shed</Field>
<Field>Liq. Line Valve</Field>
<Field>Suc. Line Valve</Field>
<Field>Defrost Control</Field>
<Field>Lights</Field>
<Field>Case Fans</Field>
<Field>Last Def. Time</Field>
<Field>Last Def. Length</Field>
<Field>Last Def. Temp.</Field>
<Field>Last Def. Type</Field>
<Field>Door Open Time</Field>
<Field>Door Open Length</Field>
<Field>Setpoint Offset</Field>
<Field>Alm Relay 1</Field>
<Field>Alm Relay 2</Field>
<Field>Remote Rly4</Field>
<Field>Run Time</Field>
<Field>Control State</Field>
</Fields>
<Entries>
<Entry>
<Time>2024-04-29T13:06:00+01:00</Time>
<Values>
<Value>7.2</Value>
<Value>7.2</Value>
<Value>7.2</Value>
<Value>1.5</Value>
<Value>1.9</Value>
<Value>3.5</Value>
<Value>1.6</Value>
<Value>-3.5</Value>
<Value>????????</Value>
<Value>1.5</Value>
<Value>OK</Value>
<Value>OK</Value>
<Value>OK</Value>
<Value>Closed</Value>
<Value>OK</Value>
<Value>Off</Value>
<Value>????????</Value>
<Value>Off</Value>
<Value>Off</Value>
<Value>Off</Value>
<Value>Open</Value>
<Value>Open</Value>
<Value>Off</Value>
<Value>On</Value>
<Value>On</Value>
<Value>12:00</Value>
<Value>00:34</Value>
<Value>12.2</Value>
<Value>Timed</Value>
<Value>00:00</Value>
<Value>00:00</Value>
<Value>????????</Value>
<Value>Unused</Value>
<Value>Unused</Value>
<Value>Off</Value>
<Value>16</Value>
<Value>Normal</Value>
</Values>
</Entry>
<Entry>
<Time>2024-04-29T14:06:00+01:00</Time>
<Values>
<Value>4.4</Value>
<Value>4.4</Value>
<Value>4.4</Value>
<Value>0.4</Value>
<Value>-4.7</Value>
<Value>-0.1</Value>
<Value>4.6</Value>
<Value>-5.5</Value>
<Value>????????</Value>
<Value>0.4</Value>
<Value>OK</Value>
<Value>OK</Value>
<Value>OK</Value>
<Value>Closed</Value>
<Value>OK</Value>
<Value>Off</Value>
<Value>????????</Value>
<Value>Off</Value>
<Value>Off</Value>
<Value>Off</Value>
<Value>Open</Value>
<Value>Open</Value>
<Value>Off</Value>
<Value>On</Value>
<Value>On</Value>
<Value>12:00</Value>
<Value>00:34</Value>
<Value>12.2</Value>
<Value>Timed</Value>
<Value>00:00</Value>
<Value>00:00</Value>
<Value>????????</Value>
<Value>Unused</Value>
<Value>Unused</Value>
<Value>Off</Value>
<Value>16</Value>
<Value>Normal</Value>
</Values>
</Entry>
</Entries>
</Data>]]></LogData>
         </GetLogDataInlineResult>
      </GetLogDataResponse>
   </soap:Body>
</soap:Envelope>

I've tried the DOM parser method but it just comes up with the root as:
[soap:Envelope:null] and attempting to look for child nodes throws
TypeError:'com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl' object is unsubscriptable

The code I'm trying for the DOM parser is the imports from the ignition docs for parsing, and from my httpClient post:

response = sudClient.post(url = "http://10.1.184.27/cgi-bin/cgi.cgi?WebService",data = dataS,headers = myheaders)
	
xmlString = response.text  # Replace with your actual XML string
	
# Create a DOM document builder
builderFactory = DocumentBuilderFactory.newInstance()
builder = builderFactory.newDocumentBuilder()
	
# Parse the XML string
stream = ByteArrayInputStream(xmlString.encode('utf-8'))
document = builder.parse(stream)
	
# Access the root element
root = document.getDocumentElement()

If I try the SAX parser method (again using the imports and setting up the 'MyContentHandler' class from the ignition docs example):

saxParserFactory = SAXParserFactory.newInstance()
saxParser = saxParserFactory.newSAXParser()
xmlString = response.getBody()
document = saxParser.parse(ByteArrayInputStream(xmlString), MyContentHandler())
return document

Gives an error:
TypeError:'com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$AttributesProxy' object is not iterable

I have no idea where to really go from here for extracting the data in a useable fashion from the XML. I've not tried to do this before, so I don't even really know what the output would look like if it was successful, or how I'd then make that into a dataset or dictionary or other useable format for referencing in a component, but I'm assuming it would be easier than trying to do that with the XML string.

Any and all assistance gratefully received.
Apologies for the length of post, I've tried to be as concise as my understanding of the problem allows, without skipping over something important.
Thanks
Cameron

I have had the best luck with ElementTree


import xml.etree.ElementTree as ET
#Get your XML here
path = myXMLSource
tree = ET.parse(path)
root = tree.getroot()
context = root.getiterator(tag='Tag') #This will be a node name like getSlaveResponse in your first file
for tag in context:
     #grab whatever values at whatever levels you need
     tag.get('Name')
     ch=tag.getchildren():
          for c in ch:
                print c.text

Google python ElementTree for full docs.

This seems to be working, so thank you!