PyXB: Python XML Schema Bindings

时间:2024-05-31 15:35:14

http://pyxb.sourceforge.net/

PyXB (“pixbee”) is a pure Python package that generates Python source code for classes that correspond to data structures defined by XMLSchema. The generated classes support bi-directional conversion between XML documents and Python objects. In concept it is similar to JAXB for Java and CodeSynthesis XSD for C++. A Thirty Second Example is at the bottom of this page. Step-by-step examples are in User Reference.

Thirty Second Example

An example of a program using PyXB to interact with a web service [*] using an automatically-generated module. First, retrieve the WSDL and generate the bindings:

llc[566]$ pyxbgen \
--wsdl-location=http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL \
--module=weather \
--write-for-customization
Retrieving WSDL from http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL
WARNING:pyxb.binding.basis:Unable to convert DOM node {http://www.w3.org/2001/XMLSchema}schema at Weather.asmx?WSDL[4:4] to binding
PS urn:uuid:8292a36c-577f-11e4-b592-c8600024e903
WARNING:pyxb.binding.generate:Complex type {http://ws.cdyne.com/WeatherWS/}ArrayOfWeatherDescription renamed to ArrayOfWeatherDescription_
WARNING:pyxb.binding.generate:Complex type {http://ws.cdyne.com/WeatherWS/}ForecastReturn renamed to ForecastReturn_
WARNING:pyxb.binding.generate:Complex type {http://ws.cdyne.com/WeatherWS/}WeatherReturn renamed to WeatherReturn_
Python for http://ws.cdyne.com/WeatherWS/ requires 1 modules

xmlschema · PyPI
https://pypi.org/project/xmlschema/

xml - How to convert XSD to Python Class - Stack Overflow
https://*.com/questions/1072853/how-to-convert-xsd-to-python-class

Python 利用 XSD 文件,解析 XML 文件 - hchaoh的博客 - ****博客
https://blog.****.net/hchaoh/article/details/69390487