Chapter 08: Simple types ======================== Example 8-1 Defining and referencing a named simple type -------------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0801.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0801.py :language: python Example 8-10 Restricting an enumeration --------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0810.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0810.py :language: python Example 8-11 Illegal attempt to extend an enumeration ----------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0811.xsd :language: xml :lines: 3- .. warning:: Illegal definition Example 8-12 Using a union to extend an enumeration --------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0812.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0812.py :language: python Example 8-13 Enumerating numeric values --------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example08131.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example08131.py :language: python Example 8-14 Applying the pattern facet --------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0814.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0814.py :language: python Example 8-15 Restricting a pattern ---------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0815.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0815.py :language: python Example 8-16 Illegal attempt to extend a pattern ------------------------------------------------ .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0816.xsd :language: xml :lines: 3- .. warning:: Should fail Example 8-17 Simple type assertion ---------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0817.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0817.py :language: python Example 8-18 Explicit time zone ------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0818.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0818.py :language: python Example 8-2 Defining an anonymous simple type --------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0802.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0802.py :language: python Example 8-21 Preventing type derivation --------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0821.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0821.py :language: python Example 8-22 Using an implementation-defined type ------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0822.xsd :language: xml :lines: 3- .. warning:: Unsupported feature! Example 8-23 Using the Saxon preprocess facet --------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0823.xsd :language: xml :lines: 3- .. warning:: XML Schema 1.1 Example 8-3 Deriving a simple type from a built-in simple type -------------------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0803.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0803.py :language: python Example 8-4 Deriving a simple type from a user-derived simple type ------------------------------------------------------------------ .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0804.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0804.py :language: python Example 8-5 Effective definition of MediumDressSizeType ------------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0805.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0805.py :language: python Example 8-6 Illegal attempt to extend a simple type --------------------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0806.xsd :language: xml :lines: 3- .. warning:: Should fail Example 8-7 Fixed facets ------------------------ .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0807.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0807.py :language: python Example 8-8 Union allowing an empty value ----------------------------------------- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0808.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0808.py :language: python Example 8-9 Applying the enumeration facet ------------------------------------------ .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0809.xsd :language: xml :lines: 3- .. literalinclude:: /../tests/fixtures/defxmlschema/chapter08/example0809.py :language: python .. admonition:: Samples Source :class: hint `Definitive XML Schema `_ by Priscilla Walmsley (c) 2012 Prentice Hall PTR