1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Classes related to XMLSchema facets.
17
18 The definitions herein are from sections U{4.2<http://www.w3.org/TR/xmlschema-2/index.html#rf-facets>}
19 and U{4.3<http://www.w3.org/TR/xmlschema-2/index.html#rf-facets>} of
20 U{XML Schema Part 2: Datatypes<http://www.w3.org/TR/xmlschema-2/>}.
21 Facets are attributes of a datatype that constrain its lexical and
22 value spaces.
23
24 """
25
26 import logging
27 import re
28 import decimal
29 import pyxb
30 from . import datatypes
31 from . import basis
32 from pyxb.utils import utility, six
33
34 _log = logging.getLogger(__name__)
35
36 -class Facet (pyxb.cscRoot):
37 """The base class for facets.
38
39 This provides association with STDs, a name, and a value for the facet.
40 """
41
42 _Name = None
43 @classmethod
45 """The name of a facet is a class constant."""
46 return self._Name
47
48 __baseTypeDefinition = None
50 """The SimpleTypeDefinition component restricted by this facet.
51
52 Note: this is NOT the STD to which the facet belongs, but is
53 usually that STD's base type. I.e., this jumps us through all
54 the containing restrictions and extensions to get to the core
55 type definition."""
56 return self.__baseTypeDefinition
57
58 __ownerTypeDefinition = None
60 """The SimpleTypeDefinition component to which this facet belongs.
61
62 I.e., the one in which the hasFacet specification was found.
63 This value is None if the facet is not associated with an
64 STD."""
65 return self.__ownerTypeDefinition
66
67
68
69
70 _ValueDatatype = None
71
72
73 __valueDatatype = None
75 """Get the datatype used to represent values of the facet.
76
77 This usually has nothing to do with the owner datatype; for
78 example, the length facet may apply to any STD but the value
79 of the facet is an integer. In generated bindings this is
80 usually set explicitly in the facet constructor; when
81 processing a schema, it is derived from the value's type
82 definition.
83 """
84 if self.__valueDatatype is None:
85 assert self.baseTypeDefinition() is not None
86 return self.baseTypeDefinition().pythonSupport()
87 return self.__valueDatatype
88
89 __value = None
92
93 __annotation = None
95
97 """Create a facet instance, initializing it from the keyword parameters."""
98 super(Facet, self).__init__(**kw)
99
100 assert Facet != self.__class__
101 self.setFromKeywords(_reset=True, _constructor=True, **kw)
102
104 """Configure values of the facet from a set of keywords.
105
106 This method is pre-extended; subclasses should invoke the
107 parent method after setting their local configuration.
108
109 @keyword _reset: If C{False} or missing, existing values will
110 be retained if they do not appear in the
111 keywords. If C{True}, members not defined in
112 the keywords are set to a default.
113 @keyword base_type_definition:
114 @keyword owner_type_definition:
115 @keyword value_datatype:
116 """
117
118 if not kw.get('_reset', False):
119 kw.setdefault('base_type_definition', self.__baseTypeDefinition)
120 kw.setdefault('owner_type_definition', self.__ownerTypeDefinition)
121 kw.setdefault('value_datatype', self.__valueDatatype)
122 self.__baseTypeDefinition = kw.get('base_type_definition')
123 self.__ownerTypeDefinition = kw.get('owner_type_definition')
124 self.__valueDatatype = kw.get('value_datatype', self._ValueDatatype)
125
126
127
128 assert (self.__valueDatatype is not None) or (self.__baseTypeDefinition is not None)
129 super_fn = getattr(super(Facet, self), '_setFromKeywords_vb', lambda *a,**kw: self)
130 return super_fn(**kw)
131
133 """Public entrypoint to the _setFromKeywords_vb call hierarchy."""
134 return self._setFromKeywords_vb(**kw)
135
136 @classmethod
138 """Given the name of a facet, return the Facet subclass that represents it."""
139 assert cls != Facet
140 if 0 <= name.find(':'):
141 name = name.split(':', 1)[1]
142 facet_class = globals().get('%s_%s' % (cls._FacetPrefix, name))
143 if facet_class is None:
144 raise pyxb.LogicError('Unrecognized facet name %s: expect %s' % (name, ','.join([_f._Name for _f in cls.Facets])))
145 assert facet_class is not None
146 return facet_class
147
158
165
167 """One of the facets defined in section 4.3, which provide
168 constraints on the lexical space of a type definition."""
169
170
171
172
173
174 _FacetPrefix = 'CF'
175
178
181
183 """Return True iff the given value satisfies the constraint represented by this facet instance.
184
185 The actual test is delegated to the subclasses."""
186 return self._validateConstraint_vx(value)
187
189 kwv = kw.get('value')
190 if kwv is not None:
191 vdt = self.valueDatatype()
192 if not isinstance(kwv, vdt):
193 kwv = vdt(kwv)
194 self._value(kwv)
195
197 """Extend base class.
198
199 Additional keywords:
200 * value
201 """
202
203 super_fn = getattr(super(ConstrainingFacet, self), '_setFromKeywords_vb', lambda *a,**kw: self)
204 rv = super_fn(**kw)
205 self.__setFromKeywords(**kw)
206 return rv
207
209 """Marker class to indicate that the facet instance must be told
210 its datatype when it is constructed.
211
212 This is necessary for facets like L{CF_minInclusive} and
213 L{CF_minExclusive}, for which the value is determined by the base
214 type definition of the associated STD. In some cases the value
215 that must be used in the facet cannot be represented in the Python
216 type used for the facet; see L{LateDatatypeBindsSuperclass}.
217 """
218
219 _LateDatatypeBindsSuperclass = None
220 """The class variable that indicates that the Subclasses must
221 override this variable with a value of C{True} or C{False}. The
222 value is C{True} iff the value used for the facet is not within
223 the value space of the corresponding value datatype; for example,
224 L{CF_minExclusive}."""
225
226
227 @classmethod
235
236 @classmethod
257
260
262 """Mix-in to a constraining facet that adds support for the 'fixed' property."""
263 __fixed = None
265
272
274 """Extend base class.
275
276 Additional keywords:
277 * fixed
278 """
279 self.__setFromKeywords(**kw)
280 super_fn = getattr(super(_Fixed_mixin, self), '_setFromKeywords_vb', lambda *a,**kw: self)
281 return super_fn(**kw)
282
284 """Mix-in to handle facets whose values are collections, not scalars.
285
286 For example, the enumeration and pattern facets maintain a list of
287 enumeration values and patterns, respectively, as their value
288 space.
289
290 Subclasses must define a class variable _CollectionFacet_itemType
291 which is a reference to a class that is used to construct members
292 of the collection.
293 """
294
295 __items = None
297 """Extend base class.
298
299 @keyword _constructor: If C{False} or absent, the object being
300 set is a member of the collection. If
301 C{True}, the object being set is the
302 collection itself.
303 """
304 if kw.get('_reset', False):
305 self.__items = []
306 if not kw.get('_constructor', False):
307 self.__items.append(self._CollectionFacet_itemType(facet_instance=self, **kw))
308 super_fn = getattr(super(_CollectionFacet_mixin, self), '_setFromKeywords_vb', lambda *a,**kw: self)
309 return super_fn(**kw)
310
312 """The members of the collection, as a reference."""
313 return self.__items
314
316 """The members of the collection, as a copy."""
317 return self.__items[:]
318
320 """The members of the collection as an iterator"""
321 return iter(self.__items)
322
323 -class CF_length (ConstrainingFacet, _Fixed_mixin):
334
336 """A facet that constrains the length of the lexical representation of a value.
337
338 See U{http://www.w3.org/TR/xmlschema-2/#rf-minLength}
339 """
340 _Name = 'minLength'
341 _ValueDatatype = datatypes.nonNegativeInteger
342
346
348 """A facet that constrains the length of the lexical representation of a value.
349
350 See U{http://www.w3.org/TR/xmlschema-2/#rf-minLength}
351 """
352 _Name = 'maxLength'
353 _ValueDatatype = datatypes.nonNegativeInteger
354
358
359 import pyxb.utils.xmlre
397
398 -class CF_pattern (ConstrainingFacet, _CollectionFacet_mixin):
399 """A facet that constrains the lexical representation of a value
400 to match one of a set of patterns.
401
402 See U{http://www.w3.org/TR/xmlschema-2/#rf-pattern}
403
404 @note: In PyXB, pattern constraints are ignored for any type with
405 a Python representation that does not derive from a string type.
406 This is due to the difficulty in reconstructing the lexical
407 representation of a non-string type after it has been converted to
408 its value space.
409
410 @todo: On creating new instances of non-string simple types from
411 string representations, we could apply pattern constraints. That
412 would mean checking them prior to invoking the Factory method.
413 """
414 _Name = 'pattern'
415 _CollectionFacet_itemType = _PatternElement
416 _ValueDatatype = datatypes.string
417
418 __patternElements = None
420
424
429
443
446 """This class represents individual values that appear within a
447 L{CF_enumeration} collection."""
448
449 __value = None
451 """The Python value that is used for equality testing
452 against this enumeration.
453
454 This is an instance of L{enumeration.valueDatatype()<CF_enumeration.valueDatatype>},
455 initialized from the unicodeValue."""
456 return self.__value
457
458 __tag = None
460 """The Python identifier used for the named constant representing
461 the enumeration value.
462
463 This should include any desired prefix, since it must be
464 unique within its binding class. If C{None}, no enumeration
465 constant will be generated."""
466 return self.__tag
468 """Set the tag to be used for this enumeration."""
469 self.__tag = tag
470
471 __enumeration = None
473 """A reference to the L{CF_enumeration} instance that owns this element."""
474 return self.__enumeration
475
476 __unicodeValue = None
478 """The unicode string that defines the enumeration value."""
479 return self.__unicodeValue
480
481 - def __init__ (self, enumeration=None, unicode_value=None,
482 description=None, annotation=None, tag=None,
483 **kw):
507
510
511 -class CF_enumeration (ConstrainingFacet, _CollectionFacet_mixin, _LateDatatype_mixin):
512 """Capture a constraint that restricts valid values to a fixed set.
513
514 A STD that has an enumeration restriction should mix-in
515 L{pyxb.binding.basis.enumeration_mixin}, and should have a class
516 variable titled C{_CF_enumeration} that is an instance of this
517 class.
518
519 "unicode" refers to the Unicode string by which the value is
520 represented in XML.
521
522 "tag" refers to the Python member reference associated with the
523 enumeration. The value is derived from the unicode value of the
524 enumeration element and an optional prefix that identifies the
525 owning simple type when the tag is promoted to module-level
526 visibility.
527
528 "value" refers to the Python value held in the tag
529
530 See U{http://www.w3.org/TR/xmlschema-2/#rf-enumeration}
531 """
532 _Name = 'enumeration'
533 _CollectionFacet_itemType = _EnumerationElement
534 _LateDatatypeBindsSuperclass = False
535
536 __tagToElement = None
537 __valueToElement = None
538 __unicodeToElement = None
539
540
541
542 __enumPrefix = None
543
550
553
555 """@deprecated: Use L{items} or L{iteritems} instead."""
556 return list(six.iteritems(self))
557
559 """Return a list of enumeration values."""
560 return [ _ee.value() for _ee in six.iteritems(self) ]
561
563 """Generate the enumeration values."""
564 for ee in six.iteritems(self):
565 yield ee.value()
566
581
583 """Return the L{_EnumerationElement} instance that has the given value.
584
585 @raise KeyError: the value is not valid for the enumeration."""
586 return self.__valueToElement[value]
587
589 """Return the enumeration value corresponding to the given unicode string.
590
591 If ustr is not a valid option for this enumeration, return None."""
592 rv = self.__unicodeToElement.get(ustr)
593 if rv is not None:
594 rv = rv.value()
595 return rv
596
598
599
600 if 0 == len(self._items()):
601 return True
602 for ee in six.iteritems(self):
603 if ee.value() == value:
604 return True
605 return False
606
608 """Marker class to indicate that the generated binding has enumeration members."""
609 @classmethod
612
614 """The enumeration used to constrain the whiteSpace facet"""
615 pass
616 _WhiteSpace_enum._CF_enumeration = CF_enumeration(value_datatype=_WhiteSpace_enum)
617 _WhiteSpace_enum.preserve = _WhiteSpace_enum._CF_enumeration.addEnumeration(unicode_value=six.u('preserve'), tag='preserve')
618 _WhiteSpace_enum.replace = _WhiteSpace_enum._CF_enumeration.addEnumeration(unicode_value=six.u('replace'), tag='replace')
619 _WhiteSpace_enum.collapse = _WhiteSpace_enum._CF_enumeration.addEnumeration(unicode_value=six.u('collapse'), tag='collapse')
620
621
622
623
624 _WhiteSpace_enum._InitializeFacetMap(_WhiteSpace_enum._CF_enumeration)
627 """Specify the value-space interpretation of whitespace.
628
629 See U{http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace}
630 """
631 _Name = 'whiteSpace'
632 _ValueDatatype = _WhiteSpace_enum
633
634 __TabCRLF_re = re.compile("[\t\n\r]")
635 __MultiSpace_re = re.compile(" +")
646
648 """No validation rules for whitespace facet."""
649 return True
650
651 -class CF_minInclusive (ConstrainingFacet, _Fixed_mixin, _LateDatatype_mixin):
652 """Specify the minimum legal value for the constrained type.
653
654 See U{http://www.w3.org/TR/xmlschema-2/#rf-minInclusive}
655 """
656 _Name = 'minInclusive'
657 _LateDatatypeBindsSuperclass = False
658
661
662
663 -class CF_maxInclusive (ConstrainingFacet, _Fixed_mixin, _LateDatatype_mixin):
664 """Specify the maximum legal value for the constrained type.
665
666 See U{http://www.w3.org/TR/xmlschema-2/#rf-maxInclusive}
667 """
668 _Name = 'maxInclusive'
669 _LateDatatypeBindsSuperclass = False
670
673
674 -class CF_minExclusive (ConstrainingFacet, _Fixed_mixin, _LateDatatype_mixin):
675 """Specify the exclusive lower bound of legal values for the constrained type.
676
677 See U{http://www.w3.org/TR/xmlschema-2/#rf-minExclusive}
678 """
679 _Name = 'minExclusive'
680 _LateDatatypeBindsSuperclass = True
681
684
685 -class CF_maxExclusive (ConstrainingFacet, _Fixed_mixin, _LateDatatype_mixin):
686 """Specify the exclusive upper bound of legal values for the constrained type.
687
688 See U{http://www.w3.org/TR/xmlschema-2/#rf-maxExclusive}
689 """
690 _Name = 'maxExclusive'
691 _LateDatatypeBindsSuperclass = True
692
695
697 """Specify the number of digits in the *value* space of the type.
698
699 See U{http://www.w3.org/TR/xmlschema-2/#rf-totalDigits}
700 """
701 _Name = 'totalDigits'
702 _ValueDatatype = datatypes.positiveInteger
703
705 if self.value() is None:
706 return True
707 if isinstance(value, datatypes.decimal):
708 (sign, digits, exponent) = value.normalize().as_tuple()
709 if len(digits) > self.value():
710 return False
711 if 0 > exponent:
712 return -exponent <= self.value()
713 return (exponent + len(digits)) <= self.value()
714 n = 0
715 scale = 1
716 match = False
717 v = None
718 while (n <= self.value()) and (not match):
719 v = six.long_type(value * scale)
720 match = ((value * scale) == v)
721 if self.value() == n:
722 break
723 n += 1
724 scale *= 10
725 while n < self.value():
726 n += 1
727 scale *= 10
728 return match and (v is not None) and (abs(v) < scale)
729
731 """Specify the number of sub-unit digits in the *value* space of the type.
732
733 See U{http://www.w3.org/TR/xmlschema-2/#rf-fractionDigits}
734 """
735 _Name = 'fractionDigits'
736 _ValueDatatype = datatypes.nonNegativeInteger
737
739 if self.value() is None:
740 return True
741 if isinstance(value, datatypes.decimal):
742 (sign, digits, exponent) = value.normalize().as_tuple()
743 return (0 <= exponent) or (-exponent <= self.value())
744 n = 0
745 scale = 1
746 while n <= self.value():
747 if ((value * scale) == six.long_type(value * scale)):
748 return True
749 n += 1
750 scale *= 10
751 return False
752
754 """A fundamental facet provides information on the value space of the associated type."""
755
756 _FacetPrefix = 'FF'
757
758 @classmethod
759 - def CreateFromDOM (cls, node, owner_type_definition, base_type_definition=None):
764
770
781
783 """Specifies that the associated type supports a notion of equality.
784
785 See U{http://www.w3.org/TR/xmlschema-2/#equal}
786 """
787
788 _Name = 'equal'
789
791 """Specifies that the associated type supports a notion of order.
792
793 See U{http://www.w3.org/TR/xmlschema-2/#rf-ordered}
794 """
795
796 _LegalValues = ( 'false', 'partial', 'total' )
797 _Name = 'ordered'
798 _ValueDatatype = datatypes.string
799
803
805 """Specifies that the associated type supports a notion of bounds.
806
807 See U{http://www.w3.org/TR/xmlschema-2/#rf-bounded}
808 """
809
810 _Name = 'bounded'
811 _ValueDatatype = datatypes.boolean
812
814 """Specifies that the associated type supports a notion of length.
815
816 See U{http://www.w3.org/TR/xmlschema-2/#rf-cardinality}
817 """
818
819 _LegalValues = ( 'finite', 'countably infinite' )
820 _Name = 'cardinality'
821 _ValueDatatype = datatypes.string
825
827 """Specifies that the associated type represents a number.
828
829 See U{http://www.w3.org/TR/xmlschema-2/#rf-numeric}
830 """
831
832 _Name = 'numeric'
833 _ValueDatatype = datatypes.boolean
834
835
836 ConstrainingFacet.Facets = [
837 CF_length, CF_minLength, CF_maxLength, CF_pattern, CF_enumeration,
838 CF_whiteSpace, CF_minInclusive, CF_maxInclusive, CF_minExclusive,
839 CF_maxExclusive, CF_totalDigits, CF_fractionDigits ]
840
841 FundamentalFacet.Facets = [
842 FF_equal, FF_ordered, FF_bounded, FF_cardinality, FF_numeric ]
843
844 Facet.Facets = []
845 Facet.Facets.extend(ConstrainingFacet.Facets)
846 Facet.Facets.extend(FundamentalFacet.Facets)
847
848
849
850 datatypes.ENTITIES._CF_pattern = CF_pattern()
851 datatypes.ENTITIES._CF_maxLength = CF_maxLength()
852 datatypes.ENTITIES._CF_enumeration = CF_enumeration(value_datatype=datatypes.ENTITIES)
853 datatypes.ENTITIES._CF_minLength = CF_minLength(value=datatypes.nonNegativeInteger(1))
854 datatypes.ENTITIES._CF_whiteSpace = CF_whiteSpace()
855 datatypes.ENTITIES._CF_length = CF_length()
856 datatypes.ENTITIES._InitializeFacetMap(datatypes.ENTITIES._CF_pattern,
857 datatypes.ENTITIES._CF_maxLength,
858 datatypes.ENTITIES._CF_enumeration,
859 datatypes.ENTITIES._CF_minLength,
860 datatypes.ENTITIES._CF_whiteSpace,
861 datatypes.ENTITIES._CF_length)
862 datatypes.ENTITY._InitializeFacetMap()
863 datatypes.ID._InitializeFacetMap()
864 datatypes.IDREF._InitializeFacetMap()
865 datatypes.IDREFS._CF_pattern = CF_pattern()
866 datatypes.IDREFS._CF_maxLength = CF_maxLength()
867 datatypes.IDREFS._CF_enumeration = CF_enumeration(value_datatype=datatypes.IDREFS)
868 datatypes.IDREFS._CF_minLength = CF_minLength(value=datatypes.nonNegativeInteger(1))
869 datatypes.IDREFS._CF_whiteSpace = CF_whiteSpace()
870 datatypes.IDREFS._CF_length = CF_length()
871 datatypes.IDREFS._InitializeFacetMap(datatypes.IDREFS._CF_pattern,
872 datatypes.IDREFS._CF_maxLength,
873 datatypes.IDREFS._CF_enumeration,
874 datatypes.IDREFS._CF_minLength,
875 datatypes.IDREFS._CF_whiteSpace,
876 datatypes.IDREFS._CF_length)
877 datatypes.NCName._CF_pattern = CF_pattern()
878 datatypes.NCName._CF_pattern.addPattern(pattern=six.u('[\\i-[:]][\\c-[:]]*'))
879 datatypes.NCName._InitializeFacetMap(datatypes.NCName._CF_pattern)
880 datatypes.NMTOKEN._CF_pattern = CF_pattern()
881 datatypes.NMTOKEN._CF_pattern.addPattern(pattern=six.u('\\c+'))
882 datatypes.NMTOKEN._InitializeFacetMap(datatypes.NMTOKEN._CF_pattern)
883 datatypes.NMTOKENS._CF_pattern = CF_pattern()
884 datatypes.NMTOKENS._CF_maxLength = CF_maxLength()
885 datatypes.NMTOKENS._CF_enumeration = CF_enumeration(value_datatype=datatypes.NMTOKENS)
886 datatypes.NMTOKENS._CF_minLength = CF_minLength(value=datatypes.nonNegativeInteger(1))
887 datatypes.NMTOKENS._CF_whiteSpace = CF_whiteSpace()
888 datatypes.NMTOKENS._CF_length = CF_length()
889 datatypes.NMTOKENS._InitializeFacetMap(datatypes.NMTOKENS._CF_pattern,
890 datatypes.NMTOKENS._CF_maxLength,
891 datatypes.NMTOKENS._CF_enumeration,
892 datatypes.NMTOKENS._CF_minLength,
893 datatypes.NMTOKENS._CF_whiteSpace,
894 datatypes.NMTOKENS._CF_length)
895 datatypes.NOTATION._CF_minLength = CF_minLength()
896 datatypes.NOTATION._CF_maxLength = CF_maxLength()
897 datatypes.NOTATION._CF_enumeration = CF_enumeration(value_datatype=datatypes.NOTATION)
898 datatypes.NOTATION._CF_pattern = CF_pattern()
899 datatypes.NOTATION._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
900 datatypes.NOTATION._CF_length = CF_length()
901 datatypes.NOTATION._InitializeFacetMap(datatypes.NOTATION._CF_minLength,
902 datatypes.NOTATION._CF_maxLength,
903 datatypes.NOTATION._CF_enumeration,
904 datatypes.NOTATION._CF_pattern,
905 datatypes.NOTATION._CF_whiteSpace,
906 datatypes.NOTATION._CF_length)
907 datatypes.Name._CF_pattern = CF_pattern()
908 datatypes.Name._CF_pattern.addPattern(pattern=six.u('\\i\\c*'))
909 datatypes.Name._InitializeFacetMap(datatypes.Name._CF_pattern)
910 datatypes.QName._CF_minLength = CF_minLength()
911 datatypes.QName._CF_maxLength = CF_maxLength()
912 datatypes.QName._CF_enumeration = CF_enumeration(value_datatype=datatypes.QName)
913 datatypes.QName._CF_pattern = CF_pattern()
914 datatypes.QName._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
915 datatypes.QName._CF_length = CF_length()
916 datatypes.QName._InitializeFacetMap(datatypes.QName._CF_minLength,
917 datatypes.QName._CF_maxLength,
918 datatypes.QName._CF_enumeration,
919 datatypes.QName._CF_pattern,
920 datatypes.QName._CF_whiteSpace,
921 datatypes.QName._CF_length)
922 datatypes.anyURI._CF_minLength = CF_minLength()
923 datatypes.anyURI._CF_maxLength = CF_maxLength()
924 datatypes.anyURI._CF_enumeration = CF_enumeration(value_datatype=datatypes.anyURI)
925 datatypes.anyURI._CF_pattern = CF_pattern()
926 datatypes.anyURI._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
927 datatypes.anyURI._CF_length = CF_length()
928 datatypes.anyURI._InitializeFacetMap(datatypes.anyURI._CF_minLength,
929 datatypes.anyURI._CF_maxLength,
930 datatypes.anyURI._CF_enumeration,
931 datatypes.anyURI._CF_pattern,
932 datatypes.anyURI._CF_whiteSpace,
933 datatypes.anyURI._CF_length)
934 datatypes.base64Binary._CF_minLength = CF_minLength()
935 datatypes.base64Binary._CF_maxLength = CF_maxLength()
936 datatypes.base64Binary._CF_enumeration = CF_enumeration(value_datatype=datatypes.base64Binary)
937 datatypes.base64Binary._CF_pattern = CF_pattern()
938 datatypes.base64Binary._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
939 datatypes.base64Binary._CF_length = CF_length()
940 datatypes.base64Binary._InitializeFacetMap(datatypes.base64Binary._CF_minLength,
941 datatypes.base64Binary._CF_maxLength,
942 datatypes.base64Binary._CF_enumeration,
943 datatypes.base64Binary._CF_pattern,
944 datatypes.base64Binary._CF_whiteSpace,
945 datatypes.base64Binary._CF_length)
946 datatypes.boolean._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
947 datatypes.boolean._CF_pattern = CF_pattern()
948 datatypes.boolean._InitializeFacetMap(datatypes.boolean._CF_whiteSpace,
949 datatypes.boolean._CF_pattern)
950 datatypes.byte._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.byte, value=datatypes.anySimpleType(six.u('-128')))
951 datatypes.byte._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.byte, value=datatypes.anySimpleType(six.u('127')))
952 datatypes.byte._InitializeFacetMap(datatypes.byte._CF_minInclusive,
953 datatypes.byte._CF_maxInclusive)
954 datatypes.date._CF_pattern = CF_pattern()
955 datatypes.date._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.date)
956 datatypes.date._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
957 datatypes.date._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
958 datatypes.date._CF_enumeration = CF_enumeration(value_datatype=datatypes.date)
959 datatypes.date._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
960 datatypes.date._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.date)
961 datatypes.date._InitializeFacetMap(datatypes.date._CF_pattern,
962 datatypes.date._CF_minInclusive,
963 datatypes.date._CF_maxExclusive,
964 datatypes.date._CF_minExclusive,
965 datatypes.date._CF_enumeration,
966 datatypes.date._CF_whiteSpace,
967 datatypes.date._CF_maxInclusive)
968 datatypes.dateTime._CF_pattern = CF_pattern()
969 datatypes.dateTime._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.dateTime)
970 datatypes.dateTime._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
971 datatypes.dateTime._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
972 datatypes.dateTime._CF_enumeration = CF_enumeration(value_datatype=datatypes.dateTime)
973 datatypes.dateTime._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
974 datatypes.dateTime._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.dateTime)
975 datatypes.dateTime._InitializeFacetMap(datatypes.dateTime._CF_pattern,
976 datatypes.dateTime._CF_minInclusive,
977 datatypes.dateTime._CF_maxExclusive,
978 datatypes.dateTime._CF_minExclusive,
979 datatypes.dateTime._CF_enumeration,
980 datatypes.dateTime._CF_whiteSpace,
981 datatypes.dateTime._CF_maxInclusive)
982 datatypes.decimal._CF_totalDigits = CF_totalDigits()
983 datatypes.decimal._CF_pattern = CF_pattern()
984 datatypes.decimal._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.decimal)
985 datatypes.decimal._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
986 datatypes.decimal._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
987 datatypes.decimal._CF_enumeration = CF_enumeration(value_datatype=datatypes.decimal)
988 datatypes.decimal._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
989 datatypes.decimal._CF_fractionDigits = CF_fractionDigits()
990 datatypes.decimal._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.decimal)
991 datatypes.decimal._InitializeFacetMap(datatypes.decimal._CF_totalDigits,
992 datatypes.decimal._CF_pattern,
993 datatypes.decimal._CF_minInclusive,
994 datatypes.decimal._CF_maxExclusive,
995 datatypes.decimal._CF_minExclusive,
996 datatypes.decimal._CF_enumeration,
997 datatypes.decimal._CF_whiteSpace,
998 datatypes.decimal._CF_fractionDigits,
999 datatypes.decimal._CF_maxInclusive)
1000 datatypes.double._CF_pattern = CF_pattern()
1001 datatypes.double._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.double)
1002 datatypes.double._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1003 datatypes.double._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1004 datatypes.double._CF_enumeration = CF_enumeration(value_datatype=datatypes.double)
1005 datatypes.double._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1006 datatypes.double._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.double)
1007 datatypes.double._InitializeFacetMap(datatypes.double._CF_pattern,
1008 datatypes.double._CF_minInclusive,
1009 datatypes.double._CF_maxExclusive,
1010 datatypes.double._CF_minExclusive,
1011 datatypes.double._CF_enumeration,
1012 datatypes.double._CF_whiteSpace,
1013 datatypes.double._CF_maxInclusive)
1014 datatypes.duration._CF_pattern = CF_pattern()
1015 datatypes.duration._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.duration)
1016 datatypes.duration._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1017 datatypes.duration._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1018 datatypes.duration._CF_enumeration = CF_enumeration(value_datatype=datatypes.duration)
1019 datatypes.duration._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1020 datatypes.duration._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.duration)
1021 datatypes.duration._InitializeFacetMap(datatypes.duration._CF_pattern,
1022 datatypes.duration._CF_minInclusive,
1023 datatypes.duration._CF_maxExclusive,
1024 datatypes.duration._CF_minExclusive,
1025 datatypes.duration._CF_enumeration,
1026 datatypes.duration._CF_whiteSpace,
1027 datatypes.duration._CF_maxInclusive)
1028 datatypes.float._CF_pattern = CF_pattern()
1029 datatypes.float._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.float)
1030 datatypes.float._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1031 datatypes.float._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1032 datatypes.float._CF_enumeration = CF_enumeration(value_datatype=datatypes.float)
1033 datatypes.float._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1034 datatypes.float._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.float)
1035 datatypes.float._InitializeFacetMap(datatypes.float._CF_pattern,
1036 datatypes.float._CF_minInclusive,
1037 datatypes.float._CF_maxExclusive,
1038 datatypes.float._CF_minExclusive,
1039 datatypes.float._CF_enumeration,
1040 datatypes.float._CF_whiteSpace,
1041 datatypes.float._CF_maxInclusive)
1042 datatypes.gDay._CF_pattern = CF_pattern()
1043 datatypes.gDay._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.gDay)
1044 datatypes.gDay._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1045 datatypes.gDay._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1046 datatypes.gDay._CF_enumeration = CF_enumeration(value_datatype=datatypes.gDay)
1047 datatypes.gDay._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1048 datatypes.gDay._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.gDay)
1049 datatypes.gDay._InitializeFacetMap(datatypes.gDay._CF_pattern,
1050 datatypes.gDay._CF_minInclusive,
1051 datatypes.gDay._CF_maxExclusive,
1052 datatypes.gDay._CF_minExclusive,
1053 datatypes.gDay._CF_enumeration,
1054 datatypes.gDay._CF_whiteSpace,
1055 datatypes.gDay._CF_maxInclusive)
1056 datatypes.gMonth._CF_pattern = CF_pattern()
1057 datatypes.gMonth._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.gMonth)
1058 datatypes.gMonth._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1059 datatypes.gMonth._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1060 datatypes.gMonth._CF_enumeration = CF_enumeration(value_datatype=datatypes.gMonth)
1061 datatypes.gMonth._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1062 datatypes.gMonth._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.gMonth)
1063 datatypes.gMonth._InitializeFacetMap(datatypes.gMonth._CF_pattern,
1064 datatypes.gMonth._CF_minInclusive,
1065 datatypes.gMonth._CF_maxExclusive,
1066 datatypes.gMonth._CF_minExclusive,
1067 datatypes.gMonth._CF_enumeration,
1068 datatypes.gMonth._CF_whiteSpace,
1069 datatypes.gMonth._CF_maxInclusive)
1070 datatypes.gMonthDay._CF_pattern = CF_pattern()
1071 datatypes.gMonthDay._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.gMonthDay)
1072 datatypes.gMonthDay._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1073 datatypes.gMonthDay._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1074 datatypes.gMonthDay._CF_enumeration = CF_enumeration(value_datatype=datatypes.gMonthDay)
1075 datatypes.gMonthDay._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1076 datatypes.gMonthDay._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.gMonthDay)
1077 datatypes.gMonthDay._InitializeFacetMap(datatypes.gMonthDay._CF_pattern,
1078 datatypes.gMonthDay._CF_minInclusive,
1079 datatypes.gMonthDay._CF_maxExclusive,
1080 datatypes.gMonthDay._CF_minExclusive,
1081 datatypes.gMonthDay._CF_enumeration,
1082 datatypes.gMonthDay._CF_whiteSpace,
1083 datatypes.gMonthDay._CF_maxInclusive)
1084 datatypes.gYear._CF_pattern = CF_pattern()
1085 datatypes.gYear._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.gYear)
1086 datatypes.gYear._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1087 datatypes.gYear._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1088 datatypes.gYear._CF_enumeration = CF_enumeration(value_datatype=datatypes.gYear)
1089 datatypes.gYear._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1090 datatypes.gYear._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.gYear)
1091 datatypes.gYear._InitializeFacetMap(datatypes.gYear._CF_pattern,
1092 datatypes.gYear._CF_minInclusive,
1093 datatypes.gYear._CF_maxExclusive,
1094 datatypes.gYear._CF_minExclusive,
1095 datatypes.gYear._CF_enumeration,
1096 datatypes.gYear._CF_whiteSpace,
1097 datatypes.gYear._CF_maxInclusive)
1098 datatypes.gYearMonth._CF_pattern = CF_pattern()
1099 datatypes.gYearMonth._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.gYearMonth)
1100 datatypes.gYearMonth._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1101 datatypes.gYearMonth._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1102 datatypes.gYearMonth._CF_enumeration = CF_enumeration(value_datatype=datatypes.gYearMonth)
1103 datatypes.gYearMonth._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1104 datatypes.gYearMonth._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.gYearMonth)
1105 datatypes.gYearMonth._InitializeFacetMap(datatypes.gYearMonth._CF_pattern,
1106 datatypes.gYearMonth._CF_minInclusive,
1107 datatypes.gYearMonth._CF_maxExclusive,
1108 datatypes.gYearMonth._CF_minExclusive,
1109 datatypes.gYearMonth._CF_enumeration,
1110 datatypes.gYearMonth._CF_whiteSpace,
1111 datatypes.gYearMonth._CF_maxInclusive)
1112 datatypes.hexBinary._CF_minLength = CF_minLength()
1113 datatypes.hexBinary._CF_maxLength = CF_maxLength()
1114 datatypes.hexBinary._CF_enumeration = CF_enumeration(value_datatype=datatypes.hexBinary)
1115 datatypes.hexBinary._CF_pattern = CF_pattern()
1116 datatypes.hexBinary._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1117 datatypes.hexBinary._CF_length = CF_length()
1118 datatypes.hexBinary._InitializeFacetMap(datatypes.hexBinary._CF_minLength,
1119 datatypes.hexBinary._CF_maxLength,
1120 datatypes.hexBinary._CF_enumeration,
1121 datatypes.hexBinary._CF_pattern,
1122 datatypes.hexBinary._CF_whiteSpace,
1123 datatypes.hexBinary._CF_length)
1124 datatypes.int._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.int, value=datatypes.anySimpleType(six.u('-2147483648')))
1125 datatypes.int._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.int, value=datatypes.anySimpleType(six.u('2147483647')))
1126 datatypes.int._InitializeFacetMap(datatypes.int._CF_minInclusive,
1127 datatypes.int._CF_maxInclusive)
1128 datatypes.integer._CF_pattern = CF_pattern()
1129 datatypes.integer._CF_pattern.addPattern(pattern=six.u('[\\-+]?[0-9]+'))
1130 datatypes.integer._CF_fractionDigits = CF_fractionDigits(value=datatypes.nonNegativeInteger(0))
1131 datatypes.integer._InitializeFacetMap(datatypes.integer._CF_pattern,
1132 datatypes.integer._CF_fractionDigits)
1133 datatypes.language._CF_pattern = CF_pattern()
1134 datatypes.language._CF_pattern.addPattern(pattern=six.u('[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*'))
1135 datatypes.language._InitializeFacetMap(datatypes.language._CF_pattern)
1136 datatypes.long._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.long, value=datatypes.anySimpleType(six.u('-9223372036854775808')))
1137 datatypes.long._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.long, value=datatypes.anySimpleType(six.u('9223372036854775807')))
1138 datatypes.long._InitializeFacetMap(datatypes.long._CF_minInclusive,
1139 datatypes.long._CF_maxInclusive)
1140 datatypes.negativeInteger._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.negativeInteger, value=datatypes.anySimpleType(six.u('-1')))
1141 datatypes.negativeInteger._InitializeFacetMap(datatypes.negativeInteger._CF_maxInclusive)
1142 datatypes.nonNegativeInteger._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.nonNegativeInteger, value=datatypes.anySimpleType(six.u('0')))
1143 datatypes.nonNegativeInteger._InitializeFacetMap(datatypes.nonNegativeInteger._CF_minInclusive)
1144 datatypes.nonPositiveInteger._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.nonPositiveInteger, value=datatypes.anySimpleType(six.u('0')))
1145 datatypes.nonPositiveInteger._InitializeFacetMap(datatypes.nonPositiveInteger._CF_maxInclusive)
1146 datatypes.normalizedString._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.replace)
1147 datatypes.normalizedString._InitializeFacetMap(datatypes.normalizedString._CF_whiteSpace)
1148 datatypes.positiveInteger._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.positiveInteger, value=datatypes.anySimpleType(six.u('1')))
1149 datatypes.positiveInteger._InitializeFacetMap(datatypes.positiveInteger._CF_minInclusive)
1150 datatypes.short._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.short, value=datatypes.anySimpleType(six.u('-32768')))
1151 datatypes.short._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.short, value=datatypes.anySimpleType(six.u('32767')))
1152 datatypes.short._InitializeFacetMap(datatypes.short._CF_minInclusive,
1153 datatypes.short._CF_maxInclusive)
1154 datatypes.string._CF_minLength = CF_minLength()
1155 datatypes.string._CF_maxLength = CF_maxLength()
1156 datatypes.string._CF_enumeration = CF_enumeration(value_datatype=datatypes.string)
1157 datatypes.string._CF_pattern = CF_pattern()
1158 datatypes.string._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.preserve)
1159 datatypes.string._CF_length = CF_length()
1160 datatypes.string._InitializeFacetMap(datatypes.string._CF_minLength,
1161 datatypes.string._CF_maxLength,
1162 datatypes.string._CF_enumeration,
1163 datatypes.string._CF_pattern,
1164 datatypes.string._CF_whiteSpace,
1165 datatypes.string._CF_length)
1166 datatypes.time._CF_pattern = CF_pattern()
1167 datatypes.time._CF_minInclusive = CF_minInclusive(value_datatype=datatypes.time)
1168 datatypes.time._CF_maxExclusive = CF_maxExclusive(value_datatype=datatypes.anySimpleType)
1169 datatypes.time._CF_minExclusive = CF_minExclusive(value_datatype=datatypes.anySimpleType)
1170 datatypes.time._CF_enumeration = CF_enumeration(value_datatype=datatypes.time)
1171 datatypes.time._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1172 datatypes.time._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.time)
1173 datatypes.time._InitializeFacetMap(datatypes.time._CF_pattern,
1174 datatypes.time._CF_minInclusive,
1175 datatypes.time._CF_maxExclusive,
1176 datatypes.time._CF_minExclusive,
1177 datatypes.time._CF_enumeration,
1178 datatypes.time._CF_whiteSpace,
1179 datatypes.time._CF_maxInclusive)
1180 datatypes.token._CF_whiteSpace = CF_whiteSpace(value=_WhiteSpace_enum.collapse)
1181 datatypes.token._InitializeFacetMap(datatypes.token._CF_whiteSpace)
1182 datatypes.unsignedByte._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.unsignedByte, value=datatypes.anySimpleType(six.u('255')))
1183 datatypes.unsignedByte._InitializeFacetMap(datatypes.unsignedByte._CF_maxInclusive)
1184 datatypes.unsignedInt._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.unsignedInt, value=datatypes.anySimpleType(six.u('4294967295')))
1185 datatypes.unsignedInt._InitializeFacetMap(datatypes.unsignedInt._CF_maxInclusive)
1186 datatypes.unsignedLong._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.unsignedLong, value=datatypes.anySimpleType(six.u('18446744073709551615')))
1187 datatypes.unsignedLong._InitializeFacetMap(datatypes.unsignedLong._CF_maxInclusive)
1188 datatypes.unsignedShort._CF_maxInclusive = CF_maxInclusive(value_datatype=datatypes.unsignedShort, value=datatypes.anySimpleType(six.u('65535')))
1189 datatypes.unsignedShort._InitializeFacetMap(datatypes.unsignedShort._CF_maxInclusive)
1190