Skip to content

Conversation

kaburagisec
Copy link

@kaburagisec kaburagisec commented Sep 26, 2025

Summary

This PR enhances the Any.parse_xmlelements() method to improve the deserialization of <xsd:any> elements by using schema-based type resolution where available. When child elements are found, the method attempts to:

  • Look up each child element using the provided schema
  • Deserialize them into nested Python dictionaries keyed by tag name
  • Fall back to text content or the raw lxml Element if schema resolution fails

What Changed

  • Rewrote zeep.xsd.elements.Any.parse_xmlelements() to return structured dict instead of list of raw elements
  • Supports nested parsing of child elements
  • Improved docstring to match behavior

Why

Helps improve parsing of <xsd:any> blocks in extensible XML schemas. Common in many real-world SOAP APIs.

Backward Compatibility

  • Compatible with current Zeep API
  • Falls back safely if schema lookup fails

Related Issues

Let me know if you want me to add tests or make this opt-in via setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The "Extension" part at ONVIF wsdl is always parsed into a weird dict Garbage in nested datatypes Zeep returned empty array
1 participant