<!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 1.2.6 documentation</title> <link rel="stylesheet" href="_static/classic.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.2.6', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '.txt' }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="Binding Model" href="arch_binding.html" /> <link rel="prev" title="Namespaces" href="arch_namespaces.html" /> </head> <body role="document"> <div class="related" role="navigation" aria-label="related navigation"> <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="py-modindex.html" title="Python Module Index" >modules</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 class="nav-item nav-item-0"><a href="index.html">PyXB 1.2.6 documentation</a> »</li> <li class="nav-item nav-item-1"><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" role="main"> <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 internal" href="pyxb.xmlschema.html#module-pyxb.xmlschema.structures" title="pyxb.xmlschema.structures"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures</span></code></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 internal" href="maintref.html#mixins"><span class="std std-ref">Mix-in classes</span></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 internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._SchemaComponent_mixin" title="pyxb.xmlschema.structures._SchemaComponent_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._SchemaComponent_mixin</span></code></a> marks the object as being a schema component and holds its <code class="xref py py-obj docutils literal"><span class="pre">pyxb.namespace.NamespaceContext</span></code>. It also records relations between components in a global definition and their clones where those definitions are expanded.</li> <li><a class="reference internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._Singleton_mixin" title="pyxb.xmlschema.structures._Singleton_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._Singleton_mixin</span></code></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 <code class="docutils literal"><span class="pre">__new__</span></code> to ensure that only one instance of the class is ever constructed.</li> <li><a class="reference internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._Annotated_mixin" title="pyxb.xmlschema.structures._Annotated_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._Annotated_mixin</span></code></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 internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._NamedComponent_mixin" title="pyxb.xmlschema.structures._NamedComponent_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._NamedComponent_mixin</span></code></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 internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._ValueConstraint_mixin" title="pyxb.xmlschema.structures._ValueConstraint_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._ValueConstraint_mixin</span></code></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 internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._ScopedDeclaration_mixin" title="pyxb.xmlschema.structures._ScopedDeclaration_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._ScopedDeclaration_mixin</span></code></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 internal" href="pyxb.xmlschema.html#pyxb.xmlschema.structures._AttributeWildcard_mixin" title="pyxb.xmlschema.structures._AttributeWildcard_mixin"><code class="xref py py-obj docutils literal"><span class="pre">pyxb.xmlschema.structures._AttributeWildcard_mixin</span></code></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 internal" href="pyxb.xmlschema.html#module-pyxb.xmlschema.structures" title="pyxb.xmlschema.structures"><code class="xref py py-obj docutils literal"><span class="pre">PyXB</span> <span class="pre">component</span> <span class="pre">model</span> <span class="pre">API</span></code></a>. Tidbits of other relevant information:</p> <ul class="simple"> <li>An understanding of <a class="reference internal" href="arch_namespaces.html#resolution"><span class="std std-ref">Namespace Resolution</span></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" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Component Model</a><ul> <li><a class="reference internal" href="#component-model-mix-ins">Component Model Mix-ins</a></li> <li><a class="reference internal" 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> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/arch_component.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <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="py-modindex.html" title="Python Module Index" >modules</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 class="nav-item nav-item-0"><a href="index.html">PyXB 1.2.6 documentation</a> »</li> <li class="nav-item nav-item-1"><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" role="contentinfo"> © Copyright 2009-2017, Peter A. Bigot. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.5. </div> </body> </html>