Reading handshake into python works
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from generated.alpinebits import OtaPingRq, OtaPingRs
|
||||
from ..generated.alpinebits import OtaPingRq, OtaPingRs
|
||||
from xsdata_pydantic.bindings import XmlParser
|
||||
|
||||
|
||||
|
||||
@@ -6,15 +7,26 @@ from generated.alpinebits import OtaPingRq, OtaPingRs
|
||||
def main():
|
||||
# test parsing a ping request sample
|
||||
|
||||
path = "../../AlpineBits-HotelData-2024-10/files/samples/Handshake/Handshake-OTA_PingRQ.xml"
|
||||
path = "AlpineBits-HotelData-2024-10/files/samples/Handshake/Handshake-OTA_PingRQ.xml"
|
||||
|
||||
with open(
|
||||
path, "r", encoding="utf-8") as f:
|
||||
xml = f.read()
|
||||
|
||||
# Parse the XML into the request object
|
||||
request = OtaPingRq.from_xml(xml)
|
||||
print("Parsed OTA_PingRQ:", request)
|
||||
|
||||
# Test parsing back
|
||||
|
||||
|
||||
parser = XmlParser()
|
||||
|
||||
|
||||
|
||||
parsed_result = parser.from_string(xml, OtaPingRq)
|
||||
|
||||
print(parsed_result.echo_data)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
||||
Reference in New Issue
Block a user