summaryrefslogtreecommitdiff
path: root/doc/index.txt
blob: 77676b2bdd2433b3160f81c983a47bba1e16c8e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.. PyXB documentation master file

.. Sphinx standard indentations
   # with overline, for parts
   * with overline, for chapters
   =, for sections
   -, for subsections
   ^, for subsubsections
   ", for paragraphs

.. role:: namespace(literal)

################################
PyXB: Python XML Schema Bindings
################################

PyXB ("pixbee") is a pure `Python <http://www.python.org>`_ package that
generates Python source code for classes that correspond to data structures
defined by `XMLSchema <http://www.w3.org/XML/Schema>`_.  The generated classes
support bi-directional conversion between `XML <http://www.w3.org/XML/>`_
documents and Python instances.  In concept it is similar to `JAXB
<http://en.wikipedia.org/wiki/JAXB>`_ for Java and `CodeSynthesis XSD
<http://www.codesynthesis.com/products/xsd/>`_ for C++.  A
:ref:`thirty_sec_example` is at the bottom of this page.

Getting Help
============

PyXB is distributed on `SourceForge <http://sourceforge.net/projects/pyxb>`_.

For support, consult the `Help Forum
<https://sourceforge.net/forum/forum.php?forum_id=956708>`_, or subscribe to
and email the `mailing list
<https://sourceforge.net/mailarchive/forum.php?forum_name=pyxb-users>`_.

To file a bug report or see the status of defects reported against the current
release, visit the `Trac database <http://sourceforge.net/apps/trac/pyxb/>`_.

For a history of releases, see :ref:`releases`.

********
Contents
********
.. toctree::
   :maxdepth: 2

   overview
   examples
   releases
   architecture
   userref/index
   maintref

.. _thirty_sec_example:

*********************
Thirty Second Example
*********************

An example of a program using PyXB to interact with a `web service
<http://wiki.cdyne.com/wiki/index.php?title=CDYNE_Weather>`_ using an
automatically-generated module.  First, retrieve the WSDL and generate the
bindings::

 vmfed9[23]$ pyxbgen \
   --wsdl-location="http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl" --module=weather \
   --write-for-customization
 urn:uuid:769983dc-8ecb-11de-b7e5-000c292f797c
 Retrieving WSDL from http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl
 Importing pyxb.binding.datatypes to get binding for wildcard {http://www.w3.org/2001/XMLSchema}schema
 NOTE: Created unbound wildcard element from DOM node {http://www.w3.org/2001/XMLSchema}schema
 PS urn:uuid:769983dc-8ecb-11de-b7e5-000c292f797c
 Python for http://ws.cdyne.com/WeatherWS/ requires 1 modules
 Saved binding source to ./raw/weather.py

Then write a program that uses them:

.. literalinclude:: ../examples/weather/client_get.py

And run it::

 vmfed9[64]$ python client_get.py 
 Weather forecast for Tucson, AZ:
  Saturday, August 22 2009: Thunder Storms, from 80 to 90
  Sunday, August 23 2009: Partly Cloudy, from 78 to 92
  Monday, August 24 2009: Partly Cloudy, from 75 to 95
  Tuesday, August 25 2009: Partly Cloudy, from 75 to 96
  Wednesday, August 26 2009: Partly Cloudy, from 76 to 99
  Thursday, August 27 2009: Sunny, from 77 to 99
  Friday, August 28 2009: Sunny, from 77 to 100
 vmfed9[65]$ 

That's it.

******************
Indices and tables
******************

* :ref:`genindex`
* :ref:`search`

.. ignored
   ## Local Variables:
   ## fill-column:78
   ## indent-tabs-mode:nil
   ## End: