<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Component Model — PyXB v1.1.2 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '#', VERSION: '1.1.2', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="PyXB v1.1.2 documentation" href="index.html" /> <link rel="up" title="Architecture" href="architecture.html" /> <link rel="next" title="Binding Model" href="arch_binding.html" /> <link rel="prev" title="Namespaces" href="arch_namespaces.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="arch_binding.html" title="Binding Model" accesskey="N">next</a> |</li> <li class="right" > <a href="arch_namespaces.html" title="Namespaces" accesskey="P">previous</a> |</li> <li><a href="index.html">PyXB v1.1.2 documentation</a> »</li> <li><a href="architecture.html" accesskey="U">Architecture</a> »</li> <li style="margin-left: 20px">PyXB hosted on <a href="http://sourceforge.net/projects/pyxb"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=263147&type=9" width="80" height="15" alt="Get PyXB: Python XML Schema Bindings at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a></li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="component-model"> <span id="componentmodel"></span><h1>Component Model<a class="headerlink" href="#component-model" title="Permalink to this headline">¶</a></h1> <p>PyXB’s component model is the representation of XML schema components as a complex relation of data objects. Each object class corresponds to one of the thirteen <a class="reference external" href="www.w3.org/TR/xmlschema-1/index.html#components">XML Schema Components</a>, and names of components and their properties follow those definitions. All classes specific to the component model are found in the <a class="reference external" href="api/pyxb.xmlschema.structures-module.html">pyxb.xmlschema.structures</a> module.</p> <p>The relationships amongst components is depicted in the following diagram. Composite aggregation generally denotes ownership and shared aggregation reference, but don’t look for consistency.</p> <img alt="_images/ComponentModel.jpg" src="_images/ComponentModel.jpg" /> <div class="section" id="component-model-mix-ins"> <h2>Component Model Mix-ins<a class="headerlink" href="#component-model-mix-ins" title="Permalink to this headline">¶</a></h2> <p>A variety of <a class="reference external" href="maintref.html#mixins"><em>Mix-in classes</em></a> are used to allow common code to be abstracted or to mark objects as having certain capabilities. These mixins are:</p> <ul class="simple"> <li><a class="reference external" href="api/pyxb.xmlschema.structures._SchemaComponent_mixin-class.html">_SchemaComponent_mixin</a> marks the object as being a schema component and holds its <a class="reference external" href="api/pyxb.namespace-module.html#NamespaceContext">NamespaceContext</a>. It also records relations between components in a global definition and their clones where those definitions are expanded.</li> <li><a class="reference external" href="api/pyxb.xmlschema.structures._Singleton_mixin-class.html">_Singleton_mixin</a> is used to ensure there is only one instance each of the <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#simple-ur-type-itself">simple ur-type</a> and <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#ur-type-itself">ur-type</a>. It overloads <tt class="docutils literal"><span class="pre">__new__</span></tt> to ensure that only one instance of the class is ever constructed.</li> <li><a class="reference external" href="api/pyxb.xmlschema.structures._Annotated_mixin-class.html">_Annotated_mixin</a> provides the support for all components that contain an <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#cAnnotations">annotation</a> as a child element.</li> <li><a class="reference external" href="api/pyxb.xmlschema.structures._NamedComponent_mixin-class.html">_NamedComponent_mixin</a> supports components that can be identified by name. This includes the target namespace (which may be anonymous) if the component is global, and the <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions">complex type definition</a> that serves as the component’s <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#e-scope">scope</a> when it is local.</li> <li><a class="reference external" href="api/pyxb.xmlschema.structures._ValueConstraint_mixin-class.html">_ValueConstraint_mixin</a> provides support for components that have <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#e-value_constraint">value constraints</a> : that is, provide a default value and optionally require a fixed value.</li> <li><a class="reference external" href="api/pyxb.xmlschema.structures._ScopedDeclaration_mixin-class.html">_ScopedDeclaration_mixin</a> is used by <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#cElement_Declarations">element declarations</a> and <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions">complex type definitions</a> which may be named but only referenceable within a specific <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#e-scope">scope</a>.</li> <li><a class="reference external" href="api/pyxb.xmlschema.structures._AttributeWildcard_mixin-class.html">_AttributeWildcard_mixin</a> provides support for <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#cAttribute_Group_Definitions">attribute group definitions</a> and <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#Complex_Type_Definitions">complex type definitions</a>, both of which allow <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#Wildcards">wildcard</a> attributes.</li> </ul> </div> <div class="section" id="other-information"> <h2>Other Information<a class="headerlink" href="#other-information" title="Permalink to this headline">¶</a></h2> <p>Most of the important information about the component model is best obtained from the <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#components">specification</a> or from the <a class="reference external" href="api/pyxb.xmlschema.structures-module.html">PyXB component model API</a>. Tidbits of other relevant information:</p> <ul class="simple"> <li>An understanding of <a class="reference external" href="arch_namespaces.html#resolution"><em>Namespace Resolution</em></a> is important.</li> <li>Element and attribute declarations that are incorporated by reference are represented in local scope by a copy of the global declaration. This aids in the infrastructure that binds declarations from model and attribute groups to a specific context. Local declarations are associated only with the complex type in which they appear; types that extend or restrict that type refer to the declaration instance associated with the base type.</li> <li>PyXB strictly enforces the <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#cos-element-consistent">requirement</a> that multiple element declarations within a complex type be compatible with respect to type and other attributes. Since occurrence restrictions are associated with a <a class="reference external" href="http://www.w3.org/TR/xmlschema-1/#cParticle">Particle</a> instance rather than the declaration, the same element can appear in multiple places with different multiplicities. Note, though, that the default code generation module collapses all occurrences of any given element into a single Python field in the binding.</li> </ul> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference external" href="#">Component Model</a><ul> <li><a class="reference external" href="#component-model-mix-ins">Component Model Mix-ins</a></li> <li><a class="reference external" href="#other-information">Other Information</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="arch_namespaces.html" title="previous chapter">Namespaces</a></p> <h4>Next topic</h4> <p class="topless"><a href="arch_binding.html" title="next chapter">Binding Model</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/arch_component.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="arch_binding.html" title="Binding Model" >next</a> |</li> <li class="right" > <a href="arch_namespaces.html" title="Namespaces" >previous</a> |</li> <li><a href="index.html">PyXB v1.1.2 documentation</a> »</li> <li><a href="architecture.html" >Architecture</a> »</li> <li style="margin-left: 20px">PyXB hosted on <a href="http://sourceforge.net/projects/pyxb"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=263147&type=9" width="80" height="15" alt="Get PyXB: Python XML Schema Bindings at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a></li> </ul> </div> <div class="footer"> © Copyright 2009, Peter A. Bigot. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.5. </div> </body> </html>