-
-
Save psd/a881cec669b1741301e5a6dabea6f783 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22.3 | |
°C | |
not found | |
/(1) EBusRoot/(3) Zusatzmodul/(4) CIRCUIT 1/(119) /(3) 00:01 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from xml.etree import ElementTree as ET | |
ns = { | |
'env': "http://schemas.xmlsoap.org/soap/envelope/", | |
'ns': "http://ws01.lom.ch/soap/", | |
} | |
tree = ET.parse('test.xml') | |
value = tree.find('.//value', ns) | |
print(value.text) | |
unit = tree.find('.//unit', ns) | |
print(unit.text) | |
missing = tree.find('.//missing', ns) | |
if missing is None: | |
print("not found") | |
oid = tree.find('./env:Body/ns:getDpResponse/ref/oid', ns) | |
print(oid.text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns="http://ws01.lom.ch/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> | |
<SOAP-ENV:Body> | |
<ns:getDpResponse> | |
<ref> | |
<oid>/(1) EBusRoot/(3) Zusatzmodul/(4) CIRCUIT 1/(119) /(3) 00:01</oid> | |
<prop>-r--</prop> | |
</ref> | |
<dpCfg> | |
<index>3</index> | |
<name>00:01</name> | |
<prop>-r--</prop> | |
<desc>Scalar Var</desc> | |
<value>22.3</value> | |
<unit>°C</unit> | |
<type>13</type> | |
<step>0.1</step> | |
<minValue>0.0</minValue> | |
<maxValue>50.0</maxValue> | |
</dpCfg> | |
</ns:getDpResponse> | |
</SOAP-ENV:Body> | |
</SOAP-ENV:Envelope> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment