diff --git a/classes/element.registry.php b/classes/element.registry.php
new file mode 100644
index 00000000..d161dd99
--- /dev/null
+++ b/classes/element.registry.php
@@ -0,0 +1,49 @@
+ [
+ 'all' => '\SimpleSAML\XMLSchema\XML\xs\All',
+ 'annotation' => '\SimpleSAML\XMLSchema\XML\xs\Annotation',
+ 'any' => '\SimpleSAML\XMLSchema\XML\xs\Any',
+ 'anyAttribute' => '\SimpleSAML\XMLSchema\XML\xs\AnyAttribute',
+ 'appinfo' => '\SimpleSAML\XMLSchema\XML\xs\Appinfo',
+ 'attribute' => '\SimpleSAML\XMLSchema\XML\xs\TopLevelAttribute',
+ 'attributeGroup' => '\SimpleSAML\XMLSchema\XML\xs\NamedAttributeGroup',
+ 'choice' => '\SimpleSAML\XMLSchema\XML\xs\Choice',
+ 'complexContent' => '\SimpleSAML\XMLSchema\XML\xs\ComplexContent',
+ 'complexType' => '\SimpleSAML\XMLSchema\XML\xs\TopLevelComplexType',
+ 'documentation' => '\SimpleSAML\XMLSchema\XML\xs\Documentation',
+ 'element' => '\SimpleSAML\XMLSchema\XML\xs\TopLevelElement',
+ 'enumeration' => '\SimpleSAML\XMLSchema\XML\xs\Enumeration',
+ 'field' => '\SimpleSAML\XMLSchema\XML\xs\Field',
+ 'fractionDigits' => '\SimpleSAML\XMLSchema\XML\xs\FractionDigits',
+ 'group' => '\SimpleSAML\XMLSchema\XML\xs\NamedGroup',
+ 'import' => '\SimpleSAML\XMLSchema\XML\xs\Import',
+ 'include' => '\SimpleSAML\XMLSchema\XML\xs\XsInclude',
+ 'key' => '\SimpleSAML\XMLSchema\XML\xs\Key',
+ 'keyref' => '\SimpleSAML\XMLSchema\XML\xs\Keyref',
+ 'length' => '\SimpleSAML\XMLSchema\XML\xs\Length',
+ 'list' => '\SimpleSAML\XMLSchema\XML\xs\XsList',
+ 'maxExclusive' => '\SimpleSAML\XMLSchema\XML\xs\MaxExclusive',
+ 'maxInclusive' => '\SimpleSAML\XMLSchema\XML\xs\MaxInclusive',
+ 'maxLength' => '\SimpleSAML\XMLSchema\XML\xs\MaxLength',
+ 'minExclusive' => '\SimpleSAML\XMLSchema\XML\xs\MinExclusive',
+ 'minInclusive' => '\SimpleSAML\XMLSchema\XML\xs\MinInclusive',
+ 'minLength' => '\SimpleSAML\XMLSchema\XML\xs\MinLength',
+ 'notation' => '\SimpleSAML\XMLSchema\XML\xs\Notation',
+ 'pattern' => '\SimpleSAML\XMLSchema\XML\xs\Pattern',
+ 'redefine' => '\SimpleSAML\XMLSchema\XML\xs\Redefine',
+ 'restriction' => '\SimpleSAML\XMLSchema\XML\xs\Restriction',
+ 'schema' => '\SimpleSAML\XMLSchema\XML\xs\Schema',
+ 'selector' => '\SimpleSAML\XMLSchema\XML\xs\Selector',
+ 'sequence' => '\SimpleSAML\XMLSchema\XML\xs\Sequence',
+ 'simpleContent' => '\SimpleSAML\XMLSchema\XML\xs\SimpleContent',
+ 'simpleType' => '\SimpleSAML\XMLSchema\XML\xs\TopLevelSimpleType',
+ 'totalDigits' => '\SimpleSAML\XMLSchema\XML\xs\TotalDigits',
+ 'union' => '\SimpleSAML\XMLSchema\XML\xs\Union',
+ 'unique' => '\SimpleSAML\XMLSchema\XML\xs\Unique',
+ 'whiteSpace' => '\SimpleSAML\XMLSchema\XML\xs\WhiteSpace',
+ ],
+];
diff --git a/composer.json b/composer.json
index c24f3cff..710d23b8 100644
--- a/composer.json
+++ b/composer.json
@@ -17,12 +17,14 @@
],
"autoload": {
"psr-4": {
- "SimpleSAML\\XML\\": "src/"
+ "SimpleSAML\\XMLSchema\\": "src/XMLSchema",
+ "SimpleSAML\\XML\\": "src/XML"
}
},
"autoload-dev": {
"psr-4": {
- "SimpleSAML\\Test\\XML\\": ["tests/XML", "tests/Utils"]
+ "SimpleSAML\\Test\\XML\\": ["tests/XML", "tests/Utils"],
+ "SimpleSAML\\Test\\XMLSchema\\": ["tests/XMLSchema"]
}
},
"require": {
diff --git a/resources/schemas/XMLSchema.xsd b/resources/schemas/XMLSchema.xsd
new file mode 100644
index 00000000..f0c9505f
--- /dev/null
+++ b/resources/schemas/XMLSchema.xsd
@@ -0,0 +1,2534 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]>
+
+
+
+ Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp
+ Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp
+
+
+
+
+
+ The schema corresponding to this document is normative,
+ with respect to the syntactic constraints it expresses in the
+ XML Schema language. The documentation (within <documentation> elements)
+ below, is not normative, but rather highlights important aspects of
+ the W3C Recommendation of which this is a part
+
+
+
+
+ The simpleType element and all of its members are defined
+ towards the end of this schema document
+
+
+
+
+
+ Get access to the xml: attribute groups for xml:lang
+ as declared on 'schema' and 'documentation' below
+
+
+
+
+
+
+
+ This type is extended by almost all schema types
+ to allow attributes from other namespaces to be
+ added to user schemas.
+
+
+
+
+
+
+
+
+
+
+
+
+ This type is extended by all types which allow annotation
+ other than <schema> itself
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This group is for the
+ elements which occur freely at the top level of schemas.
+ All of their types are based on the "annotated" type by extension.
+
+
+
+
+
+
+
+
+
+
+
+
+ This group is for the
+ elements which can self-redefine (see <redefine> below).
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ #all or (possibly empty) subset of {extension, restriction}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ #all or (possibly empty) subset of {extension, restriction, list, union}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ for maxOccurs
+
+
+
+
+
+
+
+
+
+
+
+ for all particles
+
+
+
+
+
+
+ for element, group and attributeGroup,
+ which both define and reference
+
+
+
+
+
+
+
+ 'complexType' uses this
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This branch is short for
+ <complexContent>
+ <restriction base="xs:anyType">
+ ...
+ </restriction>
+ </complexContent>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Will be restricted to required or forbidden
+
+
+
+
+
+ Not allowed if simpleContent child is chosen.
+ May be overriden by setting on complexContent child.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This choice is added simply to
+ make this a valid restriction per the REC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Overrides any setting on complexType parent.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This choice is added simply to
+ make this a valid restriction per the REC
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No typeDefParticle group reference
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ #all or (possibly empty) subset of {substitution, extension,
+ restriction}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The element element can be used either
+ at the top level to define an element-type binding globally,
+ or within a content model to either reference a globally-defined
+ element or type or declare an element-type binding locally.
+ The ref form is not allowed at the top level.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group type for explicit groups, named top-level groups and
+ group references
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ group type for the three kinds of group
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This choice with min/max is here to
+ avoid a pblm with the Elt:All/Choice/Seq
+ Particle derivation constraint
+
+
+
+
+
+
+
+
+
+ restricted max/min
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Only elements allowed inside
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ simple type for the value of the 'namespace' attr of
+ 'any' and 'anyAttribute'
+
+
+
+ Value is
+ ##any - - any non-conflicting WFXML/attribute at all
+
+ ##other - - any non-conflicting WFXML/attribute from
+ namespace other than targetNS
+
+ ##local - - any unqualified non-conflicting WFXML/attribute
+
+ one or - - any non-conflicting WFXML/attribute from
+ more URI the listed namespaces
+ references
+ (space separated)
+
+ ##targetNamespace or ##local may appear in the above list, to
+ refer to the targetNamespace of the enclosing
+ schema or an absent targetNamespace respectively
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A subset of XPath expressions for use
+in selectors
+ A utility type, not for public
+use
+
+
+
+ The following pattern is intended to allow XPath
+ expressions per the following EBNF:
+ Selector ::= Path ( '|' Path )*
+ Path ::= ('.//')? Step ( '/' Step )*
+ Step ::= '.' | NameTest
+ NameTest ::= QName | '*' | NCName ':' '*'
+ child:: is also allowed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A subset of XPath expressions for use
+in fields
+ A utility type, not for public
+use
+
+
+
+ The following pattern is intended to allow XPath
+ expressions per the same EBNF as for selector,
+ with the following change:
+ Path ::= ('.//')? ( Step '/' )* ( Step | '@' NameTest )
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ The three kinds of identity constraints, all with
+ type of or derived from 'keybase'.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+ A public identifier, per ISO 8879
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ notations for use within XML Schema schemas
+
+
+
+
+
+
+
+
+ Not the real urType, but as close an approximation as we can
+ get in the XML representation
+
+
+
+
+
+
+
+
+
+ First the built-in primitive datatypes. These definitions are for
+ information only, the real built-in definitions are magic.
+
+
+
+ For each built-in datatype in this schema (both primitive and
+ derived) can be uniquely addressed via a URI constructed
+ as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype
+
+ For example, to address the int datatype, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int
+
+ Additionally, each facet definition element can be uniquely
+ addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the facet
+
+ For example, to address the maxInclusive facet, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#maxInclusive
+
+ Additionally, each facet usage in a built-in datatype definition
+ can be uniquely addressed via a URI constructed as follows:
+ 1) the base URI is the URI of the XML Schema namespace
+ 2) the fragment identifier is the name of the datatype, followed
+ by a period (".") followed by the name of the facet
+
+ For example, to address the usage of the maxInclusive facet in
+ the definition of int, the URI is:
+
+ http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ NOTATION cannot be used directly in a schema; rather a type
+ must be derived from it by specifying at least one enumeration
+ facet whose value is the name of a NOTATION declared in the
+ schema.
+
+
+
+
+
+
+
+
+
+ Now the derived primitive types
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern specifies the content of section 2.12 of XML 1.0e2
+ and RFC 3066 (Revised version of RFC 1766).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern matches production 7 from the XML spec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern matches production 5 from the XML spec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pattern matches production 4 from the Namespaces in XML spec
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #all or (possibly empty) subset of {restriction, union, list}
+
+
+ A utility type, not for public use
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Can be restricted to required or forbidden
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Required at the top level
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Forbidden when nested
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ We should use a substitution group for facets, but
+ that's ruled out because it would allow users to
+ add their own, which we're not ready for yet.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ base attribute and simpleType child are mutually
+ exclusive, but one or other is required
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ itemType attribute and simpleType child are mutually
+ exclusive, but one or other is required
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ memberTypes attribute must be non-empty or there must be
+ at least one simpleType child
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/schemas/saml-schema-assertion-2.0.xsd b/resources/schemas/saml-schema-assertion-2.0.xsd
new file mode 100644
index 00000000..2b2f7b80
--- /dev/null
+++ b/resources/schemas/saml-schema-assertion-2.0.xsd
@@ -0,0 +1,283 @@
+
+
+
+
+
+
+ Document identifier: saml-schema-assertion-2.0
+ Location: http://docs.oasis-open.org/security/saml/v2.0/
+ Revision history:
+ V1.0 (November, 2002):
+ Initial Standard Schema.
+ V1.1 (September, 2003):
+ Updates within the same V1.0 namespace.
+ V2.0 (March, 2005):
+ New assertion schema for SAML V2.0 namespace.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/schemas/saml-schema-metadata-2.0.xsd b/resources/schemas/saml-schema-metadata-2.0.xsd
new file mode 100644
index 00000000..b656d4f4
--- /dev/null
+++ b/resources/schemas/saml-schema-metadata-2.0.xsd
@@ -0,0 +1,337 @@
+
+
+
+
+
+
+
+
+ Document identifier: saml-schema-metadata-2.0
+ Location: http://docs.oasis-open.org/security/saml/v2.0/
+ Revision history:
+ V2.0 (March, 2005):
+ Schema for SAML metadata, first published in SAML 2.0.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/schemas/saml-schema-protocol-2.0.xsd b/resources/schemas/saml-schema-protocol-2.0.xsd
new file mode 100644
index 00000000..7fa6f489
--- /dev/null
+++ b/resources/schemas/saml-schema-protocol-2.0.xsd
@@ -0,0 +1,302 @@
+
+
+
+
+
+
+ Document identifier: saml-schema-protocol-2.0
+ Location: http://docs.oasis-open.org/security/saml/v2.0/
+ Revision history:
+ V1.0 (November, 2002):
+ Initial Standard Schema.
+ V1.1 (September, 2003):
+ Updates within the same V1.0 namespace.
+ V2.0 (March, 2005):
+ New protocol schema based in a SAML V2.0 namespace.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/schemas/soap-envelope-1.1.xsd b/resources/schemas/soap-envelope-1.1.xsd
new file mode 100644
index 00000000..b1a20e08
--- /dev/null
+++ b/resources/schemas/soap-envelope-1.1.xsd
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Prose in the spec does not specify that attributes are allowed on the Body element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'encodingStyle' indicates any canonicalization conventions followed in the contents of the containing element. For example, the value 'http://schemas.xmlsoap.org/soap/encoding/' indicates the pattern described in SOAP specification
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Fault reporting structure
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/schemas/xenc-schema.xsd b/resources/schemas/xenc-schema.xsd
new file mode 100644
index 00000000..02e06858
--- /dev/null
+++ b/resources/schemas/xenc-schema.xsd
@@ -0,0 +1,184 @@
+
+
+
+
+
+
+
+
+ ]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/schemas/xmldsig-core-schema.xsd b/resources/schemas/xmldsig-core-schema.xsd
new file mode 100644
index 00000000..df126b30
--- /dev/null
+++ b/resources/schemas/xmldsig-core-schema.xsd
@@ -0,0 +1,318 @@
+
+
+
+
+
+ ]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Type/StringValue.php b/src/Type/StringValue.php
deleted file mode 100644
index 2b3d9f79..00000000
--- a/src/Type/StringValue.php
+++ /dev/null
@@ -1,14 +0,0 @@
- $type The type of the attribute value.
* @return T
*
- * @throws \SimpleSAML\XML\Exception\MissingAttributeException if the attribute is missing from the element
+ * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException if the attribute is missing from the element
*/
public static function getAttribute(
DOMElement $xml,
@@ -86,13 +87,13 @@ public static function getAttribute(
/**
* Get the value of an attribute from a given element.
*
- * @template T of \SimpleSAML\XML\Type\ValueTypeInterface
+ * @template T of \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param class-string $type The type of the attribute value.
- * @param \SimpleSAML\XML\Type\ValueTypeInterface|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface|null $default
* The default to return in case the attribute does not exist and it is optional.
- * @return ($default is \SimpleSAML\XML\Type\ValueTypeInterface ? T : T|null)
+ * @return ($default is \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface ? T : T|null)
*/
public static function getOptionalAttribute(
DOMElement $xml,
diff --git a/src/ArrayizableElementInterface.php b/src/XML/ArrayizableElementInterface.php
similarity index 100%
rename from src/ArrayizableElementInterface.php
rename to src/XML/ArrayizableElementInterface.php
diff --git a/src/Assert/AnyURITrait.php b/src/XML/Assert/AnyURITrait.php
similarity index 100%
rename from src/Assert/AnyURITrait.php
rename to src/XML/Assert/AnyURITrait.php
diff --git a/src/Assert/Assert.php b/src/XML/Assert/Assert.php
similarity index 100%
rename from src/Assert/Assert.php
rename to src/XML/Assert/Assert.php
diff --git a/src/Assert/Base64BinaryTrait.php b/src/XML/Assert/Base64BinaryTrait.php
similarity index 100%
rename from src/Assert/Base64BinaryTrait.php
rename to src/XML/Assert/Base64BinaryTrait.php
diff --git a/src/Assert/BooleanTrait.php b/src/XML/Assert/BooleanTrait.php
similarity index 100%
rename from src/Assert/BooleanTrait.php
rename to src/XML/Assert/BooleanTrait.php
diff --git a/src/Assert/ByteTrait.php b/src/XML/Assert/ByteTrait.php
similarity index 100%
rename from src/Assert/ByteTrait.php
rename to src/XML/Assert/ByteTrait.php
diff --git a/src/Assert/DateTimeTrait.php b/src/XML/Assert/DateTimeTrait.php
similarity index 100%
rename from src/Assert/DateTimeTrait.php
rename to src/XML/Assert/DateTimeTrait.php
diff --git a/src/Assert/DateTrait.php b/src/XML/Assert/DateTrait.php
similarity index 100%
rename from src/Assert/DateTrait.php
rename to src/XML/Assert/DateTrait.php
diff --git a/src/Assert/DayTrait.php b/src/XML/Assert/DayTrait.php
similarity index 100%
rename from src/Assert/DayTrait.php
rename to src/XML/Assert/DayTrait.php
diff --git a/src/Assert/DecimalTrait.php b/src/XML/Assert/DecimalTrait.php
similarity index 100%
rename from src/Assert/DecimalTrait.php
rename to src/XML/Assert/DecimalTrait.php
diff --git a/src/Assert/DoubleTrait.php b/src/XML/Assert/DoubleTrait.php
similarity index 100%
rename from src/Assert/DoubleTrait.php
rename to src/XML/Assert/DoubleTrait.php
diff --git a/src/Assert/DurationTrait.php b/src/XML/Assert/DurationTrait.php
similarity index 100%
rename from src/Assert/DurationTrait.php
rename to src/XML/Assert/DurationTrait.php
diff --git a/src/Assert/EntitiesTrait.php b/src/XML/Assert/EntitiesTrait.php
similarity index 100%
rename from src/Assert/EntitiesTrait.php
rename to src/XML/Assert/EntitiesTrait.php
diff --git a/src/Assert/EntityTrait.php b/src/XML/Assert/EntityTrait.php
similarity index 100%
rename from src/Assert/EntityTrait.php
rename to src/XML/Assert/EntityTrait.php
diff --git a/src/Assert/FloatTrait.php b/src/XML/Assert/FloatTrait.php
similarity index 100%
rename from src/Assert/FloatTrait.php
rename to src/XML/Assert/FloatTrait.php
diff --git a/src/Assert/HexBinaryTrait.php b/src/XML/Assert/HexBinaryTrait.php
similarity index 100%
rename from src/Assert/HexBinaryTrait.php
rename to src/XML/Assert/HexBinaryTrait.php
diff --git a/src/Assert/IDRefTrait.php b/src/XML/Assert/IDRefTrait.php
similarity index 100%
rename from src/Assert/IDRefTrait.php
rename to src/XML/Assert/IDRefTrait.php
diff --git a/src/Assert/IDRefsTrait.php b/src/XML/Assert/IDRefsTrait.php
similarity index 100%
rename from src/Assert/IDRefsTrait.php
rename to src/XML/Assert/IDRefsTrait.php
diff --git a/src/Assert/IDTrait.php b/src/XML/Assert/IDTrait.php
similarity index 100%
rename from src/Assert/IDTrait.php
rename to src/XML/Assert/IDTrait.php
diff --git a/src/Assert/IntTrait.php b/src/XML/Assert/IntTrait.php
similarity index 100%
rename from src/Assert/IntTrait.php
rename to src/XML/Assert/IntTrait.php
diff --git a/src/Assert/IntegerTrait.php b/src/XML/Assert/IntegerTrait.php
similarity index 100%
rename from src/Assert/IntegerTrait.php
rename to src/XML/Assert/IntegerTrait.php
diff --git a/src/Assert/LanguageTrait.php b/src/XML/Assert/LanguageTrait.php
similarity index 100%
rename from src/Assert/LanguageTrait.php
rename to src/XML/Assert/LanguageTrait.php
diff --git a/src/Assert/LongTrait.php b/src/XML/Assert/LongTrait.php
similarity index 100%
rename from src/Assert/LongTrait.php
rename to src/XML/Assert/LongTrait.php
diff --git a/src/Assert/MonthTrait.php b/src/XML/Assert/MonthTrait.php
similarity index 100%
rename from src/Assert/MonthTrait.php
rename to src/XML/Assert/MonthTrait.php
diff --git a/src/Assert/NCNameTrait.php b/src/XML/Assert/NCNameTrait.php
similarity index 100%
rename from src/Assert/NCNameTrait.php
rename to src/XML/Assert/NCNameTrait.php
diff --git a/src/Assert/NMTokenTrait.php b/src/XML/Assert/NMTokenTrait.php
similarity index 100%
rename from src/Assert/NMTokenTrait.php
rename to src/XML/Assert/NMTokenTrait.php
diff --git a/src/Assert/NMTokensTrait.php b/src/XML/Assert/NMTokensTrait.php
similarity index 100%
rename from src/Assert/NMTokensTrait.php
rename to src/XML/Assert/NMTokensTrait.php
diff --git a/src/Assert/NameTrait.php b/src/XML/Assert/NameTrait.php
similarity index 100%
rename from src/Assert/NameTrait.php
rename to src/XML/Assert/NameTrait.php
diff --git a/src/Assert/NegativeIntegerTrait.php b/src/XML/Assert/NegativeIntegerTrait.php
similarity index 100%
rename from src/Assert/NegativeIntegerTrait.php
rename to src/XML/Assert/NegativeIntegerTrait.php
diff --git a/src/Assert/NonNegativeIntegerTrait.php b/src/XML/Assert/NonNegativeIntegerTrait.php
similarity index 100%
rename from src/Assert/NonNegativeIntegerTrait.php
rename to src/XML/Assert/NonNegativeIntegerTrait.php
diff --git a/src/Assert/NonPositiveIntegerTrait.php b/src/XML/Assert/NonPositiveIntegerTrait.php
similarity index 100%
rename from src/Assert/NonPositiveIntegerTrait.php
rename to src/XML/Assert/NonPositiveIntegerTrait.php
diff --git a/src/Assert/NormalizedStringTrait.php b/src/XML/Assert/NormalizedStringTrait.php
similarity index 100%
rename from src/Assert/NormalizedStringTrait.php
rename to src/XML/Assert/NormalizedStringTrait.php
diff --git a/src/Assert/PositiveIntegerTrait.php b/src/XML/Assert/PositiveIntegerTrait.php
similarity index 100%
rename from src/Assert/PositiveIntegerTrait.php
rename to src/XML/Assert/PositiveIntegerTrait.php
diff --git a/src/Assert/QNameTrait.php b/src/XML/Assert/QNameTrait.php
similarity index 100%
rename from src/Assert/QNameTrait.php
rename to src/XML/Assert/QNameTrait.php
diff --git a/src/Assert/ShortTrait.php b/src/XML/Assert/ShortTrait.php
similarity index 100%
rename from src/Assert/ShortTrait.php
rename to src/XML/Assert/ShortTrait.php
diff --git a/src/Assert/StringTrait.php b/src/XML/Assert/StringTrait.php
similarity index 100%
rename from src/Assert/StringTrait.php
rename to src/XML/Assert/StringTrait.php
diff --git a/src/Assert/TimeTrait.php b/src/XML/Assert/TimeTrait.php
similarity index 100%
rename from src/Assert/TimeTrait.php
rename to src/XML/Assert/TimeTrait.php
diff --git a/src/Assert/TokenTrait.php b/src/XML/Assert/TokenTrait.php
similarity index 100%
rename from src/Assert/TokenTrait.php
rename to src/XML/Assert/TokenTrait.php
diff --git a/src/Assert/UnsignedByteTrait.php b/src/XML/Assert/UnsignedByteTrait.php
similarity index 100%
rename from src/Assert/UnsignedByteTrait.php
rename to src/XML/Assert/UnsignedByteTrait.php
diff --git a/src/Assert/UnsignedIntTrait.php b/src/XML/Assert/UnsignedIntTrait.php
similarity index 100%
rename from src/Assert/UnsignedIntTrait.php
rename to src/XML/Assert/UnsignedIntTrait.php
diff --git a/src/Assert/UnsignedLongTrait.php b/src/XML/Assert/UnsignedLongTrait.php
similarity index 100%
rename from src/Assert/UnsignedLongTrait.php
rename to src/XML/Assert/UnsignedLongTrait.php
diff --git a/src/Assert/UnsignedShortTrait.php b/src/XML/Assert/UnsignedShortTrait.php
similarity index 100%
rename from src/Assert/UnsignedShortTrait.php
rename to src/XML/Assert/UnsignedShortTrait.php
diff --git a/src/Assert/XPathFilterTrait.php b/src/XML/Assert/XPathFilterTrait.php
similarity index 98%
rename from src/Assert/XPathFilterTrait.php
rename to src/XML/Assert/XPathFilterTrait.php
index 59dc2305..934ce2f1 100644
--- a/src/Assert/XPathFilterTrait.php
+++ b/src/XML/Assert/XPathFilterTrait.php
@@ -5,7 +5,7 @@
namespace SimpleSAML\XML\Assert;
use InvalidArgumentException;
-use SimpleSAML\Assert\Assert as BaseAssert;
+use SimpleSAML\XML\Assert\Assert as BaseAssert;
use SimpleSAML\XML\Constants as C;
use SimpleSAML\XML\Exception\RuntimeException;
use SimpleSAML\XML\Utils\XPathFilter;
diff --git a/src/Assert/YearMonthTrait.php b/src/XML/Assert/YearMonthTrait.php
similarity index 100%
rename from src/Assert/YearMonthTrait.php
rename to src/XML/Assert/YearMonthTrait.php
diff --git a/src/Assert/YearTrait.php b/src/XML/Assert/YearTrait.php
similarity index 100%
rename from src/Assert/YearTrait.php
rename to src/XML/Assert/YearTrait.php
diff --git a/src/Attribute.php b/src/XML/Attribute.php
similarity index 93%
rename from src/Attribute.php
rename to src/XML/Attribute.php
index ef542d9e..00a5dd9c 100644
--- a/src/Attribute.php
+++ b/src/XML/Attribute.php
@@ -7,7 +7,8 @@
use DOMAttr;
use DOMElement;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Type\{StringValue, ValueTypeInterface};
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
+use SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface;
use function array_keys;
use function strval;
@@ -25,7 +26,7 @@ final class Attribute implements ArrayizableElementInterface
* @param string|null $namespaceURI
* @param string|null $namespacePrefix
* @param string $attrName
- * @param \SimpleSAML\XML\Type\ValueTypeInterface $attrValue
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface $attrValue
*/
public function __construct(
protected ?string $namespaceURI,
@@ -77,7 +78,7 @@ public function getAttrName(): string
/**
* Collect the value of the value-property
*
- * @return \SimpleSAML\XML\Type\ValueTypeInterface
+ * @return \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
*/
public function getAttrValue(): ValueTypeInterface
{
@@ -133,7 +134,7 @@ public function toXML(DOMElement $parent): DOMElement
* namespaceURI: string,
* namespacePrefix: string|null,
* attrName: string,
- * attrValue: \SimpleSAML\XML\Type\ValueTypeInterface,
+ * attrValue: \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface,
* } $data
* @return static
*/
@@ -174,7 +175,7 @@ private static function processArrayContents(array $data): array
Assert::nullOrValidAnyURI($data['namespaceuri']);
Assert::nullOrValidNCName($data['namespaceprefix']);
Assert::nullOrValidNCName($data['attrname']);
-// Assert::isAOf($data['attrvalue'], ValueTypeInterface::class);
+ Assert::string($data['attrvalue']);
return [
'namespaceURI' => $data['namespaceuri'],
diff --git a/src/Chunk.php b/src/XML/Chunk.php
similarity index 90%
rename from src/Chunk.php
rename to src/XML/Chunk.php
index 58610c4f..5d1a6e65 100644
--- a/src/Chunk.php
+++ b/src/XML/Chunk.php
@@ -7,9 +7,10 @@
use DOMElement;
use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\DOMDocumentFactory;
-use SimpleSAML\XML\Exception\{MissingAttributeException, SchemaViolationException};
use SimpleSAML\XML\SerializableElementTrait;
-use SimpleSAML\XML\Type\{StringValue, ValueTypeInterface};
+use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, SchemaViolationException};
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
+use SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface;
/**
* Serializable class used to hold an XML element.
@@ -158,13 +159,13 @@ public function getQualifiedName(): string
/**
* Get the value of an attribute from a given element.
*
- * @template T of \SimpleSAML\XML\Type\ValueTypeInterface
+ * @template T of \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param class-string $type The type of the attribute value.
* @return T
*
- * @throws \SimpleSAML\XML\Exception\MissingAttributeException if the attribute is missing from the element
+ * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException if the attribute is missing from the element
*/
public static function getAttribute(
DOMElement $xml,
@@ -187,13 +188,13 @@ public static function getAttribute(
/**
* Get the value of an attribute from a given element.
*
- * @template T of \SimpleSAML\XML\Type\ValueTypeInterface
+ * @template T of \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param class-string $type The type of the attribute value.
- * @param \SimpleSAML\XML\Type\ValueTypeInterface|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface|null $default
* The default to return in case the attribute does not exist and it is optional.
- * @return ($default is \SimpleSAML\XML\Type\ValueTypeInterface ? T : T|null)
+ * @return ($default is \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface ? T : T|null)
*/
public static function getOptionalAttribute(
DOMElement $xml,
diff --git a/src/Constants.php b/src/XML/Constants.php
similarity index 100%
rename from src/Constants.php
rename to src/XML/Constants.php
diff --git a/src/DOMDocumentFactory.php b/src/XML/DOMDocumentFactory.php
similarity index 98%
rename from src/DOMDocumentFactory.php
rename to src/XML/DOMDocumentFactory.php
index a1f2a040..2e7e8251 100644
--- a/src/DOMDocumentFactory.php
+++ b/src/XML/DOMDocumentFactory.php
@@ -5,7 +5,7 @@
namespace SimpleSAML\XML;
use DOMDocument;
-use SimpleSAML\Assert\Assert;
+use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Exception\{IOException, RuntimeException, UnparseableXMLException};
use function file_get_contents;
diff --git a/src/ElementInterface.php b/src/XML/ElementInterface.php
similarity index 76%
rename from src/ElementInterface.php
rename to src/XML/ElementInterface.php
index cf736e78..872bfe85 100644
--- a/src/ElementInterface.php
+++ b/src/XML/ElementInterface.php
@@ -5,7 +5,8 @@
namespace SimpleSAML\XML;
use DOMElement;
-use SimpleSAML\XML\Type\{StringValue, ValueTypeInterface};
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
+use SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface;
/**
* interface class to be implemented by all the classes that represent an XML element
@@ -28,9 +29,9 @@ public function getQualifiedName(): string;
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param string $type The type of the attribute value
- * @return \SimpleSAML\XML\Type\ValueTypeInterface
+ * @return \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
*
- * @throws \SimpleSAML\XML\Exception\MissingAttributeException if the attribute is missing from the element
+ * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException if the attribute is missing from the element
*/
public static function getAttribute(
DOMElement $xml,
@@ -45,9 +46,9 @@ public static function getAttribute(
* @param \DOMElement $xml The element where we should search for the attribute.
* @param string $name The name of the attribute.
* @param string $type The type of the attribute value
- * @param \SimpleSAML\XML\Type\ValueTypeInterface|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface|null $default
* The default to return in case the attribute does not exist and it is optional.
- * @return \SimpleSAML\XML\Type\ValueTypeInterface|null
+ * @return \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface|null
*/
public static function getOptionalAttribute(
DOMElement $xml,
diff --git a/src/Exception/IOException.php b/src/XML/Exception/IOException.php
similarity index 100%
rename from src/Exception/IOException.php
rename to src/XML/Exception/IOException.php
diff --git a/src/Exception/RuntimeException.php b/src/XML/Exception/RuntimeException.php
similarity index 100%
rename from src/Exception/RuntimeException.php
rename to src/XML/Exception/RuntimeException.php
diff --git a/src/Exception/UnparseableXMLException.php b/src/XML/Exception/UnparseableXMLException.php
similarity index 100%
rename from src/Exception/UnparseableXMLException.php
rename to src/XML/Exception/UnparseableXMLException.php
diff --git a/src/ExtendableAttributesTrait.php b/src/XML/ExtendableAttributesTrait.php
similarity index 80%
rename from src/ExtendableAttributesTrait.php
rename to src/XML/ExtendableAttributesTrait.php
index c4e96043..40e4eff3 100644
--- a/src/ExtendableAttributesTrait.php
+++ b/src/XML/ExtendableAttributesTrait.php
@@ -6,11 +6,11 @@
use DOMElement;
use RuntimeException;
-use SimpleSAML\Assert\Assert;
+use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Attribute;
use SimpleSAML\XML\Constants as C;
-use SimpleSAML\XML\Type\StringValue;
-use SimpleSAML\XML\XsNamespace as NS;
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
+use SimpleSAML\XMLSchema\XML\xs\NamespaceEnum;
use function array_diff;
use function array_map;
@@ -90,12 +90,18 @@ public function getAttributesNS(): array
* NOTE: In case the namespace is ##any, this method will also return local non-namespaced attributes!
*
* @param \DOMElement $xml
- * @param \SimpleSAML\XML\XsNamespace|array|null $namespace
+ * @param (
+ * \SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|
+ * array<\SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|string>|
+ * null
+ * ) $namespace
*
* @return array $attributes
*/
- protected static function getAttributesNSFromXML(DOMElement $xml, NS|array|null $namespace = null): array
- {
+ protected static function getAttributesNSFromXML(
+ DOMElement $xml,
+ NamespaceEnum|array|null $namespace = null,
+ ): array {
$namespace = $namespace ?? self::XS_ANY_ATTR_NAMESPACE;
$exclusionList = self::getAttributeExclusions();
$attributes = [];
@@ -103,16 +109,16 @@ protected static function getAttributesNSFromXML(DOMElement $xml, NS|array|null
// Validate namespace value
if (!is_array($namespace)) {
// Must be one of the predefined values
- Assert::oneOf($namespace, NS::cases());
+ Assert::oneOf($namespace, NamespaceEnum::cases());
foreach ($xml->attributes as $a) {
if (in_array([$a->namespaceURI, $a->localName], $exclusionList, true)) {
continue;
- } elseif ($namespace === NS::OTHER && in_array($a->namespaceURI, [self::NS, null], true)) {
+ } elseif ($namespace === NamespaceEnum::Other && in_array($a->namespaceURI, [self::NS, null], true)) {
continue;
- } elseif ($namespace === NS::TARGET && $a->namespaceURI !== self::NS) {
+ } elseif ($namespace === NamespaceEnum::TargetNamespace && $a->namespaceURI !== self::NS) {
continue;
- } elseif ($namespace === NS::LOCAL && $a->namespaceURI !== null) {
+ } elseif ($namespace === NamespaceEnum::Local && $a->namespaceURI !== null) {
continue;
}
@@ -127,16 +133,16 @@ protected static function getAttributesNSFromXML(DOMElement $xml, NS|array|null
// Array must be non-empty and cannot contain ##any or ##other
Assert::notEmpty($namespace);
Assert::allStringNotEmpty($namespace);
- Assert::allNotSame($namespace, NS::ANY);
- Assert::allNotSame($namespace, NS::OTHER);
+ Assert::allNotSame($namespace, NamespaceEnum::Any);
+ Assert::allNotSame($namespace, NamespaceEnum::Other);
// Replace the ##targetedNamespace with the actual namespace
- if (($key = array_search(NS::TARGET, $namespace)) !== false) {
+ if (($key = array_search(NamespaceEnum::TargetNamespace, $namespace)) !== false) {
$namespace[$key] = self::NS;
}
// Replace the ##local with null
- if (($key = array_search(NS::LOCAL, $namespace)) !== false) {
+ if (($key = array_search(NamespaceEnum::Local, $namespace)) !== false) {
$namespace[$key] = null;
}
@@ -177,12 +183,12 @@ protected function setAttributesNS(array $attributes): void
// Validate namespace value
if (!is_array($namespace)) {
// Must be one of the predefined values
- Assert::oneOf($namespace, NS::cases());
+ Assert::oneOf($namespace, NamespaceEnum::cases());
} else {
// Array must be non-empty and cannot contain ##any or ##other
Assert::notEmpty($namespace);
- Assert::allNotSame($namespace, NS::ANY);
- Assert::allNotSame($namespace, NS::OTHER);
+ Assert::allNotSame($namespace, NamespaceEnum::Any);
+ Assert::allNotSame($namespace, NamespaceEnum::Other);
}
// Get namespaces for all attributes
@@ -197,7 +203,7 @@ function (Attribute $attr) {
$attributes,
);
- if ($namespace === NS::LOCAL) {
+ if ($namespace === NamespaceEnum::Local) {
// If ##local then all namespaces must be null
Assert::allNull($actual_namespaces);
} elseif (is_array($namespace)) {
@@ -205,12 +211,12 @@ function (Attribute $attr) {
$allowed_namespaces = $namespace;
// Replace the ##targetedNamespace with the actual namespace
- if (($key = array_search(NS::TARGET, $allowed_namespaces)) !== false) {
+ if (($key = array_search(NamespaceEnum::TargetNamespace, $allowed_namespaces)) !== false) {
$allowed_namespaces[$key] = self::NS;
}
// Replace the ##local with null
- if (($key = array_search(NS::LOCAL, $allowed_namespaces)) !== false) {
+ if (($key = array_search(NamespaceEnum::Local, $allowed_namespaces)) !== false) {
$allowed_namespaces[$key] = null;
}
@@ -224,13 +230,13 @@ function (Attribute $attr) {
),
);
} else {
- if ($namespace === NS::OTHER) {
+ if ($namespace === NamespaceEnum::Other) {
// All attributes must be namespaced, ergo non-null
Assert::allNotNull($actual_namespaces);
// Must be any namespace other than the parent element
Assert::allNotSame($actual_namespaces, self::NS);
- } elseif ($namespace === NS::TARGET) {
+ } elseif ($namespace === NamespaceEnum::TargetNamespace) {
// Must be the same namespace as the one of the parent element
Assert::allSame($actual_namespaces, self::NS);
}
@@ -249,9 +255,9 @@ function (Attribute $attr) {
/**
- * @return array|\SimpleSAML\XML\XsNamespace
+ * @return array<\SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|string>|\SimpleSAML\XMLSchema\XML\xs\NamespaceEnum
*/
- public function getAttributeNamespace(): array|NS
+ public function getAttributeNamespace(): array|NamespaceEnum
{
Assert::true(
defined('self::XS_ANY_ATTR_NAMESPACE'),
@@ -267,7 +273,7 @@ public function getAttributeNamespace(): array|NS
/**
* Get the exclusions list for getAttributeNSFromXML.
*
- * @return array
+ * @return array{array{string|null, string}}|array{}
*/
public static function getAttributeExclusions(): array
{
diff --git a/src/ExtendableElementTrait.php b/src/XML/ExtendableElementTrait.php
similarity index 75%
rename from src/ExtendableElementTrait.php
rename to src/XML/ExtendableElementTrait.php
index 3e5c84b0..72dfcf1f 100644
--- a/src/ExtendableElementTrait.php
+++ b/src/XML/ExtendableElementTrait.php
@@ -6,11 +6,11 @@
use DOMElement;
use RuntimeException;
-use SimpleSAML\Assert\Assert;
+use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Chunk;
use SimpleSAML\XML\Constants as C;
use SimpleSAML\XML\Registry\ElementRegistry;
-use SimpleSAML\XML\XsNamespace as NS;
+use SimpleSAML\XMLSchema\XML\xs\NamespaceEnum;
use function array_diff;
use function array_map;
@@ -38,12 +38,18 @@ trait ExtendableElementTrait
* NOTE: In case the namespace is ##any, this method will also return local non-namespaced elements!
*
* @param \DOMElement $xml
- * @param \SimpleSAML\XML\XsNamespace|array|null $namespace
+ * @param (
+ * \SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|
+ * array<\SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|string>|
+ * null
+ * ) $namespace
*
* @return list<\SimpleSAML\XML\SerializableElementInterface> $elements
*/
- protected static function getChildElementsFromXML(DOMElement $xml, NS|array|null $namespace = null): array
- {
+ protected static function getChildElementsFromXML(
+ DOMElement $xml,
+ NamespaceEnum|array|null $namespace = null,
+ ): array {
$namespace = $namespace ?? self::XS_ANY_ELT_NAMESPACE;
$exclusionList = self::getElementExclusions();
$registry = ElementRegistry::getInstance();
@@ -52,18 +58,18 @@ protected static function getChildElementsFromXML(DOMElement $xml, NS|array|null
// Validate namespace value
if (!is_array($namespace)) {
// Must be one of the predefined values
- Assert::oneOf($namespace, NS::cases());
+ Assert::oneOf($namespace, NamespaceEnum::cases());
foreach ($xml->childNodes as $elt) {
if (!($elt instanceof DOMElement)) {
continue;
} elseif (in_array([$elt->namespaceURI, $elt->localName], $exclusionList, true)) {
continue;
- } elseif ($namespace === NS::OTHER && in_array($elt->namespaceURI, [self::NS, null], true)) {
+ } elseif ($namespace === NamespaceEnum::Other && in_array($elt->namespaceURI, [self::NS, null], true)) {
continue;
- } elseif ($namespace === NS::TARGET && $elt->namespaceURI !== self::NS) {
+ } elseif ($namespace === NamespaceEnum::TargetNamespace && $elt->namespaceURI !== self::NS) {
continue;
- } elseif ($namespace === NS::LOCAL && $elt->namespaceURI !== null) {
+ } elseif ($namespace === NamespaceEnum::Local && $elt->namespaceURI !== null) {
continue;
}
@@ -74,16 +80,16 @@ protected static function getChildElementsFromXML(DOMElement $xml, NS|array|null
// Array must be non-empty and cannot contain ##any or ##other
Assert::notEmpty($namespace);
Assert::allStringNotEmpty($namespace);
- Assert::allNotSame($namespace, NS::ANY);
- Assert::allNotSame($namespace, NS::OTHER);
+ Assert::allNotSame($namespace, NamespaceEnum::Any);
+ Assert::allNotSame($namespace, NamespaceEnum::Other);
// Replace the ##targetedNamespace with the actual namespace
- if (($key = array_search(NS::TARGET, $namespace)) !== false) {
+ if (($key = array_search(NamespaceEnum::TargetNamespace, $namespace)) !== false) {
$namespace[$key] = self::NS;
}
// Replace the ##local with null
- if (($key = array_search(NS::LOCAL, $namespace)) !== false) {
+ if (($key = array_search(NamespaceEnum::Local, $namespace)) !== false) {
$namespace[$key] = null;
}
@@ -115,32 +121,32 @@ protected function setElements(array $elements): void
{
Assert::maxCount($elements, C::UNBOUNDED_LIMIT);
Assert::allIsInstanceOf($elements, SerializableElementInterface::class);
- $namespace = $this->getElementNamespace();
+ $namespace = $this->getElementNamespace();
// Validate namespace value
if (!is_array($namespace)) {
// Must be one of the predefined values
- Assert::oneOf($namespace, NS::cases());
+ Assert::oneOf($namespace, NamespaceEnum::cases());
} else {
// Array must be non-empty and cannot contain ##any or ##other
Assert::notEmpty($namespace);
- Assert::allNotSame($namespace, NS::ANY);
- Assert::allNotSame($namespace, NS::OTHER);
+ Assert::allNotSame($namespace, NamespaceEnum::Any);
+ Assert::allNotSame($namespace, NamespaceEnum::Other);
}
// Get namespaces for all elements
+ /** @var array<\SimpleSAML\XML\AbstractElement|\SimpleSAML\XML\Chunk> $elements */
$actual_namespaces = array_map(
/**
- * @param \SimpleSAML\XML\SerializableElementInterface $elt
* @return string|null
*/
- function (SerializableElementInterface $elt) {
+ function (AbstractElement|Chunk $elt): ?string {
return ($elt instanceof Chunk) ? $elt->getNamespaceURI() : $elt::getNamespaceURI();
},
$elements,
);
- if ($namespace === NS::LOCAL) {
+ if ($namespace === NamespaceEnum::Local) {
// If ##local then all namespaces must be null
Assert::allNull($actual_namespaces);
} elseif (is_array($namespace)) {
@@ -148,12 +154,12 @@ function (SerializableElementInterface $elt) {
$allowed_namespaces = $namespace;
// Replace the ##targetedNamespace with the actual namespace
- if (($key = array_search(NS::TARGET, $allowed_namespaces)) !== false) {
+ if (($key = array_search(NamespaceEnum::TargetNamespace, $allowed_namespaces)) !== false) {
$allowed_namespaces[$key] = self::NS;
}
// Replace the ##local with null
- if (($key = array_search(NS::LOCAL, $allowed_namespaces)) !== false) {
+ if (($key = array_search(NamespaceEnum::Local, $allowed_namespaces)) !== false) {
$allowed_namespaces[$key] = null;
}
@@ -166,11 +172,11 @@ function (SerializableElementInterface $elt) {
self::NS,
),
);
- } elseif ($namespace === NS::OTHER) {
+ } elseif ($namespace === NamespaceEnum::Other) {
// Must be any namespace other than the parent element, excluding elements with no namespace
Assert::notInArray(null, $actual_namespaces);
Assert::allNotSame($actual_namespaces, self::NS);
- } elseif ($namespace === NS::TARGET) {
+ } elseif ($namespace === NamespaceEnum::TargetNamespace) {
// Must be the same namespace as the one of the parent element
Assert::allSame($actual_namespaces, self::NS);
} else {
@@ -200,9 +206,9 @@ public function getElements(): array
/**
- * @return array|\SimpleSAML\XML\XsNamespace
+ * @return array<\SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|string>|\SimpleSAML\XMLSchema\XML\xs\NamespaceEnum
*/
- public function getElementNamespace(): array|NS
+ public function getElementNamespace(): array|NamespaceEnum
{
Assert::true(
defined('self::XS_ANY_ELT_NAMESPACE'),
@@ -218,7 +224,7 @@ public function getElementNamespace(): array|NS
/**
* Get the exclusions list for getChildElementsFromXML.
*
- * @return array
+ * @return array{array{string|null, string}}|array{}
*/
public static function getElementExclusions(): array
{
diff --git a/src/Registry/ElementRegistry.php b/src/XML/Registry/ElementRegistry.php
similarity index 96%
rename from src/Registry/ElementRegistry.php
rename to src/XML/Registry/ElementRegistry.php
index e335e450..93d0efb1 100644
--- a/src/Registry/ElementRegistry.php
+++ b/src/XML/Registry/ElementRegistry.php
@@ -6,7 +6,8 @@
use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\{InvalidDOMElementException, IOException};
+use SimpleSAML\XML\Exception\IOException;
+use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
use Symfony\Component\Finder\Finder;
use function array_merge_recursive;
diff --git a/src/SchemaValidatableElementInterface.php b/src/XML/SchemaValidatableElementInterface.php
similarity index 90%
rename from src/SchemaValidatableElementInterface.php
rename to src/XML/SchemaValidatableElementInterface.php
index 72b6dd13..9c008296 100644
--- a/src/SchemaValidatableElementInterface.php
+++ b/src/XML/SchemaValidatableElementInterface.php
@@ -21,7 +21,7 @@ interface SchemaValidatableElementInterface extends ElementInterface
* @return \DOMDocument
*
* @throws \SimpleSAML\XML\Exception\IOException
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException
*/
public static function schemaValidate(DOMDocument $document, ?string $schemaFile = null): DOMDocument;
}
diff --git a/src/SchemaValidatableElementTrait.php b/src/XML/SchemaValidatableElementTrait.php
similarity index 90%
rename from src/SchemaValidatableElementTrait.php
rename to src/XML/SchemaValidatableElementTrait.php
index dc2dc4bd..1bc9d839 100644
--- a/src/SchemaValidatableElementTrait.php
+++ b/src/XML/SchemaValidatableElementTrait.php
@@ -5,8 +5,9 @@
namespace SimpleSAML\XML;
use DOMDocument;
-use SimpleSAML\Assert\Assert;
-use SimpleSAML\XML\Exception\{IOException, RuntimeException, SchemaViolationException};
+use SimpleSAML\XML\Assert\Assert;
+use SimpleSAML\XML\Exception\{IOException, RuntimeException};
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
use function array_unique;
use function defined;
@@ -33,7 +34,7 @@ trait SchemaValidatableElementTrait
* @return \DOMDocument
*
* @throws \SimpleSAML\XML\Exception\IOException
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException
*/
public static function schemaValidate(DOMDocument $document, ?string $schemaFile = null): DOMDocument
{
diff --git a/src/SerializableElementInterface.php b/src/XML/SerializableElementInterface.php
similarity index 100%
rename from src/SerializableElementInterface.php
rename to src/XML/SerializableElementInterface.php
diff --git a/src/SerializableElementTrait.php b/src/XML/SerializableElementTrait.php
similarity index 100%
rename from src/SerializableElementTrait.php
rename to src/XML/SerializableElementTrait.php
diff --git a/src/TestUtils/ArrayizableElementTestTrait.php b/src/XML/TestUtils/ArrayizableElementTestTrait.php
similarity index 100%
rename from src/TestUtils/ArrayizableElementTestTrait.php
rename to src/XML/TestUtils/ArrayizableElementTestTrait.php
diff --git a/src/TestUtils/SchemaValidationTestTrait.php b/src/XML/TestUtils/SchemaValidationTestTrait.php
similarity index 100%
rename from src/TestUtils/SchemaValidationTestTrait.php
rename to src/XML/TestUtils/SchemaValidationTestTrait.php
diff --git a/src/TestUtils/SerializableElementTestTrait.php b/src/XML/TestUtils/SerializableElementTestTrait.php
similarity index 100%
rename from src/TestUtils/SerializableElementTestTrait.php
rename to src/XML/TestUtils/SerializableElementTestTrait.php
diff --git a/src/TypedTextContentTrait.php b/src/XML/TypedTextContentTrait.php
similarity index 84%
rename from src/TypedTextContentTrait.php
rename to src/XML/TypedTextContentTrait.php
index 515e8456..a619c3f2 100644
--- a/src/TypedTextContentTrait.php
+++ b/src/XML/TypedTextContentTrait.php
@@ -6,8 +6,9 @@
use DOMElement;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\{InvalidDOMElementException, InvalidValueTypeException};
-use SimpleSAML\XML\Type\{QNameValue, StringValue, ValueTypeInterface};
+use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, InvalidValueTypeException};
+use SimpleSAML\XMLSchema\Type\Builtin\{QNameValue, StringValue};
+use SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface;
use function defined;
use function strval;
@@ -19,12 +20,12 @@
*/
trait TypedTextContentTrait
{
- /** @var \SimpleSAML\XML\Type\ValueTypeInterface $content */
+ /** @var \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface $content */
protected ValueTypeInterface $content;
/**
- * @param \SimpleSAML\XML\Type\ValueTypeInterface $content
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface $content
*/
public function __construct(
ValueTypeInterface $content,
@@ -36,7 +37,7 @@ public function __construct(
/**
* Set the content of the element.
*
- * @param \SimpleSAML\XML\Type\ValueTypeInterface $content The value to go in the XML textContent
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface $content The value to go in the XML textContent
*/
protected function setContent(ValueTypeInterface $content): void
{
@@ -48,7 +49,7 @@ protected function setContent(ValueTypeInterface $content): void
/**
* Get the typed content of the element
*
- * @return \SimpleSAML\XML\Type\ValueTypeInterface
+ * @return \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
*/
public function getContent(): ValueTypeInterface
{
diff --git a/src/Utils.php b/src/XML/Utils.php
similarity index 100%
rename from src/Utils.php
rename to src/XML/Utils.php
diff --git a/src/Utils/Random.php b/src/XML/Utils/Random.php
similarity index 100%
rename from src/Utils/Random.php
rename to src/XML/Utils/Random.php
diff --git a/src/Utils/XPath.php b/src/XML/Utils/XPath.php
similarity index 97%
rename from src/Utils/XPath.php
rename to src/XML/Utils/XPath.php
index bfe64016..2d4b02dd 100644
--- a/src/Utils/XPath.php
+++ b/src/XML/Utils/XPath.php
@@ -7,7 +7,7 @@
use DOMDocument;
use DOMNode;
use DOMXPath;
-use SimpleSAML\Assert\Assert;
+use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Constants as C;
/**
diff --git a/src/Utils/XPathFilter.php b/src/XML/Utils/XPathFilter.php
similarity index 100%
rename from src/Utils/XPathFilter.php
rename to src/XML/Utils/XPathFilter.php
diff --git a/src/XMLSchema/Constants.php b/src/XMLSchema/Constants.php
new file mode 100644
index 00000000..9cd06eff
--- /dev/null
+++ b/src/XMLSchema/Constants.php
@@ -0,0 +1,25 @@
+sanitizeValue($value);
+ if ($sanitized !== 'unbounded') {
+ Assert::validNonNegativeInteger($sanitized, SchemaViolationException::class);
+ }
+ }
+}
diff --git a/src/XMLSchema/Type/BlockSetValue.php b/src/XMLSchema/Type/BlockSetValue.php
new file mode 100644
index 00000000..6c612ee0
--- /dev/null
+++ b/src/XMLSchema/Type/BlockSetValue.php
@@ -0,0 +1,50 @@
+sanitizeValue($value);
+
+ if ($sanitized !== '#all' && $sanitized !== '') {
+ $list = explode(' ', $sanitized, C::UNBOUNDED_LIMIT);
+
+ // After filtering the allowed values, there should be nothing left
+ $filtered = array_diff(
+ $list,
+ [
+ DerivationControlEnum::Extension->value,
+ DerivationControlEnum::Restriction->value,
+ DerivationControlEnum::Substitution->value,
+ ],
+ );
+ Assert::isEmpty($filtered, SchemaViolationException::class);
+ }
+ }
+}
diff --git a/src/Type/AnyURIValue.php b/src/XMLSchema/Type/Builtin/AnyURIValue.php
similarity index 70%
rename from src/Type/AnyURIValue.php
rename to src/XMLSchema/Type/Builtin/AnyURIValue.php
index 97439e5a..c39572b3 100644
--- a/src/Type/AnyURIValue.php
+++ b/src/XMLSchema/Type/Builtin/AnyURIValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class AnyURIValue extends AbstractValueType
+class AnyURIValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'anyURI';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/Base64BinaryValue.php b/src/XMLSchema/Type/Builtin/Base64BinaryValue.php
similarity index 72%
rename from src/Type/Base64BinaryValue.php
rename to src/XMLSchema/Type/Builtin/Base64BinaryValue.php
index d3c209cf..69e9e8cb 100644
--- a/src/Type/Base64BinaryValue.php
+++ b/src/XMLSchema/Type/Builtin/Base64BinaryValue.php
@@ -2,17 +2,18 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
use function preg_replace;
/**
* @package simplesaml/xml-common
*/
-class Base64BinaryValue extends AbstractValueType
+class Base64BinaryValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'base64Binary';
@@ -34,7 +35,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/BooleanValue.php b/src/XMLSchema/Type/Builtin/BooleanValue.php
similarity index 80%
rename from src/Type/BooleanValue.php
rename to src/XMLSchema/Type/Builtin/BooleanValue.php
index c5f339e7..efac93d0 100644
--- a/src/Type/BooleanValue.php
+++ b/src/XMLSchema/Type/Builtin/BooleanValue.php
@@ -2,10 +2,11 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
use function boolval;
use function in_array;
@@ -13,7 +14,7 @@
/**
* @package simplesaml/xml-common
*/
-class BooleanValue extends AbstractValueType
+class BooleanValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'boolean';
@@ -35,7 +36,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/ByteValue.php b/src/XMLSchema/Type/Builtin/ByteValue.php
similarity index 71%
rename from src/Type/ByteValue.php
rename to src/XMLSchema/Type/Builtin/ByteValue.php
index 8dc466cc..c5c0c273 100644
--- a/src/Type/ByteValue.php
+++ b/src/XMLSchema/Type/Builtin/ByteValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class ByteValue extends LongValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/DateTimeValue.php b/src/XMLSchema/Type/Builtin/DateTimeValue.php
similarity index 80%
rename from src/Type/DateTimeValue.php
rename to src/XMLSchema/Type/Builtin/DateTimeValue.php
index 7411b830..f3acfd35 100644
--- a/src/Type/DateTimeValue.php
+++ b/src/XMLSchema/Type/Builtin/DateTimeValue.php
@@ -2,17 +2,18 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use DateTimeImmutable;
use DateTimeInterface;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class DateTimeValue extends AbstractValueType
+class DateTimeValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'dateTime';
@@ -37,7 +38,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/DateValue.php b/src/XMLSchema/Type/Builtin/DateValue.php
similarity index 70%
rename from src/Type/DateValue.php
rename to src/XMLSchema/Type/Builtin/DateValue.php
index fe41a113..321babed 100644
--- a/src/Type/DateValue.php
+++ b/src/XMLSchema/Type/Builtin/DateValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class DateValue extends AbstractValueType
+class DateValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'date';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/DayValue.php b/src/XMLSchema/Type/Builtin/DayValue.php
similarity index 70%
rename from src/Type/DayValue.php
rename to src/XMLSchema/Type/Builtin/DayValue.php
index 431e9c52..8a9dc8d8 100644
--- a/src/Type/DayValue.php
+++ b/src/XMLSchema/Type/Builtin/DayValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class DayValue extends AbstractValueType
+class DayValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'gDay';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/DecimalValue.php b/src/XMLSchema/Type/Builtin/DecimalValue.php
similarity index 72%
rename from src/Type/DecimalValue.php
rename to src/XMLSchema/Type/Builtin/DecimalValue.php
index 7d227f01..b5f608fd 100644
--- a/src/Type/DecimalValue.php
+++ b/src/XMLSchema/Type/Builtin/DecimalValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class DecimalValue extends AbstractValueType
+class DecimalValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'decimal';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/DoubleValue.php b/src/XMLSchema/Type/Builtin/DoubleValue.php
similarity index 70%
rename from src/Type/DoubleValue.php
rename to src/XMLSchema/Type/Builtin/DoubleValue.php
index 4b98bdd4..a6ee464e 100644
--- a/src/Type/DoubleValue.php
+++ b/src/XMLSchema/Type/Builtin/DoubleValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class DoubleValue extends AbstractValueType
+class DoubleValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'double';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/DurationValue.php b/src/XMLSchema/Type/Builtin/DurationValue.php
similarity index 70%
rename from src/Type/DurationValue.php
rename to src/XMLSchema/Type/Builtin/DurationValue.php
index b79bf9c6..9cdae671 100644
--- a/src/Type/DurationValue.php
+++ b/src/XMLSchema/Type/Builtin/DurationValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class DurationValue extends AbstractValueType
+class DurationValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'duration';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/EntitiesValue.php b/src/XMLSchema/Type/Builtin/EntitiesValue.php
similarity index 74%
rename from src/Type/EntitiesValue.php
rename to src/XMLSchema/Type/Builtin/EntitiesValue.php
index 546e7a82..284d3a0e 100644
--- a/src/Type/EntitiesValue.php
+++ b/src/XMLSchema/Type/Builtin/EntitiesValue.php
@@ -2,11 +2,12 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Constants as C;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\ListTypeInterface;
/**
* @package simplesaml/xml-common
@@ -21,7 +22,7 @@ class EntitiesValue extends TokenValue implements ListTypeInterface
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
@@ -34,7 +35,7 @@ protected function validateValue(string $value): void
/**
* Convert this xs:ENTITIES to an array of xs:ENTITY items
*
- * @return array<\SimpleSAML\XML\Type\EntityValue>
+ * @return array<\SimpleSAML\XMLSchema\Type\Builtin\EntityValue>
*/
public function toArray(): array
{
diff --git a/src/Type/EntityValue.php b/src/XMLSchema/Type/Builtin/EntityValue.php
similarity index 80%
rename from src/Type/EntityValue.php
rename to src/XMLSchema/Type/Builtin/EntityValue.php
index 38dc9bd6..affd331d 100644
--- a/src/Type/EntityValue.php
+++ b/src/XMLSchema/Type/Builtin/EntityValue.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
/**
* @package simplesaml/xml-common
diff --git a/src/Type/FloatValue.php b/src/XMLSchema/Type/Builtin/FloatValue.php
similarity index 70%
rename from src/Type/FloatValue.php
rename to src/XMLSchema/Type/Builtin/FloatValue.php
index f90c03f2..440c425a 100644
--- a/src/Type/FloatValue.php
+++ b/src/XMLSchema/Type/Builtin/FloatValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class FloatValue extends AbstractValueType
+class FloatValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'float';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/HexBinaryValue.php b/src/XMLSchema/Type/Builtin/HexBinaryValue.php
similarity index 71%
rename from src/Type/HexBinaryValue.php
rename to src/XMLSchema/Type/Builtin/HexBinaryValue.php
index 52452575..d1d2bc79 100644
--- a/src/Type/HexBinaryValue.php
+++ b/src/XMLSchema/Type/Builtin/HexBinaryValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class HexBinaryValue extends AbstractValueType
+class HexBinaryValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'hexBinary';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/IDRefValue.php b/src/XMLSchema/Type/Builtin/IDRefValue.php
similarity index 80%
rename from src/Type/IDRefValue.php
rename to src/XMLSchema/Type/Builtin/IDRefValue.php
index 1786090d..17855d18 100644
--- a/src/Type/IDRefValue.php
+++ b/src/XMLSchema/Type/Builtin/IDRefValue.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
/**
* @package simplesaml/xml-common
diff --git a/src/Type/IDRefsValue.php b/src/XMLSchema/Type/Builtin/IDRefsValue.php
similarity index 73%
rename from src/Type/IDRefsValue.php
rename to src/XMLSchema/Type/Builtin/IDRefsValue.php
index 50ec13f8..c474f76c 100644
--- a/src/Type/IDRefsValue.php
+++ b/src/XMLSchema/Type/Builtin/IDRefsValue.php
@@ -2,11 +2,12 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Constants as C;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\ListTypeInterface;
/**
* @package simplesaml/xml-common
@@ -21,7 +22,7 @@ class IDRefsValue extends TokenValue implements ListTypeInterface
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
@@ -34,7 +35,7 @@ protected function validateValue(string $value): void
/**
* Convert this xs:IDREFS to an array of xs:IDREF items
*
- * @return array<\SimpleSAML\XML\Type\IDRefValue>
+ * @return array<\SimpleSAML\XMLSchema\Type\Builtin\IDRefValue>
*/
public function toArray(): array
{
diff --git a/src/Type/IDValue.php b/src/XMLSchema/Type/Builtin/IDValue.php
similarity index 79%
rename from src/Type/IDValue.php
rename to src/XMLSchema/Type/Builtin/IDValue.php
index 157faf82..89b40243 100644
--- a/src/Type/IDValue.php
+++ b/src/XMLSchema/Type/Builtin/IDValue.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
/**
* @package simplesaml/xml-common
diff --git a/src/Type/IntValue.php b/src/XMLSchema/Type/Builtin/IntValue.php
similarity index 71%
rename from src/Type/IntValue.php
rename to src/XMLSchema/Type/Builtin/IntValue.php
index ea969144..427adb07 100644
--- a/src/Type/IntValue.php
+++ b/src/XMLSchema/Type/Builtin/IntValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class IntValue extends LongValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/IntegerValue.php b/src/XMLSchema/Type/Builtin/IntegerValue.php
similarity index 84%
rename from src/Type/IntegerValue.php
rename to src/XMLSchema/Type/Builtin/IntegerValue.php
index dcef275b..f496edb3 100644
--- a/src/Type/IntegerValue.php
+++ b/src/XMLSchema/Type/Builtin/IntegerValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\{RuntimeException, SchemaViolationException};
+use SimpleSAML\XMLSchema\Exception\{RuntimeException, SchemaViolationException};
use function bccomp;
use function intval;
@@ -24,7 +24,7 @@ class IntegerValue extends DecimalValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/LanguageValue.php b/src/XMLSchema/Type/Builtin/LanguageValue.php
similarity index 74%
rename from src/Type/LanguageValue.php
rename to src/XMLSchema/Type/Builtin/LanguageValue.php
index 7d9b64c5..c4162971 100644
--- a/src/Type/LanguageValue.php
+++ b/src/XMLSchema/Type/Builtin/LanguageValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class LanguageValue extends TokenValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/LongValue.php b/src/XMLSchema/Type/Builtin/LongValue.php
similarity index 71%
rename from src/Type/LongValue.php
rename to src/XMLSchema/Type/Builtin/LongValue.php
index 8f804667..10d99353 100644
--- a/src/Type/LongValue.php
+++ b/src/XMLSchema/Type/Builtin/LongValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class LongValue extends IntegerValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/MonthValue.php b/src/XMLSchema/Type/Builtin/MonthValue.php
similarity index 70%
rename from src/Type/MonthValue.php
rename to src/XMLSchema/Type/Builtin/MonthValue.php
index bd5272a2..97e3e1b7 100644
--- a/src/Type/MonthValue.php
+++ b/src/XMLSchema/Type/Builtin/MonthValue.php
@@ -2,15 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
/**
* @package simplesaml/xml-common
*/
-class MonthValue extends AbstractValueType
+class MonthValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'gMonth';
@@ -32,7 +33,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NCNameValue.php b/src/XMLSchema/Type/Builtin/NCNameValue.php
similarity index 74%
rename from src/Type/NCNameValue.php
rename to src/XMLSchema/Type/Builtin/NCNameValue.php
index 01106bf8..accaa543 100644
--- a/src/Type/NCNameValue.php
+++ b/src/XMLSchema/Type/Builtin/NCNameValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class NCNameValue extends TokenValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NMTokenValue.php b/src/XMLSchema/Type/Builtin/NMTokenValue.php
similarity index 74%
rename from src/Type/NMTokenValue.php
rename to src/XMLSchema/Type/Builtin/NMTokenValue.php
index bff02253..6c11f301 100644
--- a/src/Type/NMTokenValue.php
+++ b/src/XMLSchema/Type/Builtin/NMTokenValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class NMTokenValue extends TokenValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NMTokensValue.php b/src/XMLSchema/Type/Builtin/NMTokensValue.php
similarity index 74%
rename from src/Type/NMTokensValue.php
rename to src/XMLSchema/Type/Builtin/NMTokensValue.php
index 06b9a627..a8ea55aa 100644
--- a/src/Type/NMTokensValue.php
+++ b/src/XMLSchema/Type/Builtin/NMTokensValue.php
@@ -2,11 +2,12 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
use SimpleSAML\XML\Constants as C;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\ListTypeInterface;
use function array_map;
use function explode;
@@ -24,7 +25,7 @@ class NMTokensValue extends TokenValue implements ListTypeInterface
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
@@ -37,7 +38,7 @@ protected function validateValue(string $value): void
/**
* Convert this xs:NMTokens to an array of xs:NMToken items
*
- * @return array<\SimpleSAML\XML\Type\NMTokenValue>
+ * @return array<\SimpleSAML\XMLSchema\Type\Builtin\NMTokenValue>
*/
public function toArray(): array
{
diff --git a/src/Type/NameValue.php b/src/XMLSchema/Type/Builtin/NameValue.php
similarity index 74%
rename from src/Type/NameValue.php
rename to src/XMLSchema/Type/Builtin/NameValue.php
index 9d5084b4..f9378660 100644
--- a/src/Type/NameValue.php
+++ b/src/XMLSchema/Type/Builtin/NameValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class NameValue extends TokenValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NegativeIntegerValue.php b/src/XMLSchema/Type/Builtin/NegativeIntegerValue.php
similarity index 72%
rename from src/Type/NegativeIntegerValue.php
rename to src/XMLSchema/Type/Builtin/NegativeIntegerValue.php
index e90fa6ab..103bd704 100644
--- a/src/Type/NegativeIntegerValue.php
+++ b/src/XMLSchema/Type/Builtin/NegativeIntegerValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class NegativeIntegerValue extends IntegerValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NonNegativeIntegerValue.php b/src/XMLSchema/Type/Builtin/NonNegativeIntegerValue.php
similarity index 73%
rename from src/Type/NonNegativeIntegerValue.php
rename to src/XMLSchema/Type/Builtin/NonNegativeIntegerValue.php
index c5d4b0da..a23236c2 100644
--- a/src/Type/NonNegativeIntegerValue.php
+++ b/src/XMLSchema/Type/Builtin/NonNegativeIntegerValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class NonNegativeIntegerValue extends IntegerValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NonPositiveIntegerValue.php b/src/XMLSchema/Type/Builtin/NonPositiveIntegerValue.php
similarity index 73%
rename from src/Type/NonPositiveIntegerValue.php
rename to src/XMLSchema/Type/Builtin/NonPositiveIntegerValue.php
index 06e65b58..92df5194 100644
--- a/src/Type/NonPositiveIntegerValue.php
+++ b/src/XMLSchema/Type/Builtin/NonPositiveIntegerValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class NonPositiveIntegerValue extends IntegerValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/NormalizedStringValue.php b/src/XMLSchema/Type/Builtin/NormalizedStringValue.php
similarity index 90%
rename from src/Type/NormalizedStringValue.php
rename to src/XMLSchema/Type/Builtin/NormalizedStringValue.php
index 40bfdd8a..87dc1fb8 100644
--- a/src/Type/NormalizedStringValue.php
+++ b/src/XMLSchema/Type/Builtin/NormalizedStringValue.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
/**
* @package simplesaml/xml-common
diff --git a/src/Type/PositiveIntegerValue.php b/src/XMLSchema/Type/Builtin/PositiveIntegerValue.php
similarity index 73%
rename from src/Type/PositiveIntegerValue.php
rename to src/XMLSchema/Type/Builtin/PositiveIntegerValue.php
index 4c5615e5..8183cb9d 100644
--- a/src/Type/PositiveIntegerValue.php
+++ b/src/XMLSchema/Type/Builtin/PositiveIntegerValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class PositiveIntegerValue extends NonNegativeIntegerValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/Type/QNameValue.php b/src/XMLSchema/Type/Builtin/QNameValue.php
similarity index 82%
rename from src/Type/QNameValue.php
rename to src/XMLSchema/Type/Builtin/QNameValue.php
index 8b0807ec..b8d50ecf 100644
--- a/src/Type/QNameValue.php
+++ b/src/XMLSchema/Type/Builtin/QNameValue.php
@@ -2,29 +2,30 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use DOMElement;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Helper\AbstractAnySimpleType;
use function preg_match;
/**
* @package simplesaml/xml-common
*/
-class QNameValue extends AbstractValueType
+class QNameValue extends AbstractAnySimpleType
{
/** @var string */
public const SCHEMA_TYPE = 'QName';
- /** @var \SimpleSAML\XML\Type\AnyURIValue|null */
+ /** @var \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null */
protected ?AnyURIValue $namespaceURI;
- /** @var \SimpleSAML\XML\Type\NCNameValue|null */
+ /** @var \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null */
protected ?NCNameValue $namespacePrefix;
- /** @var \SimpleSAML\XML\Type\NCNameValue */
+ /** @var \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue */
protected NCNameValue $localName;
/** @var string */
@@ -58,7 +59,7 @@ protected function sanitizeValue(string $value): string
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
@@ -101,7 +102,7 @@ public function getValue(): string
/**
* Get the namespaceURI for this qualified name.
*
- * @return \SimpleSAML\XML\Type\AnyURIValue|null
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
*/
public function getNamespaceURI(): ?AnyURIValue
{
@@ -112,7 +113,7 @@ public function getNamespaceURI(): ?AnyURIValue
/**
* Get the namespace-prefix for this qualified name.
*
- * @return \SimpleSAML\XML\Type\NCNameValue|null
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null
*/
public function getNamespacePrefix(): ?NCNameValue
{
@@ -123,7 +124,7 @@ public function getNamespacePrefix(): ?NCNameValue
/**
* Get the local name for this qualified name.
*
- * @return \SimpleSAML\XML\Type\NCNameValue
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue
*/
public function getLocalName(): NCNameValue
{
@@ -132,9 +133,9 @@ public function getLocalName(): NCNameValue
/**
- * @param \SimpleSAML\XML\Type\NCNameValue $localName
- * @param \SimpleSAML\XML\Type\AnyURIValue|null $namespaceURI
- * @param \SimpleSAML\XML\Type\NCNameValue|null $namespacePrefix
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue $localName
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null $namespaceURI
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null $namespacePrefix
* @return static
*/
public static function fromParts(
diff --git a/src/Type/ShortValue.php b/src/XMLSchema/Type/Builtin/ShortValue.php
similarity index 71%
rename from src/Type/ShortValue.php
rename to src/XMLSchema/Type/Builtin/ShortValue.php
index 99535204..ebc2016f 100644
--- a/src/Type/ShortValue.php
+++ b/src/XMLSchema/Type/Builtin/ShortValue.php
@@ -2,10 +2,10 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Builtin;
use SimpleSAML\XML\Assert\Assert;
-use SimpleSAML\XML\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* @package simplesaml/xml-common
@@ -20,7 +20,7 @@ class ShortValue extends IntValue
* Validate the value.
*
* @param string $value
- * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure
+ * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
* @return void
*/
protected function validateValue(string $value): void
diff --git a/src/XMLSchema/Type/Builtin/StringValue.php b/src/XMLSchema/Type/Builtin/StringValue.php
new file mode 100644
index 00000000..6b75b0be
--- /dev/null
+++ b/src/XMLSchema/Type/Builtin/StringValue.php
@@ -0,0 +1,16 @@
+sanitizeValue($value),
+ array_column(DerivationControlEnum::cases(), 'value'),
+ SchemaViolationException::class,
+ );
+ }
+
+
+ /**
+ * @param \SimpleSAML\XMLSchema\XML\xs\DerivationControlEnum $value
+ * @return static
+ */
+ public static function fromEnum(DerivationControlEnum $value): static
+ {
+ return new static($value->value);
+ }
+
+
+ /**
+ * @return \SimpleSAML\XMLSchema\XML\xs\DerivationControlEnum $value
+ */
+ public function toEnum(): DerivationControlEnum
+ {
+ return DerivationControlEnum::from($this->getValue());
+ }
+}
diff --git a/src/XMLSchema/Type/DerivationSetValue.php b/src/XMLSchema/Type/DerivationSetValue.php
new file mode 100644
index 00000000..f2944b1c
--- /dev/null
+++ b/src/XMLSchema/Type/DerivationSetValue.php
@@ -0,0 +1,48 @@
+sanitizeValue($value);
+
+ if ($sanitized !== '#all' && $sanitized !== '') {
+ Assert::allOneOf(
+ explode(' ', $sanitized),
+ array_column(
+ [
+ DerivationControlEnum::Extension,
+ DerivationControlEnum::Restriction,
+ ],
+ 'value',
+ ),
+ SchemaViolationException::class,
+ );
+ }
+ }
+}
diff --git a/src/XMLSchema/Type/FormChoiceValue.php b/src/XMLSchema/Type/FormChoiceValue.php
new file mode 100644
index 00000000..7f9d58de
--- /dev/null
+++ b/src/XMLSchema/Type/FormChoiceValue.php
@@ -0,0 +1,53 @@
+sanitizeValue($value),
+ array_column(FormChoiceEnum::cases(), 'value'),
+ SchemaViolationException::class,
+ );
+ }
+
+
+ /**
+ * @param \SimpleSAML\XMLSchema\XML\xs\FormChoiceEnum $value
+ * @return static
+ */
+ public static function fromEnum(FormChoiceEnum $value): static
+ {
+ return new static($value->value);
+ }
+
+
+ /**
+ * @return \SimpleSAML\XMLSchema\XML\xs\FormChoiceEnum $value
+ */
+ public function toEnum(): FormChoiceEnum
+ {
+ return FormChoiceEnum::from($this->getValue());
+ }
+}
diff --git a/src/XMLSchema/Type/FullDerivationSetValue.php b/src/XMLSchema/Type/FullDerivationSetValue.php
new file mode 100644
index 00000000..26e6b72c
--- /dev/null
+++ b/src/XMLSchema/Type/FullDerivationSetValue.php
@@ -0,0 +1,50 @@
+sanitizeValue($value);
+
+ if ($sanitized !== '#all' && $sanitized !== '') {
+ Assert::allOneOf(
+ explode(' ', $sanitized),
+ array_column(
+ [
+ DerivationControlEnum::Extension,
+ DerivationControlEnum::List,
+ DerivationControlEnum::Restriction,
+ DerivationControlEnum::Union,
+ ],
+ 'value',
+ ),
+ SchemaViolationException::class,
+ );
+ }
+ }
+}
diff --git a/src/Type/AbstractValueType.php b/src/XMLSchema/Type/Helper/AbstractAnySimpleType.php
similarity index 93%
rename from src/Type/AbstractValueType.php
rename to src/XMLSchema/Type/Helper/AbstractAnySimpleType.php
index 47404d0c..dbbcadb2 100644
--- a/src/Type/AbstractValueType.php
+++ b/src/XMLSchema/Type/Helper/AbstractAnySimpleType.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Helper;
use function is_string;
use function preg_replace;
@@ -14,7 +14,7 @@
*
* @package simplesamlphp/xml-common
*/
-abstract class AbstractValueType implements ValueTypeInterface
+abstract class AbstractAnySimpleType implements ValueTypeInterface
{
/** @var string */
public const SCHEMA_TYPE = 'anySimpleType';
@@ -139,7 +139,7 @@ public function __toString(): string
/**
* Compare the value to another one
*
- * @param \SimpleSAML\XML\Type\ValueTypeInterface|string $other
+ * @param \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface|string $other
* @return bool
*/
public function equals(ValueTypeInterface|string $other): bool
diff --git a/src/Type/ListTypeInterface.php b/src/XMLSchema/Type/Helper/ListTypeInterface.php
similarity index 74%
rename from src/Type/ListTypeInterface.php
rename to src/XMLSchema/Type/Helper/ListTypeInterface.php
index 545d41c0..aba8f75d 100644
--- a/src/Type/ListTypeInterface.php
+++ b/src/XMLSchema/Type/Helper/ListTypeInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Helper;
/**
* interface class to be implemented by all the classes that represent a list type
@@ -14,7 +14,7 @@ interface ListTypeInterface extends ValueTypeInterface
/**
* Convert this list type to an array of individual items
*
- * @return array<\SimpleSAML\XML\Type\ValueTypeInterface>
+ * @return array<\SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface>
*/
public function toArray(): array;
}
diff --git a/src/Type/ValueTypeInterface.php b/src/XMLSchema/Type/Helper/ValueTypeInterface.php
similarity index 93%
rename from src/Type/ValueTypeInterface.php
rename to src/XMLSchema/Type/Helper/ValueTypeInterface.php
index 9e9f8b05..b04df097 100644
--- a/src/Type/ValueTypeInterface.php
+++ b/src/XMLSchema/Type/Helper/ValueTypeInterface.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\XML\Type;
+namespace SimpleSAML\XMLSchema\Type\Helper;
use Stringable;
diff --git a/src/XMLSchema/Type/MaxOccursValue.php b/src/XMLSchema/Type/MaxOccursValue.php
new file mode 100644
index 00000000..fadd0b61
--- /dev/null
+++ b/src/XMLSchema/Type/MaxOccursValue.php
@@ -0,0 +1,14 @@
+sanitizeValue($value);
+
+ if ($sanitized !== NamespaceEnum::Any->value && $sanitized !== NamespaceEnum::Other->value) {
+ $list = explode(' ', $sanitized, C::UNBOUNDED_LIMIT);
+
+ // After filtering the two special namespaces, only AnyURI's should be left
+ $filtered = array_diff(
+ $list,
+ [
+ NamespaceEnum::TargetNamespace->value,
+ NamespaceEnum::Local->value,
+ ],
+ );
+ Assert::false(
+ in_array(NamespaceEnum::Any->value, $filtered) || in_array(NamespaceEnum::Other->value, $filtered),
+ SchemaViolationException::class,
+ );
+ Assert::notEmpty($sanitized, SchemaViolationException::class);
+ Assert::allValidAnyURI($filtered, SchemaViolationException::class);
+ }
+ }
+
+
+ /**
+ * @param \SimpleSAML\XMLSchema\XML\xs\NamespaceEnum $value
+ * @return static
+ */
+ public static function fromEnum(NamespaceEnum $value): static
+ {
+ return new static($value->value);
+ }
+
+
+ /**
+ * @return \SimpleSAML\XMLSchema\XML\xs\NamespaceEnum $value
+ */
+ public function toEnum(): NamespaceEnum
+ {
+ return NamespaceEnum::from($this->getValue());
+ }
+}
diff --git a/src/XMLSchema/Type/ProcessContentsValue.php b/src/XMLSchema/Type/ProcessContentsValue.php
new file mode 100644
index 00000000..9b5fbcbd
--- /dev/null
+++ b/src/XMLSchema/Type/ProcessContentsValue.php
@@ -0,0 +1,53 @@
+sanitizeValue($value),
+ array_column(ProcessContentsEnum::cases(), 'value'),
+ SchemaViolationException::class,
+ );
+ }
+
+
+ /**
+ * @param \SimpleSAML\XMLSchema\XML\xs\ProcessContentsEnum $value
+ * @return static
+ */
+ public static function fromEnum(ProcessContentsEnum $value): static
+ {
+ return new static($value->value);
+ }
+
+
+ /**
+ * @return \SimpleSAML\XMLSchema\XML\xs\ProcessContentsEnum $value
+ */
+ public function toEnum(): ProcessContentsEnum
+ {
+ return ProcessContentsEnum::from($this->getValue());
+ }
+}
diff --git a/src/XMLSchema/Type/PublicValue.php b/src/XMLSchema/Type/PublicValue.php
new file mode 100644
index 00000000..7c926f48
--- /dev/null
+++ b/src/XMLSchema/Type/PublicValue.php
@@ -0,0 +1,16 @@
+sanitizeValue($value),
+ array_column(
+ [
+ DerivationControlEnum::Extension,
+ DerivationControlEnum::Restriction,
+ ],
+ 'value',
+ ),
+ SchemaViolationException::class,
+ );
+ }
+}
diff --git a/src/XMLSchema/Type/SimpleDerivationSetValue.php b/src/XMLSchema/Type/SimpleDerivationSetValue.php
new file mode 100644
index 00000000..61578339
--- /dev/null
+++ b/src/XMLSchema/Type/SimpleDerivationSetValue.php
@@ -0,0 +1,49 @@
+sanitizeValue($value);
+
+ if ($sanitized !== '#all' && $sanitized !== '') {
+ Assert::allOneOf(
+ explode(' ', $sanitized),
+ array_column(
+ [
+ DerivationControlEnum::List,
+ DerivationControlEnum::Restriction,
+ DerivationControlEnum::Union,
+ ],
+ 'value',
+ ),
+ SchemaViolationException::class,
+ );
+ }
+ }
+}
diff --git a/src/XMLSchema/Type/TypeDerivationControlValue.php b/src/XMLSchema/Type/TypeDerivationControlValue.php
new file mode 100644
index 00000000..01c5314c
--- /dev/null
+++ b/src/XMLSchema/Type/TypeDerivationControlValue.php
@@ -0,0 +1,41 @@
+sanitizeValue($value),
+ array_column(
+ [
+ DerivationControlEnum::Extension,
+ DerivationControlEnum::List,
+ DerivationControlEnum::Restriction,
+ DerivationControlEnum::Union,
+ ],
+ 'value',
+ ),
+ SchemaViolationException::class,
+ );
+ }
+}
diff --git a/src/XMLSchema/Type/UseValue.php b/src/XMLSchema/Type/UseValue.php
new file mode 100644
index 00000000..f9ac07ce
--- /dev/null
+++ b/src/XMLSchema/Type/UseValue.php
@@ -0,0 +1,53 @@
+sanitizeValue($value),
+ array_column(UseEnum::cases(), 'value'),
+ SchemaViolationException::class,
+ );
+ }
+
+
+ /**
+ * @param \SimpleSAML\XMLSchema\XML\xs\UseEnum $value
+ * @return static
+ */
+ public static function fromEnum(UseEnum $value): static
+ {
+ return new static($value->value);
+ }
+
+
+ /**
+ * @return \SimpleSAML\XMLSchema\XML\xs\UseEnum $value
+ */
+ public function toEnum(): UseEnum
+ {
+ return UseEnum::from($this->getValue());
+ }
+}
diff --git a/src/XMLSchema/Type/WhiteSpaceValue.php b/src/XMLSchema/Type/WhiteSpaceValue.php
new file mode 100644
index 00000000..745dc0cc
--- /dev/null
+++ b/src/XMLSchema/Type/WhiteSpaceValue.php
@@ -0,0 +1,57 @@
+sanitizeValue($value),
+ array_column(WhiteSpaceEnum::cases(), 'value'),
+ SchemaViolationException::class,
+ );
+ }
+
+
+ /**
+ * @param \SimpleSAML\XMLSchema\XML\xs\WhiteSpaceEnum $value
+ * @return static
+ */
+ public static function fromEnum(WhiteSpaceEnum $value): static
+ {
+ return new static($value->value);
+ }
+
+
+ /**
+ * @return \SimpleSAML\XMLSchema\XML\xs\WhiteSpaceEnum $value
+ */
+ public function toEnum(): WhiteSpaceEnum
+ {
+ return WhiteSpaceEnum::from($this->getValue());
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractAll.php b/src/XMLSchema/XML/xs/AbstractAll.php
new file mode 100644
index 00000000..83ab7ed6
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractAll.php
@@ -0,0 +1,65 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ array $particles = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ if ($minOccurs !== null) {
+ Assert::oneOf($minOccurs->toInteger(), [0, 1], SchemaViolationException::class);
+ }
+
+ if ($maxOccurs !== null) {
+ Assert::same($maxOccurs->toInteger(), 1, SchemaViolationException::class);
+ }
+
+ Assert::allIsInstanceOf(
+ $particles,
+ NarrowMaxMinElement::class,
+ SchemaViolationException::class,
+ );
+
+ parent::__construct(
+ nestedParticles: $particles,
+ minOccurs: $minOccurs,
+ maxOccurs: $maxOccurs,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractAnnotated.php b/src/XMLSchema/XML/xs/AbstractAnnotated.php
new file mode 100644
index 00000000..f6fa4ae4
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractAnnotated.php
@@ -0,0 +1,88 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ?Annotation $annotation = null,
+ protected ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the annotation-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\Annotation|null
+ */
+ public function getAnnotation(): ?Annotation
+ {
+ return $this->annotation;
+ }
+
+
+ /**
+ * Collect the value of the id-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null
+ */
+ public function getId(): ?IDValue
+ {
+ return $this->id;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getAnnotation()) &&
+ empty($this->getId());
+ }
+
+
+ /**
+ * Add this Annotated to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Annotated to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getId() !== null) {
+ $e->setAttribute('id', strval($this->getId()));
+ }
+
+ $this->getAnnotation()?->toXML($e);
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractAnyType.php b/src/XMLSchema/XML/xs/AbstractAnyType.php
new file mode 100644
index 00000000..ce842c02
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractAnyType.php
@@ -0,0 +1,75 @@
+ $elements
+ * @param array<\SimpleSAML\XML\Attribute> $attributes
+ */
+ public function __construct(
+ array $elements = [],
+ array $attributes = [],
+ ) {
+ $this->setElements($elements);
+ $this->setAttributesNS($attributes);
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return empty($this->getAttributesNS())
+ && empty($this->getElements());
+ }
+
+
+ /**
+ * Add this AnyType to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this anyType to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::instantiateParentElement($parent);
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ foreach ($this->getElements() as $elt) {
+ $elt->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractAttribute.php b/src/XMLSchema/XML/xs/AbstractAttribute.php
new file mode 100644
index 00000000..1678b330
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractAttribute.php
@@ -0,0 +1,163 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ?QNameValue $type = null,
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ protected ?UseValue $use = null,
+ protected ?StringValue $default = null,
+ protected ?StringValue $fixed = null,
+ ?FormChoiceValue $formChoice = null,
+ protected ?LocalSimpleType $simpleType = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::true(is_null($type) || is_null($reference), ProtocolViolationException::class);
+ Assert::true(is_null($name) || is_null($reference), ProtocolViolationException::class);
+ Assert::false(is_null($name) && is_null($reference), ProtocolViolationException::class);
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setName($name);
+ $this->setReference($reference);
+ $this->setFormChoice($formChoice);
+ }
+
+
+ /**
+ * Collect the value of the simpleType-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType|null
+ */
+ public function getSimpleType(): ?LocalSimpleType
+ {
+ return $this->simpleType;
+ }
+
+
+ /**
+ * Collect the value of the type-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null
+ */
+ public function getType(): ?QNameValue
+ {
+ return $this->type;
+ }
+
+
+ /**
+ * Collect the value of the use-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\UseValue|null
+ */
+ public function getUse(): ?UseValue
+ {
+ return $this->use;
+ }
+
+
+ /**
+ * Collect the value of the default-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null
+ */
+ public function getDefault(): ?StringValue
+ {
+ return $this->default;
+ }
+
+
+ /**
+ * Collect the value of the fixed-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null
+ */
+ public function getFixed(): ?StringValue
+ {
+ return $this->fixed;
+ }
+
+
+ /**
+ * Add this Attribute to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this facet to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('name', strval($this->getName()));
+ }
+
+ if ($this->getReference() !== null) {
+ $e->setAttribute('ref', strval($this->getReference()));
+ }
+
+ if ($this->getType() !== null) {
+ $e->setAttribute('type', strval($this->getType()));
+ }
+
+ if ($this->getUse() !== null) {
+ $e->setAttribute('use', strval($this->getUse()));
+ }
+
+ if ($this->getDefault() !== null) {
+ $e->setAttribute('default', strval($this->getDefault()));
+ }
+
+ if ($this->getFixed() !== null) {
+ $e->setAttribute('fixed', strval($this->getFixed()));
+ }
+
+ if ($this->getFormChoice() !== null) {
+ $e->setAttribute('form', strval($this->getFormChoice()));
+ }
+
+ $this->getSimpleType()?->toXML($e);
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractAttributeGroup.php b/src/XMLSchema/XML/xs/AbstractAttributeGroup.php
new file mode 100644
index 00000000..bebe4cd7
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractAttributeGroup.php
@@ -0,0 +1,95 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ protected ?Annotation $annotation = null,
+ protected ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setAttributes($attributes);
+ $this->setAnyAttribute($anyAttribute);
+ $this->setName($name);
+ $this->setReference($reference);
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getName()) &&
+ empty($this->getReference()) &&
+ empty($this->getAttributes()) &&
+ empty($this->getAnyAttribute());
+ }
+
+
+ /**
+ * Add this Annotated to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Annotated to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('name', strval($this->getName()));
+ }
+
+ if ($this->getReference() !== null) {
+ $e->setAttribute('ref', strval($this->getReference()));
+ }
+
+ foreach ($this->getAttributes() as $attr) {
+ $attr->toXML($e);
+ }
+
+ $this->getAnyAttribute()?->toXML($e);
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractComplexRestrictionType.php b/src/XMLSchema/XML/xs/AbstractComplexRestrictionType.php
new file mode 100644
index 00000000..d07cb594
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractComplexRestrictionType.php
@@ -0,0 +1,52 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ QNameValue $base,
+ // xs:typeDefParticle
+ ?TypeDefParticleInterface $particle = null,
+ // xs:attrDecls
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ // parent defined
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ base: $base,
+ particle: $particle,
+ attributes: $attributes,
+ anyAttribute: $anyAttribute,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractComplexType.php b/src/XMLSchema/XML/xs/AbstractComplexType.php
new file mode 100644
index 00000000..c1b0c0a2
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractComplexType.php
@@ -0,0 +1,194 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ?NCNameValue $name = null,
+ protected ?BooleanValue $mixed = null,
+ protected ?BooleanValue $abstract = null,
+ protected ?DerivationSetValue $final = null,
+ protected ?DerivationSetValue $block = null,
+ SimpleContent|ComplexContent|null $content = null,
+ ?TypeDefParticleInterface $particle = null,
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ if ($content !== null) {
+ Assert::null($particle, SchemaViolationException::class);
+ Assert::isEmpty($attributes, SchemaViolationException::class);
+ Assert::null($anyAttribute, SchemaViolationException::class);
+
+ $this->setContent($content);
+ } else {
+ Assert::null($content, SchemaViolationException::class);
+
+ $this->setParticle($particle);
+ $this->setAttributes($attributes);
+ $this->setAnyAttribute($anyAttribute);
+ }
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the name-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null
+ */
+ public function getName(): ?NCNameValue
+ {
+ return $this->name;
+ }
+
+
+ /**
+ * Collect the value of the mixed-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
+ */
+ public function getMixed(): ?BooleanValue
+ {
+ return $this->mixed;
+ }
+
+
+ /**
+ * Collect the value of the abstract-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
+ */
+ public function getAbstract(): ?BooleanValue
+ {
+ return $this->abstract;
+ }
+
+
+ /**
+ * Collect the value of the final-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\DerivationSetValue|null
+ */
+ public function getFinal(): ?DerivationSetValue
+ {
+ return $this->final;
+ }
+
+
+ /**
+ * Collect the value of the block-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\DerivationSetValue|null
+ */
+ public function getBlock(): ?DerivationSetValue
+ {
+ return $this->block;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getName()) &&
+ empty($this->getMixed()) &&
+ empty($this->getAbstract()) &&
+ empty($this->getFinal()) &&
+ empty($this->getBlock()) &&
+ empty($this->getAttributes()) &&
+ empty($this->getAnyAttribute()) &&
+ empty($this->getParticle()) &&
+ empty($this->getContent());
+ }
+
+
+ /**
+ * Add this ComplexType to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this ComplexType to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('name', strval($this->getName()));
+ }
+
+ if ($this->getMixed() !== null) {
+ $e->setAttribute('mixed', strval($this->getMixed()));
+ }
+
+ if ($this->getAbstract() !== null) {
+ $e->setAttribute('abstract', strval($this->getAbstract()));
+ }
+
+ if ($this->getFinal() !== null) {
+ $e->setAttribute('final', strval($this->getFinal()));
+ }
+
+ if ($this->getBlock() !== null) {
+ $e->setAttribute('block', strval($this->getBlock()));
+ }
+
+ if ($this->getContent() !== null) {
+ $this->getContent()->toXML($e);
+ } else {
+ $this->getParticle()?->toXML($e);
+
+ foreach ($this->getAttributes() as $attr) {
+ $attr->toXML($e);
+ }
+
+ $this->getAnyAttribute()?->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractElement.php b/src/XMLSchema/XML/xs/AbstractElement.php
new file mode 100644
index 00000000..ab7fa812
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractElement.php
@@ -0,0 +1,315 @@
+ $identityConstraint
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $type
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $substitutionGroup
+ * @param \SimpleSAML\XMLSchema\Type\MinOccursValue|null $minOccurs
+ * @param \SimpleSAML\XMLSchema\Type\MaxOccursValue|null $maxOccurs
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $fixed
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $nillable
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $abstract
+ * @param \SimpleSAML\XMLSchema\Type\DerivationSetValue|null $final
+ * @param \SimpleSAML\XMLSchema\Type\BlockSetValue|null $block
+ * @param \SimpleSAML\XMLSchema\Type\FormChoiceValue|null $form
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ protected LocalSimpleType|LocalComplexType|null $localType = null,
+ protected array $identityConstraint = [],
+ protected ?QNameValue $type = null,
+ protected ?QNameValue $substitutionGroup = null,
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ protected ?StringValue $default = null,
+ protected ?StringValue $fixed = null,
+ protected ?BooleanValue $nillable = null,
+ protected ?BooleanValue $abstract = null,
+ protected ?DerivationSetValue $final = null,
+ protected ?BlockSetValue $block = null,
+ protected ?FormChoiceValue $form = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::allIsInstanceOf(
+ $identityConstraint,
+ IdentityConstraintInterface::class,
+ SchemaViolationException::class,
+ );
+
+ /**
+ * An element is declared by either: a name and a type (either nested or referenced via the type attribute)
+ * or a ref to an existing element declaration
+ *
+ * type and ref are mutually exclusive.
+ * name and ref are mutually exclusive, one is required
+ */
+ Assert::true(is_null($type) || is_null($reference), ProtocolViolationException::class);
+ Assert::true(is_null($name) || is_null($reference), ProtocolViolationException::class);
+ Assert::false(is_null($name) && is_null($reference), ProtocolViolationException::class);
+
+ /**
+ * default and fixed are mutually exclusive
+ */
+ Assert::true(is_null($default) || is_null($fixed), ProtocolViolationException::class);
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setName($name);
+ $this->setReference($reference);
+ $this->setMinOccurs($minOccurs);
+ $this->setMaxOccurs($maxOccurs);
+ }
+
+
+ /**
+ * Collect the value of the localType-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType|\SimpleSAML\XMLSchema\XML\xs\LocalComplexType|null
+ */
+ public function getLocalType(): LocalSimpleType|LocalComplexType|null
+ {
+ return $this->localType;
+ }
+
+
+ /**
+ * Collect the value of the identityConstraint-property
+ *
+ * @return array<\SimpleSAML\XMLSchema\XML\xs\IdentityConstraintInterface>
+ */
+ public function getIdentityConstraint(): array
+ {
+ return $this->identityConstraint;
+ }
+
+
+ /**
+ * Collect the value of the type-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null
+ */
+ public function getType(): ?QNameValue
+ {
+ return $this->type;
+ }
+
+
+ /**
+ * Collect the value of the substitutionGroup-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null
+ */
+ public function getSubstitutionGroup(): ?QNameValue
+ {
+ return $this->substitutionGroup;
+ }
+
+
+ /**
+ * Collect the value of the default-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null
+ */
+ public function getDefault(): ?StringValue
+ {
+ return $this->default;
+ }
+
+
+ /**
+ * Collect the value of the fixed-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null
+ */
+ public function getFixed(): ?StringValue
+ {
+ return $this->fixed;
+ }
+
+
+ /**
+ * Collect the value of the nillable-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
+ */
+ public function getNillable(): ?BooleanValue
+ {
+ return $this->nillable;
+ }
+
+
+ /**
+ * Collect the value of the abstract-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
+ */
+ public function getAbstract(): ?BooleanValue
+ {
+ return $this->abstract;
+ }
+
+
+ /**
+ * Collect the value of the final-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\DerivationSetValue|null
+ */
+ public function getFinal(): ?DerivationSetValue
+ {
+ return $this->final;
+ }
+
+
+ /**
+ * Collect the value of the block-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\BlockSetValue|null
+ */
+ public function getBlock(): ?BlockSetValue
+ {
+ return $this->block;
+ }
+
+
+ /**
+ * Collect the value of the form-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\FormChoiceValue|null
+ */
+ public function getForm(): ?FormChoiceValue
+ {
+ return $this->form;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getName()) &&
+ empty($this->getReference()) &&
+ empty($this->getLocalType()) &&
+ empty($this->getIdentityConstraint()) &&
+ empty($this->getType()) &&
+ empty($this->getSubstitutionGroup()) &&
+ empty($this->getMinOccurs()) &&
+ empty($this->getMaxOccurs()) &&
+ empty($this->getDefault()) &&
+ empty($this->getFixed()) &&
+ empty($this->getNillable()) &&
+ empty($this->getAbstract()) &&
+ empty($this->getFinal()) &&
+ empty($this->getBlock()) &&
+ empty($this->getForm());
+ }
+
+
+ /**
+ * Add this Annotated to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Annotated to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('name', strval($this->getName()));
+ }
+
+ if ($this->getReference() !== null) {
+ $e->setAttribute('ref', strval($this->getReference()));
+ }
+
+ if ($this->getType() !== null) {
+ $e->setAttribute('type', strval($this->getType()));
+ }
+
+ if ($this->getSubstitutionGroup() !== null) {
+ $e->setAttribute('substitutionGroup', strval($this->getSubstitutionGroup()));
+ }
+
+ if ($this->getMinOccurs() !== null) {
+ $e->setAttribute('minOccurs', strval($this->getMinOccurs()));
+ }
+
+ if ($this->getMaxOccurs() !== null) {
+ $e->setAttribute('maxOccurs', strval($this->getMaxOccurs()));
+ }
+
+ if ($this->getDefault() !== null) {
+ $e->setAttribute('default', strval($this->getDefault()));
+ }
+
+ if ($this->getFixed() !== null) {
+ $e->setAttribute('fixed', strval($this->getFixed()));
+ }
+
+ if ($this->getNillable() !== null) {
+ $e->setAttribute('nillable', strval($this->getNillable()));
+ }
+
+ if ($this->getAbstract() !== null) {
+ $e->setAttribute('abstract', strval($this->getAbstract()));
+ }
+
+ if ($this->getFinal() !== null) {
+ $e->setAttribute('final', strval($this->getFinal()));
+ }
+
+ if ($this->getBlock() !== null) {
+ $e->setAttribute('block', strval($this->getBlock()));
+ }
+
+ if ($this->getForm() !== null) {
+ $e->setAttribute('form', strval($this->getForm()));
+ }
+
+ $this->getLocalType()?->toXML($e);
+
+ foreach ($this->getIdentityConstraint() as $identityConstraint) {
+ $identityConstraint->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractExplicitGroup.php b/src/XMLSchema/XML/xs/AbstractExplicitGroup.php
new file mode 100644
index 00000000..eb33703b
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractExplicitGroup.php
@@ -0,0 +1,49 @@
+ $nestedParticles
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ array $nestedParticles = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ particles: $nestedParticles,
+ minOccurs: $minOccurs,
+ maxOccurs: $maxOccurs,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractExtensionType.php b/src/XMLSchema/XML/xs/AbstractExtensionType.php
new file mode 100644
index 00000000..79db6934
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractExtensionType.php
@@ -0,0 +1,91 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected QNameValue $base,
+ // xs:typeDefParticle
+ ?TypeDefParticleInterface $particle = null,
+ // xs:attrDecls
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ // parent defined
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setAttributes($attributes);
+ $this->setAnyAttribute($anyAttribute);
+ $this->setParticle($particle);
+ }
+
+
+ /**
+ * Collect the value of the base-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue
+ */
+ public function getBase(): ?QNameValue
+ {
+ return $this->base;
+ }
+
+
+ /**
+ * Add this ExtensionType to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this ExtensionType to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getBase() !== null) {
+ $e->setAttribute('base', strval($this->getBase()));
+ }
+
+ $this->getParticle()?->toXML($e);
+
+ foreach ($this->getAttributes() as $attr) {
+ $attr->toXML($e);
+ }
+
+ $this->getAnyAttribute()?->toXML($e);
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractFacet.php b/src/XMLSchema/XML/xs/AbstractFacet.php
new file mode 100644
index 00000000..9a27b6e8
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractFacet.php
@@ -0,0 +1,80 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ValueTypeInterface $value,
+ protected ?BooleanValue $fixed = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the value-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
+ */
+ public function getValue(): ValueTypeInterface
+ {
+ return $this->value;
+ }
+
+
+ /**
+ * Collect the value of the fixed-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
+ */
+ public function getFixed(): ?BooleanValue
+ {
+ return $this->fixed;
+ }
+
+
+ /**
+ * Add this Facet to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this facet to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ $e->setAttribute('value', strval($this->getValue()));
+
+ if ($this->getFixed() !== null) {
+ $e->setAttribute('fixed', strval($this->getFixed()));
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractGroup.php b/src/XMLSchema/XML/xs/AbstractGroup.php
new file mode 100644
index 00000000..b1b8804e
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractGroup.php
@@ -0,0 +1,113 @@
+ $particles
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ protected array $particles = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setName($name);
+ $this->setReference($reference);
+ $this->setMinOccurs($minOccurs);
+ $this->setMaxOccurs($maxOccurs);
+ }
+
+
+ /**
+ * Collect the value of the particles-property
+ *
+ * @return array<\SimpleSAML\XMLSchema\XML\xs\ParticleInterface>
+ */
+ public function getParticles(): array
+ {
+ return $this->particles;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getParticles()) &&
+ empty($this->getName()) &&
+ empty($this->getReference()) &&
+ empty($this->getMinOccurs()) &&
+ empty($this->getMaxOccurs());
+ }
+
+
+ /**
+ * Add this Group to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Group to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('name', strval($this->getName()));
+ }
+
+ if ($this->getReference() !== null) {
+ $e->setAttribute('ref', strval($this->getReference()));
+ }
+
+ if ($this->getMinOccurs() !== null) {
+ $e->setAttribute('minOccurs', strval($this->getMinOccurs()));
+ }
+
+ if ($this->getMaxOccurs() !== null) {
+ $e->setAttribute('maxOccurs', strval($this->getMaxOccurs()));
+ }
+
+ foreach ($this->getParticles() as $particle) {
+ $particle->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractKeybase.php b/src/XMLSchema/XML/xs/AbstractKeybase.php
new file mode 100644
index 00000000..a7e9dbce
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractKeybase.php
@@ -0,0 +1,108 @@
+ $field
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ protected NCNameValue $name,
+ protected Selector $selector,
+ protected array $field = [],
+ protected ?Annotation $annotation = null,
+ protected ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::allIsInstanceOf($field, Field::class, MissingElementException::class);
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the name-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue
+ */
+ public function getName(): NCNameValue
+ {
+ return $this->name;
+ }
+
+
+ /**
+ * Collect the value of the selector-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\Selector
+ */
+ public function getSelector(): Selector
+ {
+ return $this->selector;
+ }
+
+
+ /**
+ * Collect the value of the field-property
+ *
+ * @return array<\SimpleSAML\XMLSchema\XML\xs\Field>
+ */
+ public function getField(): array
+ {
+ return $this->field;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return false;
+ }
+
+
+ /**
+ * Add this Keybase to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Keybase to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+ $e->setAttribute('name', strval($this->getName()));
+
+ $this->getSelector()->toXML($e);
+
+ foreach ($this->getField() as $field) {
+ $field->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractLocalComplexType.php b/src/XMLSchema/XML/xs/AbstractLocalComplexType.php
new file mode 100644
index 00000000..4ab708e6
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractLocalComplexType.php
@@ -0,0 +1,52 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ ?BooleanValue $mixed = null,
+ SimpleContent|ComplexContent|null $content = null,
+ ?TypeDefParticleInterface $particle = null,
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ mixed: $mixed,
+ content: $content,
+ particle: $particle,
+ attributes: $attributes,
+ anyAttribute: $anyAttribute,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractLocalElement.php b/src/XMLSchema/XML/xs/AbstractLocalElement.php
new file mode 100644
index 00000000..1424f55c
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractLocalElement.php
@@ -0,0 +1,71 @@
+ $identityConstraint
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $type
+ * @param \SimpleSAML\XMLSchema\Type\MinOccursValue|null $minOccurs
+ * @param \SimpleSAML\XMLSchema\Type\MaxOccursValue|null $maxOccurs
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $fixed
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $nillable
+ * @param \SimpleSAML\XMLSchema\Type\BlockSetValue|null $block
+ * @param \SimpleSAML\XMLSchema\Type\FormChoiceValue|null $form
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ LocalSimpleType|LocalComplexType|null $localType = null,
+ array $identityConstraint = [],
+ ?QNameValue $type = null,
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ ?StringValue $default = null,
+ ?StringValue $fixed = null,
+ ?BooleanValue $nillable = null,
+ ?BlockSetValue $block = null,
+ ?FormChoiceValue $form = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ name: $name,
+ reference: $reference,
+ localType: $localType,
+ identityConstraint: $identityConstraint,
+ type: $type,
+ minOccurs: $minOccurs,
+ maxOccurs: $maxOccurs,
+ default: $default,
+ fixed: $fixed,
+ nillable: $nillable,
+ block: $block,
+ form: $form,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractLocalSimpleType.php b/src/XMLSchema/XML/xs/AbstractLocalSimpleType.php
new file mode 100644
index 00000000..20be4399
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractLocalSimpleType.php
@@ -0,0 +1,37 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ SimpleDerivationInterface $derivation,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ derivation: $derivation,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractNamedAttributeGroup.php b/src/XMLSchema/XML/xs/AbstractNamedAttributeGroup.php
new file mode 100644
index 00000000..6c5a9e9d
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractNamedAttributeGroup.php
@@ -0,0 +1,52 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ NCNameValue $name,
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ name: $name,
+ attributes: $attributes,
+ anyAttribute: $anyAttribute,
+ reference: null,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractNamedGroup.php b/src/XMLSchema/XML/xs/AbstractNamedGroup.php
new file mode 100644
index 00000000..5a9d147a
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractNamedGroup.php
@@ -0,0 +1,58 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ ParticleInterface $particle,
+ ?NCNameValue $name = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::isInstanceOfAny(
+ $particle,
+ [All::class, Choice::class, Sequence::class],
+ SchemaViolationException::class,
+ );
+
+ if ($particle instanceof All) {
+ Assert::null($particle->getMinOccurs(), SchemaViolationException::class);
+ Assert::null($particle->getMaxOccurs(), SchemaViolationException::class);
+ }
+
+ parent::__construct(
+ name: $name,
+ particle: $particle,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractNarrowMaxMin.php b/src/XMLSchema/XML/xs/AbstractNarrowMaxMin.php
new file mode 100644
index 00000000..6d556771
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractNarrowMaxMin.php
@@ -0,0 +1,78 @@
+ $identityConstraint
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $type
+ * @param \SimpleSAML\XMLSchema\Type\MinOccursValue|null $minOccurs
+ * @param \SimpleSAML\XMLSchema\Type\MaxOccursValue|null $maxOccurs
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $fixed
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $nillable
+ * @param \SimpleSAML\XMLSchema\Type\BlockSetValue|null $block
+ * @param \SimpleSAML\XMLSchema\Type\FormChoiceValue|null $form
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ LocalSimpleType|LocalComplexType|null $localType = null,
+ array $identityConstraint = [],
+ ?QNameValue $type = null,
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ ?StringValue $default = null,
+ ?StringValue $fixed = null,
+ ?BooleanValue $nillable = null,
+ ?BlockSetValue $block = null,
+ ?FormChoiceValue $form = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::oneOf(strval($minOccurs), ['0', '1'], SchemaViolationException::class);
+ Assert::oneOf(strval($maxOccurs), ['0', '1'], SchemaViolationException::class);
+
+ parent::__construct(
+ name: $name,
+ reference: $reference,
+ localType: $localType,
+ identityConstraint: $identityConstraint,
+ type: $type,
+ minOccurs: $minOccurs,
+ maxOccurs: $maxOccurs,
+ default: $default,
+ fixed: $fixed,
+ nillable: $nillable,
+ block: $block,
+ form: $form,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractNoFixedFacet.php b/src/XMLSchema/XML/xs/AbstractNoFixedFacet.php
new file mode 100644
index 00000000..1c09f8a5
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractNoFixedFacet.php
@@ -0,0 +1,64 @@
+ $namespacedAttributes
+ */
+ final public function __construct(
+ ValueTypeInterface $value,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($value, null, $annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', StringValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractNumFacet.php b/src/XMLSchema/XML/xs/AbstractNumFacet.php
new file mode 100644
index 00000000..a42621c4
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractNumFacet.php
@@ -0,0 +1,67 @@
+ $namespacedAttributes
+ */
+ final public function __construct(
+ protected ValueTypeInterface $value,
+ ?BooleanValue $fixed = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::isAOf($value, NonNegativeIntegerValue::class);
+
+ parent::__construct($value, $fixed, $annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', NonNegativeIntegerValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractOpenAttrs.php b/src/XMLSchema/XML/xs/AbstractOpenAttrs.php
new file mode 100644
index 00000000..fd6d02c3
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractOpenAttrs.php
@@ -0,0 +1,41 @@
+ $attributes
+ */
+ public function __construct(
+ array $attributes = [],
+ ) {
+ /**
+ * NOTE: no elements allowed here:
+ *
+ * @see XML Schema specification (Part 1, Section 3.4.2)
+ *
+ * If no content model is specified in a restriction, the content model is effectively empty
+ * for elements unless mixed content is explicitly allowed.
+ */
+ parent::__construct([], $attributes);
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractRealGroup.php b/src/XMLSchema/XML/xs/AbstractRealGroup.php
new file mode 100644
index 00000000..3cbaee58
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractRealGroup.php
@@ -0,0 +1,65 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ ?ParticleInterface $particle = null,
+ ?NCNameValue $name = null,
+ ?QNameValue $reference = null,
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::nullOrIsInstanceOf(
+ $particle,
+ ParticleInterface::class,
+ SchemaViolationException::class,
+ );
+
+ parent::__construct(
+ $name,
+ $reference,
+ $minOccurs,
+ $maxOccurs,
+ is_null($particle) ? [] : [$particle],
+ $annotation,
+ $id,
+ $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractReferencedAttributeGroup.php b/src/XMLSchema/XML/xs/AbstractReferencedAttributeGroup.php
new file mode 100644
index 00000000..d28a7df0
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractReferencedAttributeGroup.php
@@ -0,0 +1,42 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ QNameValue $reference,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ reference: $reference,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractReferencedGroup.php b/src/XMLSchema/XML/xs/AbstractReferencedGroup.php
new file mode 100644
index 00000000..bf8106a8
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractReferencedGroup.php
@@ -0,0 +1,42 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ QNameValue $reference,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ reference: $reference,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractRestrictionType.php b/src/XMLSchema/XML/xs/AbstractRestrictionType.php
new file mode 100644
index 00000000..ad71f6b9
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractRestrictionType.php
@@ -0,0 +1,127 @@
+ $facets
+ * @param (
+ * \SimpleSAML\XMLSchema\XML\xs\LocalAttribute|
+ * \SimpleSAML\XMLSchema\XML\xs\ReferencedAttributeGroup
+ * )[] $attributes
+ * @param \SimpleSAML\XMLSchema\XML\xs\AnyAttribute|null $anyAttribute
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ protected QNameValue $base,
+ // xs:typeDefParticle
+ ?TypeDefParticleInterface $particle = null,
+ // xs:simpleRestrictionModel
+ protected ?LocalSimpleType $localSimpleType = null,
+ array $facets = [],
+ // xs:attrDecls
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ // parent defined
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ // The xs:typeDefParticle and xs:simpleRestrictionModel groups are mutually exclusive
+ if ($particle !== null) {
+ Assert::null($localSimpleType, SchemaViolationException::class);
+ Assert::isEmpty($facets, SchemaViolationException::class);
+ } elseif ($localSimpleType !== null || $facets !== []) {
+ $this->setSimpleType($localSimpleType);
+ $this->setFacets($facets);
+ }
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setAttributes($attributes);
+ $this->setAnyAttribute($anyAttribute);
+ $this->setParticle($particle);
+ }
+
+
+ /**
+ * Collect the value of the localSimpleType-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType|null
+ */
+ public function getLocalSimpleType(): ?LocalSimpleType
+ {
+ return $this->localSimpleType;
+ }
+
+
+ /**
+ * Collect the value of the base-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue
+ */
+ public function getBase(): ?QNameValue
+ {
+ return $this->base;
+ }
+
+
+ /**
+ * Add this RestrictionType to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this RestrictionType to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getParticle() !== null) {
+ $this->getParticle()->toXML($e);
+ } elseif ($this->getLocalSimpleType() !== null || $this->getFacets() !== []) {
+ $this->getLocalSimpleType()?->toXML($e);
+
+ foreach ($this->getFacets() as $facet) {
+ $facet->toXML($e);
+ }
+ }
+
+ foreach ($this->getAttributes() as $attr) {
+ $attr->toXML($e);
+ }
+
+ $this->getAnyAttribute()?->toXML($e);
+
+ if ($this->getBase() !== null) {
+ $e->setAttribute('base', strval($this->getBase()));
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractSimpleExplicitGroup.php b/src/XMLSchema/XML/xs/AbstractSimpleExplicitGroup.php
new file mode 100644
index 00000000..838e8b6f
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractSimpleExplicitGroup.php
@@ -0,0 +1,42 @@
+ $nestedParticles
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ array $nestedParticles = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ nestedParticles: $nestedParticles,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractSimpleExtensionType.php b/src/XMLSchema/XML/xs/AbstractSimpleExtensionType.php
new file mode 100644
index 00000000..136e2839
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractSimpleExtensionType.php
@@ -0,0 +1,48 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ QNameValue $base,
+ // xs:attrDecls
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ // parent defined
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ base: $base,
+ attributes: $attributes,
+ anyAttribute: $anyAttribute,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractSimpleRestrictionType.php b/src/XMLSchema/XML/xs/AbstractSimpleRestrictionType.php
new file mode 100644
index 00000000..a93c55ba
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractSimpleRestrictionType.php
@@ -0,0 +1,55 @@
+ $facets
+ * @param (
+ * \SimpleSAML\XMLSchema\XML\xs\LocalAttribute|
+ * \SimpleSAML\XMLSchema\XML\xs\ReferencedAttributeGroup
+ * )[] $attributes
+ * @param \SimpleSAML\XMLSchema\XML\xs\AnyAttribute|null $anyAttribute
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ QNameValue $base,
+ // xs:simpleRestrictionModel
+ ?LocalSimpleType $localSimpleType = null,
+ array $facets = [],
+ // xs:attrDecls
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ // parent defined
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ base: $base,
+ localSimpleType: $localSimpleType,
+ facets: $facets,
+ attributes: $attributes,
+ anyAttribute: $anyAttribute,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractSimpleType.php b/src/XMLSchema/XML/xs/AbstractSimpleType.php
new file mode 100644
index 00000000..13e95cf2
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractSimpleType.php
@@ -0,0 +1,103 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ SimpleDerivationInterface $derivation,
+ protected ?NCNameValue $name = null,
+ protected ?SimpleDerivationSetValue $final = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ $this->setDerivation($derivation);
+ }
+
+
+ /**
+ * Collect the value of the final-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\SimpleDerivationSetValue|null
+ */
+ public function getFinal(): ?SimpleDerivationSetValue
+ {
+ return $this->final;
+ }
+
+
+ /**
+ * Collect the value of the name-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null
+ */
+ public function getName(): ?NCNameValue
+ {
+ return $this->name;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return false;
+ }
+
+
+ /**
+ * Add this SimpleType to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this SimpleType to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getFinal() !== null) {
+ $e->setAttribute('final', strval($this->getFinal()));
+ }
+
+ if ($this->getName() !== null) {
+ $e->setAttribute('name', strval($this->getName()));
+ }
+
+ $this->getDerivation()->toXML($e);
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractTopLevelAttribute.php b/src/XMLSchema/XML/xs/AbstractTopLevelAttribute.php
new file mode 100644
index 00000000..972a8772
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractTopLevelAttribute.php
@@ -0,0 +1,54 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ NCNameValue $name,
+ ?QNameValue $type = null,
+ ?StringValue $default = null,
+ ?StringValue $fixed = null,
+ ?LocalSimpleType $simpleType = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ name: $name,
+ type: $type,
+ default: $default,
+ fixed: $fixed,
+ simpleType: $simpleType,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractTopLevelComplexType.php b/src/XMLSchema/XML/xs/AbstractTopLevelComplexType.php
new file mode 100644
index 00000000..8207e8ff
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractTopLevelComplexType.php
@@ -0,0 +1,65 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ NCNameValue $name,
+ ?BooleanValue $mixed = null,
+ ?BooleanValue $abstract = null,
+ ?DerivationSetValue $final = null,
+ ?DerivationSetValue $block = null,
+ SimpleContent|ComplexContent|null $content = null,
+ ?TypeDefParticleInterface $particle = null,
+ array $attributes = [],
+ ?AnyAttribute $anyAttribute = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ $name,
+ $mixed,
+ $abstract,
+ $final,
+ $block,
+ $content,
+ $particle,
+ $attributes,
+ $anyAttribute,
+ $annotation,
+ $id,
+ $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractTopLevelElement.php b/src/XMLSchema/XML/xs/AbstractTopLevelElement.php
new file mode 100644
index 00000000..02f6a8f7
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractTopLevelElement.php
@@ -0,0 +1,68 @@
+ $identityConstraint
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $type
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $substitutionGroup
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $default
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $fixed
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $nillable
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $abstract
+ * @param \SimpleSAML\XMLSchema\Type\DerivationSetValue|null $final
+ * @param \SimpleSAML\XMLSchema\Type\BlockSetValue|null $block
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ NCNameValue $name,
+ LocalSimpleType|LocalComplexType|null $localType = null,
+ array $identityConstraint = [],
+ ?QNameValue $type = null,
+ ?QNameValue $substitutionGroup = null,
+ ?StringValue $default = null,
+ ?StringValue $fixed = null,
+ ?BooleanValue $nillable = null,
+ ?BooleanValue $abstract = null,
+ ?DerivationSetValue $final = null,
+ ?BlockSetValue $block = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct(
+ name: $name,
+ localType: $localType,
+ identityConstraint: $identityConstraint,
+ type: $type,
+ substitutionGroup: $substitutionGroup,
+ default: $default,
+ fixed: $fixed,
+ nillable: $nillable,
+ abstract: $abstract,
+ final: $final,
+ block: $block,
+ annotation: $annotation,
+ id: $id,
+ namespacedAttributes: $namespacedAttributes,
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractTopLevelSimpleType.php b/src/XMLSchema/XML/xs/AbstractTopLevelSimpleType.php
new file mode 100644
index 00000000..cdfba48a
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractTopLevelSimpleType.php
@@ -0,0 +1,45 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ Union|XsList|Restriction $derivation,
+ NCNameValue $name,
+ ?SimpleDerivationSetValue $final = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::notNull($name, SchemaViolationException::class);
+
+ parent::__construct($derivation, $name, $final, $annotation, $id, $namespacedAttributes);
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractWildcard.php b/src/XMLSchema/XML/xs/AbstractWildcard.php
new file mode 100644
index 00000000..c3f18087
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractWildcard.php
@@ -0,0 +1,95 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ?NamespaceListValue $namespace = null,
+ protected ?ProcessContentsValue $processContents = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the namespace-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\NamespaceListValue|null
+ */
+ public function getNamespace(): ?NamespaceListValue
+ {
+ return $this->namespace;
+ }
+
+
+ /**
+ * Collect the value of the processContents-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\ProcessContentsValue|null
+ */
+ public function getProcessContents(): ?ProcessContentsValue
+ {
+ return $this->processContents;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getNamespace()) &&
+ empty($this->getProcessContents());
+ }
+
+
+ /**
+ * Add this Wildcard to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Wildcard to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getNamespace() !== null) {
+ $e->setAttribute('namespace', strval($this->getNamespace()));
+ }
+
+ if ($this->getProcessContents() !== null) {
+ $e->setAttribute('processContents', strval($this->getProcessContents()));
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AbstractXsElement.php b/src/XMLSchema/XML/xs/AbstractXsElement.php
new file mode 100644
index 00000000..ce285a9f
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AbstractXsElement.php
@@ -0,0 +1,25 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ // The annotation
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ // The content
+ $narrowMaxMin = NarrowMaxMinElement::getChildrenOfClass($xml);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'minCount', MinOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'maxCount', MaxOccursValue::class, null),
+ $narrowMaxMin,
+ annotation: array_pop($annotation),
+ id: self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ namespacedAttributes: self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Annotation.php b/src/XMLSchema/XML/xs/Annotation.php
new file mode 100644
index 00000000..05cd9e61
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Annotation.php
@@ -0,0 +1,140 @@
+ $appinfo
+ * @param array<\SimpleSAML\XMLSchema\XML\xs\Documentation> $documentation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ protected array $appinfo,
+ protected array $documentation,
+ protected ?IDValue $id,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::allIsInstanceOf($appinfo, Appinfo::class, SchemaViolationException::class);
+ Assert::allIsInstanceOf($documentation, Documentation::class, SchemaViolationException::class);
+
+ parent::__construct($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the appinfo-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\Appinfo[]
+ */
+ public function getAppinfo(): array
+ {
+ return $this->appinfo;
+ }
+
+
+ /**
+ * Collect the value of the documentation-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\Documentation[]
+ */
+ public function getDocumentation(): array
+ {
+ return $this->documentation;
+ }
+
+
+ /**
+ * Collect the value of the id-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null
+ */
+ public function getId(): ?IDValue
+ {
+ return $this->id;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getAppinfo()) &&
+ empty($this->getDocumentation()) &&
+ empty($this->id);
+ }
+
+
+ /**
+ * Create a class from XML
+ *
+ * @param \DOMElement $xml
+ * @return static
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ return new static(
+ Appinfo::getChildrenOfClass($xml),
+ Documentation::getChildrenOfClass($xml),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Add this Annotation to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Annotation to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getId() !== null) {
+ $e->setAttribute('id', strval($this->getId()));
+ }
+
+ foreach ($this->getAppinfo() as $appinfo) {
+ $appinfo->toXML($e);
+ }
+
+ foreach ($this->getDocumentation() as $documentation) {
+ $documentation->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Any.php b/src/XMLSchema/XML/xs/Any.php
new file mode 100644
index 00000000..927b9635
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Any.php
@@ -0,0 +1,123 @@
+ $namespacedAttributes
+ * @param \SimpleSAML\XMLSchema\Type\MinOccursValue|null $minOccurs
+ * @param \SimpleSAML\XMLSchema\Type\MaxOccursValue|null $maxOccurs
+ */
+ public function __construct(
+ protected ?NamespaceListValue $namespace = null,
+ protected ?ProcessContentsValue $processContents = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ?MinOccursValue $minOccurs = null,
+ ?MaxOccursValue $maxOccurs = null,
+ ) {
+ parent::__construct($namespace, $processContents, $annotation, $id, $namespacedAttributes);
+
+ $this->setMinOccurs($minOccurs);
+ $this->setMaxOccurs($maxOccurs);
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getMinOccurs()) &&
+ empty($this->getMaxOccurs());
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'namespace', NamespaceListValue::class, null),
+ self::getOptionalAttribute($xml, 'processContents', ProcessContentsValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursvalue::class, null),
+ );
+ }
+
+
+ /**
+ * Add this Wildcard to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Wildcard to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getMinOccurs() !== null) {
+ $e->setAttribute('minOccurs', strval($this->getMinOccurs()));
+ }
+
+ if ($this->getMaxOccurs() !== null) {
+ $e->setAttribute('maxOccurs', strval($this->getMaxOccurs()));
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AnyAttribute.php b/src/XMLSchema/XML/xs/AnyAttribute.php
new file mode 100644
index 00000000..0a371ba1
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AnyAttribute.php
@@ -0,0 +1,54 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'namespace', NamespaceListValue::class, null),
+ self::getOptionalAttribute($xml, 'processContents', ProcessContentsValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Appinfo.php b/src/XMLSchema/XML/xs/Appinfo.php
new file mode 100644
index 00000000..a44a0b97
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Appinfo.php
@@ -0,0 +1,132 @@
+ $content
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null $source
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ final public function __construct(
+ protected DOMNodeList $content,
+ protected ?AnyURIValue $source = null,
+ array $namespacedAttributes = [],
+ ) {
+ $this->setAttributesNS($namespacedAttributes);
+ }
+
+
+ /**
+ * Get the content property.
+ *
+ * @return \DOMNodeList<\DOMNode>
+ */
+ public function getContent(): DOMNodeList
+ {
+ return $this->content;
+ }
+
+
+ /**
+ * Get the source property.
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
+ */
+ public function getSource(): ?AnyURIValue
+ {
+ return $this->source;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return $this->getContent()->count() === 0
+ && empty($this->getSource())
+ && empty($this->getAttributesNS());
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ return new static(
+ $xml->childNodes,
+ self::getOptionalAttribute($xml, 'source', AnyURIValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Add this Appinfo to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Appinfo to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::instantiateParentElement($parent);
+
+ if ($this->getSource() !== null) {
+ $e->setAttribute('source', strval($this->getSource()));
+ }
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ foreach ($this->getContent() as $i) {
+ $e->appendChild($e->ownerDocument->importNode($i, true));
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/AttrDeclsTrait.php b/src/XMLSchema/XML/xs/AttrDeclsTrait.php
new file mode 100644
index 00000000..8938d73e
--- /dev/null
+++ b/src/XMLSchema/XML/xs/AttrDeclsTrait.php
@@ -0,0 +1,89 @@
+attributes;
+ }
+
+
+ /**
+ * Collect the value of the anyAttribute-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\AnyAttribute|null
+ */
+ public function getAnyAttribute(): ?AnyAttribute
+ {
+ return $this->anyAttribute;
+ }
+
+
+ /**
+ * Set the value of the attributes-property
+ *
+ * @param (
+ * \SimpleSAML\XMLSchema\XML\xs\LocalAttribute|
+ * \SimpleSAML\XMLSchema\XML\xs\ReferencedAttributeGroup
+ * )[] $attributes
+ */
+ protected function setAttributes(array $attributes): void
+ {
+ Assert::allIsInstanceOfAny(
+ $attributes,
+ [LocalAttribute::class, ReferencedAttributeGroup::class],
+ SchemaViolationException::class,
+ );
+
+ $this->attributes = $attributes;
+ }
+
+
+ /**
+ * Set the value of the anyAttribute-property
+ *
+ * @param \SimpleSAML\XMLSchema\XML\xs\AnyAttribute|null $anyAttribute
+ */
+ protected function setAnyAttribute(?AnyAttribute $anyAttribute): void
+ {
+ $this->anyAttribute = $anyAttribute;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Choice.php b/src/XMLSchema/XML/xs/Choice.php
new file mode 100644
index 00000000..f3a67ce9
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Choice.php
@@ -0,0 +1,75 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $any = Any::getChildrenOfClass($xml);
+ $choice = Choice::getChildrenOfClass($xml);
+ $localElement = LocalElement::getChildrenOfClass($xml);
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ $sequence = Sequence::getChildrenOfClass($xml);
+
+ $particles = array_merge($any, $choice, $localElement, $referencedGroup, $sequence);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursValue::class, null),
+ $particles,
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/ComplexContent.php b/src/XMLSchema/XML/xs/ComplexContent.php
new file mode 100644
index 00000000..28f33c89
--- /dev/null
+++ b/src/XMLSchema/XML/xs/ComplexContent.php
@@ -0,0 +1,136 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ComplexRestriction|Extension $content,
+ protected ?BooleanValue $mixed = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the content-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\ComplexRestriction|\SimpleSAML\XMLSchema\XML\xs\Extension
+ */
+ public function getContent(): ComplexRestriction|Extension
+ {
+ return $this->content;
+ }
+
+
+ /**
+ * Collect the value of the mixed-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
+ */
+ public function getMixed(): ?BooleanValue
+ {
+ return $this->mixed;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return false;
+ }
+
+
+ /**
+ * Add this ComplexContent to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this ComplexContent to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getMixed() !== null) {
+ $e->setAttribute('mixed', strval($this->getMixed()));
+ }
+
+ $this->getContent()->toXML($e);
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $complexRestriction = ComplexRestriction::getChildrenOfClass($xml);
+ Assert::maxCount($complexRestriction, 1, TooManyElementsException::class);
+
+ $extension = Extension::getChildrenOfClass($xml);
+ Assert::maxCount($extension, 1, TooManyElementsException::class);
+
+ $content = array_merge($complexRestriction, $extension);
+ Assert::maxCount($content, 1, TooManyElementsException::class);
+
+ return new static(
+ $content[0],
+ self::getOptionalAttribute($xml, 'mixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/ComplexRestriction.php b/src/XMLSchema/XML/xs/ComplexRestriction.php
new file mode 100644
index 00000000..fd288aab
--- /dev/null
+++ b/src/XMLSchema/XML/xs/ComplexRestriction.php
@@ -0,0 +1,75 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ Assert::maxCount($referencedGroup, 1, TooManyElementsException::class);
+
+ $all = All::getChildrenOfClass($xml);
+ Assert::maxCount($all, 1, TooManyElementsException::class);
+
+ $choice = Choice::getChildrenOfClass($xml);
+ Assert::maxCount($choice, 1, TooManyElementsException::class);
+
+ $sequence = Sequence::getChildrenOfClass($xml);
+ Assert::maxCount($sequence, 1, TooManyElementsException::class);
+
+ $particles = array_merge($referencedGroup, $all, $choice, $sequence);
+ Assert::maxCount($particles, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $referencedAttributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $referencedAttributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+ Assert::maxCount($anyAttribute, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'base', QNameValue::class),
+ array_pop($particles),
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/ComplexTypeModelTrait.php b/src/XMLSchema/XML/xs/ComplexTypeModelTrait.php
new file mode 100644
index 00000000..ed289736
--- /dev/null
+++ b/src/XMLSchema/XML/xs/ComplexTypeModelTrait.php
@@ -0,0 +1,45 @@
+content;
+ }
+
+
+ /**
+ * Set the value of the content-property
+ *
+ * @param \SimpleSAML\XMLSchema\XML\xs\SimpleContent|\SimpleSAML\XMLSchema\XML\xs\ComplexContent|null $content
+ */
+ protected function setContent(SimpleContent|ComplexContent|null $content = null): void
+ {
+ $this->content = $content;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/DefRefTrait.php b/src/XMLSchema/XML/xs/DefRefTrait.php
new file mode 100644
index 00000000..ae33527a
--- /dev/null
+++ b/src/XMLSchema/XML/xs/DefRefTrait.php
@@ -0,0 +1,74 @@
+name;
+ }
+
+
+ /**
+ * Set the value of the name-property
+ *
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue|null $name
+ */
+ protected function setName(?NCNameValue $name): void
+ {
+ $this->name = $name;
+ }
+
+
+ /**
+ * Collect the value of the reference-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null
+ */
+ public function getReference(): ?QNameValue
+ {
+ return $this->reference;
+ }
+
+
+ /**
+ * Set the value of the reference-property
+ *
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null $reference
+ */
+ protected function setReference(?QNameValue $reference): void
+ {
+ $this->reference = $reference;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/DerivationControlEnum.php b/src/XMLSchema/XML/xs/DerivationControlEnum.php
new file mode 100644
index 00000000..88b42616
--- /dev/null
+++ b/src/XMLSchema/XML/xs/DerivationControlEnum.php
@@ -0,0 +1,14 @@
+ $content
+ * @param \SimpleSAML\XML\Attribute|null $lang
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null $source
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ final public function __construct(
+ protected DOMNodeList $content,
+ protected ?XMLAttribute $lang = null,
+ protected ?AnyURIValue $source = null,
+ array $namespacedAttributes = [],
+ ) {
+ $this->setAttributesNS($namespacedAttributes);
+ }
+
+
+ /**
+ * Get the content property.
+ *
+ * @return \DOMNodeList<\DOMNode>
+ */
+ public function getContent(): DOMNodeList
+ {
+ return $this->content;
+ }
+
+
+ /**
+ * Get the lang property.
+ *
+ * @return \SimpleSAML\XML\Attribute|null
+ */
+ public function getLang(): ?XMLAttribute
+ {
+ return $this->lang;
+ }
+
+
+ /**
+ * Get the source property.
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
+ */
+ public function getSource(): ?AnyURIValue
+ {
+ return $this->source;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return $this->getContent()->count() === 0
+ && empty($this->getLang())
+ && empty($this->getSource())
+ && empty($this->getAttributesNS());
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $lang = null;
+ if ($xml->hasAttributeNS(C::NS_XML, 'lang')) {
+ $lang = new XMLAttribute(
+ C::NS_XML,
+ 'xml',
+ 'lang',
+ StringValue::fromString($xml->getAttributeNS(C::NS_XML, 'lang')),
+ );
+ }
+
+ return new static(
+ $xml->childNodes,
+ $lang,
+ self::getOptionalAttribute($xml, 'source', AnyURIValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Add this Documentation to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Documentation to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::instantiateParentElement($parent);
+
+ if ($this->getSource() !== null) {
+ $e->setAttribute('source', strval($this->getSource()));
+ }
+
+ if ($this->getLang() !== null) {
+ $this->getLang()->toXML($e);
+ }
+
+ foreach ($this->getAttributesNS() as $attr) {
+ $attr->toXML($e);
+ }
+
+ foreach ($this->getContent() as $i) {
+ $e->appendChild($e->ownerDocument->importNode($i, true));
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Enumeration.php b/src/XMLSchema/XML/xs/Enumeration.php
new file mode 100644
index 00000000..2fb7f7df
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Enumeration.php
@@ -0,0 +1,20 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ Assert::maxCount($referencedGroup, 1, TooManyElementsException::class);
+
+ $all = All::getChildrenOfClass($xml);
+ Assert::maxCount($all, 1, TooManyElementsException::class);
+
+ $choice = Choice::getChildrenOfClass($xml);
+ Assert::maxCount($choice, 1, TooManyElementsException::class);
+
+ $sequence = Sequence::getChildrenOfClass($xml);
+ Assert::maxCount($sequence, 1, TooManyElementsException::class);
+
+ $particles = array_merge($referencedGroup, $all, $choice, $sequence);
+ Assert::maxCount($particles, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $attributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $attributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+ Assert::maxCount($anyAttribute, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'base', QNameValue::class),
+ array_pop($particles),
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/FacetInterface.php b/src/XMLSchema/XML/xs/FacetInterface.php
new file mode 100644
index 00000000..5e5f1111
--- /dev/null
+++ b/src/XMLSchema/XML/xs/FacetInterface.php
@@ -0,0 +1,16 @@
+facets;
+ }
+
+
+ /**
+ * Set the value of the facets-property
+ *
+ * @param \SimpleSAML\XMLSchema\XML\xs\FacetInterface[] $facets
+ */
+ protected function setFacets(array $facets): void
+ {
+ Assert::maxCount($facets, C::UNBOUNDED_LIMIT);
+ Assert::allIsInstanceOf($facets, FacetInterface::class, SchemaViolationException::class);
+ $this->facets = $facets;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Field.php b/src/XMLSchema/XML/xs/Field.php
new file mode 100644
index 00000000..071d06a0
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Field.php
@@ -0,0 +1,110 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected StringValue $xpath,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::regex(strval($xpath), self::$field_regex, SchemaViolationException::class);
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the xpath-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue
+ */
+ public function getXPath(): StringValue
+ {
+ return $this->xpath;
+ }
+
+
+ /**
+ * Add this Field to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this field to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+ $e->setAttribute('xpath', strval($this->getXPath()));
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'xpath', StringValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/FormChoiceEnum.php b/src/XMLSchema/XML/xs/FormChoiceEnum.php
new file mode 100644
index 00000000..15de3e23
--- /dev/null
+++ b/src/XMLSchema/XML/xs/FormChoiceEnum.php
@@ -0,0 +1,11 @@
+formChoice;
+ }
+
+
+ /**
+ * Set the value of the formChoice-property
+ *
+ * @param \SimpleSAML\XMLSchema\Type\FormChoiceValue|null $formChoice
+ */
+ protected function setFormChoice(?FormChoiceValue $formChoice): void
+ {
+ $this->formChoice = $formChoice;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/FractionDigits.php b/src/XMLSchema/XML/xs/FractionDigits.php
new file mode 100644
index 00000000..b5146f1e
--- /dev/null
+++ b/src/XMLSchema/XML/xs/FractionDigits.php
@@ -0,0 +1,20 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ?AnyURIValue $namespace = null,
+ protected ?AnyURIValue $schemaLocation = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the namespace-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
+ */
+ public function getNamespace(): ?AnyURIValue
+ {
+ return $this->namespace;
+ }
+
+
+ /**
+ * Collect the value of the schemaLocation-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
+ */
+ public function getSchemaLocation(): ?AnyURIValue
+ {
+ return $this->schemaLocation;
+ }
+
+
+ /**
+ * Add this Import to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this import to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getNamespace() !== null) {
+ $e->setAttribute('namespace', strval($this->getNamespace()));
+ }
+
+ if ($this->getSchemaLocation() !== null) {
+ $e->setAttribute('schemaLocation', strval($this->getSchemaLocation()));
+ }
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'namespace', AnyURIValue::class, null),
+ self::getOptionalAttribute($xml, 'schemaLocation', AnyURIValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Key.php b/src/XMLSchema/XML/xs/Key.php
new file mode 100644
index 00000000..d99638f2
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Key.php
@@ -0,0 +1,79 @@
+ $field
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ NCNameValue $name,
+ Selector $selector,
+ array $field = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($name, $selector, $field, $annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $selector = Selector::getChildrenOfClass($xml);
+ Assert::maxCount($selector, 1, TooManyElementsException::class);
+
+ $field = Field::getChildrenOfClass($xml);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ $selector[0],
+ $field,
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Keyref.php b/src/XMLSchema/XML/xs/Keyref.php
new file mode 100644
index 00000000..56b525da
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Keyref.php
@@ -0,0 +1,110 @@
+ $field
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ protected QNameValue $refer,
+ NCNameValue $name,
+ Selector $selector,
+ array $field = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($name, $selector, $field, $annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the refer-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue
+ */
+ public function getRefer(): QNameValue
+ {
+ return $this->refer;
+ }
+
+
+ /**
+ * Add this Keyref to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Keyref to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+ $e->setAttribute('refer', strval($this->getRefer()));
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $selector = Selector::getChildrenOfClass($xml);
+ Assert::maxCount($selector, 1, TooManyElementsException::class);
+
+ $field = Field::getChildrenOfClass($xml);
+
+ return new static(
+ self::getAttribute($xml, 'refer', QNameValue::class),
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ $selector[0],
+ $field,
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Length.php b/src/XMLSchema/XML/xs/Length.php
new file mode 100644
index 00000000..cf1458ff
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Length.php
@@ -0,0 +1,20 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($simpleType, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'type', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'name', NCNameValue::class, null),
+ self::getOptionalAttribute($xml, 'ref', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'use', UseValue::class, null),
+ self::getOptionalAttribute($xml, 'default', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'fixed', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'form', FormChoiceValue::class, null),
+ array_pop($simpleType),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/LocalComplexType.php b/src/XMLSchema/XML/xs/LocalComplexType.php
new file mode 100644
index 00000000..50db555d
--- /dev/null
+++ b/src/XMLSchema/XML/xs/LocalComplexType.php
@@ -0,0 +1,100 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $abstract = self::getOptionalAttribute($xml, 'abstract', BooleanValue::class, null);
+ Assert::null($abstract, SchemaViolationException::class);
+
+ $final = self::getOptionalAttribute($xml, 'final', DerivationSetValue::class, null);
+ Assert::null($final, SchemaViolationException::class);
+
+ $block = self::getOptionalAttribute($xml, 'block', DerivationSetValue::class, null);
+ Assert::null($block, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleContent = SimpleContent::getChildrenOfClass($xml);
+ Assert::maxCount($simpleContent, 1, TooManyElementsException::class);
+
+ $complexContent = ComplexContent::getChildrenOfClass($xml);
+ Assert::maxCount($complexContent, 1, TooManyElementsException::class);
+
+ $content = array_merge($simpleContent, $complexContent);
+ Assert::maxCount($content, 1, TooManyElementsException::class);
+
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ Assert::maxCount($referencedGroup, 1, TooManyElementsException::class);
+
+ $all = All::getChildrenOfClass($xml);
+ Assert::maxCount($all, 1, TooManyElementsException::class);
+
+ $choice = Choice::getChildrenOfClass($xml);
+ Assert::maxCount($choice, 1, TooManyElementsException::class);
+
+ $sequence = Sequence::getChildrenOfClass($xml);
+ Assert::maxCount($sequence, 1, TooManyElementsException::class);
+
+ $particles = array_merge($referencedGroup, $all, $choice, $sequence);
+ Assert::maxCount($particles, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $referencedAttributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $referencedAttributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+ Assert::maxCount($anyAttribute, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'mixed', BooleanValue::class, null),
+ array_pop($content),
+ array_pop($particles),
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/LocalElement.php b/src/XMLSchema/XML/xs/LocalElement.php
new file mode 100644
index 00000000..6e0620f7
--- /dev/null
+++ b/src/XMLSchema/XML/xs/LocalElement.php
@@ -0,0 +1,84 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ // The local type
+ $localSimpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($localSimpleType, 1, TooManyElementsException::class);
+
+ $localComplexType = LocalComplexType::getChildrenOfClass($xml);
+ Assert::maxCount($localComplexType, 1, TooManyElementsException::class);
+
+ $localType = array_merge($localSimpleType, $localComplexType);
+ Assert::maxCount($localType, 1, TooManyElementsException::class);
+
+ // The identity constraint
+ $key = Key::getChildrenOfClass($xml);
+ Assert::maxCount($key, 1, TooManyElementsException::class);
+
+ $keyref = Keyref::getChildrenOfClass($xml);
+ Assert::maxCount($keyref, 1, TooManyElementsException::class);
+
+ $unique = Unique::getChildrenOfClass($xml);
+ Assert::maxCount($unique, 1, TooManyElementsException::class);
+
+ $identityConstraint = array_merge($key, $keyref, $unique);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'name', NCNameValue::class, null),
+ self::getOptionalAttribute($xml, 'ref', QNameValue::class, null),
+ array_pop($localType),
+ $identityConstraint,
+ self::getOptionalAttribute($xml, 'type', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'default', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'fixed', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'nillable', BooleanValue::class, null),
+ self::getOptionalAttribute($xml, 'block', BlockSetValue::class, null),
+ self::getOptionalAttribute($xml, 'form', FormChoiceValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/LocalSimpleType.php b/src/XMLSchema/XML/xs/LocalSimpleType.php
new file mode 100644
index 00000000..354a054b
--- /dev/null
+++ b/src/XMLSchema/XML/xs/LocalSimpleType.php
@@ -0,0 +1,70 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $union = Union::getChildrenOfClass($xml);
+ $xsList = XsList::getChildrenOfClass($xml);
+ $restriction = Restriction::getChildrenOfClass($xml);
+
+ $derivation = array_merge($union, $xsList, $restriction);
+ Assert::minCount($derivation, 1, MissingElementException::class);
+ Assert::maxCount($derivation, 1, TooManyElementsException::class);
+
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $final = self::getOptionalAttribute($xml, 'final', SimpleDerivationSetValue::class, null);
+ Assert::null($final, SchemaViolationException::class);
+
+ return new static(
+ $derivation[0],
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/MaxExclusive.php b/src/XMLSchema/XML/xs/MaxExclusive.php
new file mode 100644
index 00000000..5fe79253
--- /dev/null
+++ b/src/XMLSchema/XML/xs/MaxExclusive.php
@@ -0,0 +1,53 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', StringValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/MaxInclusive.php b/src/XMLSchema/XML/xs/MaxInclusive.php
new file mode 100644
index 00000000..2d9541ab
--- /dev/null
+++ b/src/XMLSchema/XML/xs/MaxInclusive.php
@@ -0,0 +1,53 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', StringValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/MaxLength.php b/src/XMLSchema/XML/xs/MaxLength.php
new file mode 100644
index 00000000..23ee61a5
--- /dev/null
+++ b/src/XMLSchema/XML/xs/MaxLength.php
@@ -0,0 +1,20 @@
+maxOccurs;
+ }
+
+
+ /**
+ * Set the value of the maxOccurs-property
+ *
+ * @param \SimpleSAML\XMLSchema\Type\MaxOccursValue|null $maxOccurs
+ */
+ protected function setMaxOccurs(?MaxOccursValue $maxOccurs): void
+ {
+ $this->maxOccurs = $maxOccurs;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/MinExclusive.php b/src/XMLSchema/XML/xs/MinExclusive.php
new file mode 100644
index 00000000..c2424141
--- /dev/null
+++ b/src/XMLSchema/XML/xs/MinExclusive.php
@@ -0,0 +1,53 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', StringValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/MinInclusive.php b/src/XMLSchema/XML/xs/MinInclusive.php
new file mode 100644
index 00000000..1e46e34d
--- /dev/null
+++ b/src/XMLSchema/XML/xs/MinInclusive.php
@@ -0,0 +1,53 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', StringValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/MinLength.php b/src/XMLSchema/XML/xs/MinLength.php
new file mode 100644
index 00000000..c958472a
--- /dev/null
+++ b/src/XMLSchema/XML/xs/MinLength.php
@@ -0,0 +1,20 @@
+minOccurs;
+ }
+
+
+ /**
+ * Set the value of the minOccurs-property
+ *
+ * @param \SimpleSAML\XMLSchema\Type\MinOccursValue|null $minOccurs
+ */
+ protected function setMinOccurs(?MinOccursValue $minOccurs): void
+ {
+ $this->minOccurs = $minOccurs;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/NamedAttributeGroup.php b/src/XMLSchema/XML/xs/NamedAttributeGroup.php
new file mode 100644
index 00000000..dc4659a8
--- /dev/null
+++ b/src/XMLSchema/XML/xs/NamedAttributeGroup.php
@@ -0,0 +1,67 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $attributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $attributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/NamedGroup.php b/src/XMLSchema/XML/xs/NamedGroup.php
new file mode 100644
index 00000000..55163d78
--- /dev/null
+++ b/src/XMLSchema/XML/xs/NamedGroup.php
@@ -0,0 +1,84 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $minCount = self::getOptionalAttribute($xml, 'minCount', MinOccursValue::class, null);
+ Assert::null($minCount, SchemaViolationException::class);
+
+ $maxCount = self::getOptionalAttribute($xml, 'maxCount', MaxOccursValue::class, null);
+ Assert::null($maxCount, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $any = All::getChildrenOfClass($xml);
+ Assert::maxCount($any, 1, TooManyElementsException::class);
+
+ $choice = Choice::getChildrenOfClass($xml);
+ Assert::maxCount($choice, 1, TooManyElementsException::class);
+
+ $sequence = Sequence::getChildrenOfClass($xml);
+ Assert::maxCount($sequence, 1, TooManyElementsException::class);
+
+ $particle = array_merge($any, $choice, $sequence);
+ Assert::maxCount($particle, 1, TooManyElementsException::class);
+
+ return new static(
+ $particle[0],
+ name: self::getAttribute($xml, 'name', NCNameValue::class),
+ annotation: array_pop($annotation),
+ id: self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ namespacedAttributes: self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/NamespaceEnum.php b/src/XMLSchema/XML/xs/NamespaceEnum.php
new file mode 100644
index 00000000..7ba57b5f
--- /dev/null
+++ b/src/XMLSchema/XML/xs/NamespaceEnum.php
@@ -0,0 +1,13 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ // The local type
+ $localSimpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($localSimpleType, 1, TooManyElementsException::class);
+
+ $localComplexType = LocalComplexType::getChildrenOfClass($xml);
+ Assert::maxCount($localComplexType, 1, TooManyElementsException::class);
+
+ $localType = array_merge($localSimpleType, $localComplexType);
+ Assert::maxCount($localType, 1, TooManyElementsException::class);
+
+ // The identity constraint
+ $key = Key::getChildrenOfClass($xml);
+ Assert::maxCount($key, 1, TooManyElementsException::class);
+
+ $keyref = Keyref::getChildrenOfClass($xml);
+ Assert::maxCount($keyref, 1, TooManyElementsException::class);
+
+ $unique = Unique::getChildrenOfClass($xml);
+ Assert::maxCount($unique, 1, TooManyElementsException::class);
+
+ $identityConstraint = array_merge($key, $keyref, $unique);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'name', NCNameValue::class, null),
+ self::getOptionalAttribute($xml, 'ref', QNameValue::class, null),
+ array_pop($localType),
+ $identityConstraint,
+ self::getOptionalAttribute($xml, 'type', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'default', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'fixed', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'nillable', BooleanValue::class, null),
+ self::getOptionalAttribute($xml, 'block', BlockSetValue::class, null),
+ self::getOptionalAttribute($xml, 'form', FormChoiceValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/NestedParticleInterface.php b/src/XMLSchema/XML/xs/NestedParticleInterface.php
new file mode 100644
index 00000000..13158736
--- /dev/null
+++ b/src/XMLSchema/XML/xs/NestedParticleInterface.php
@@ -0,0 +1,14 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected NCNameValue $name,
+ protected ?PublicValue $public = null,
+ protected ?AnyURIValue $system = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the name-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\NCNameValue
+ */
+ public function getName(): NCNameValue
+ {
+ return $this->name;
+ }
+
+
+ /**
+ * Collect the value of the public-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\PublicValue|null
+ */
+ public function getPublic(): ?PublicValue
+ {
+ return $this->public;
+ }
+
+
+ /**
+ * Collect the value of the system-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
+ */
+ public function getSystem(): ?AnyURIValue
+ {
+ return $this->system;
+ }
+
+
+ /**
+ * Add this Notation to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this notation to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ $e->setAttribute('name', strval($this->getName()));
+
+ if ($this->getPublic() !== null) {
+ $e->setAttribute('public', strval($this->getPublic()));
+ }
+
+ if ($this->getSystem() !== null) {
+ $e->setAttribute('system', strval($this->getSystem()));
+ }
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ self::getOptionalAttribute($xml, 'public', PublicValue::class, null),
+ self::getOptionalAttribute($xml, 'system', AnyURIValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/OccursTrait.php b/src/XMLSchema/XML/xs/OccursTrait.php
new file mode 100644
index 00000000..46036603
--- /dev/null
+++ b/src/XMLSchema/XML/xs/OccursTrait.php
@@ -0,0 +1,16 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected AnyURIValue $schemaLocation,
+ protected ?IDValue $id = null,
+ protected array $redefineElements = [],
+ array $namespacedAttributes = [],
+ ) {
+ Assert::allIsInstanceOfAny(
+ $redefineElements,
+ [RedefinableInterface::class, Annotation::class],
+ SchemaViolationException::class,
+ );
+
+ parent::__construct($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the redefineElements-property
+ *
+ * @return array<\SimpleSAML\XMLSchema\XML\xs\RedefinableInterface|\SimpleSAML\XMLSchema\XML\xs\Annotation>
+ */
+ public function getRedefineElements(): array
+ {
+ return $this->redefineElements;
+ }
+
+
+ /**
+ * Collect the value of the schemaLocation-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue
+ */
+ public function getSchemaLocation(): AnyURIValue
+ {
+ return $this->schemaLocation;
+ }
+
+
+ /**
+ * Collect the value of the id-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null
+ */
+ public function getID(): ?IDValue
+ {
+ return $this->id;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return false;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $allowed = [
+ 'annotation' => Annotation::class,
+ 'attributeGroup' => NamedAttributeGroup::class,
+ 'complexType' => TopLevelComplexType::class,
+ 'group' => NamedGroup::class,
+ 'simpleType' => TopLevelSimpleType::class,
+ ];
+
+ $redefineElements = [];
+ foreach ($xml->childNodes as $node) {
+ /** @var \DOMElement $node */
+ if ($node instanceof DOMElement) {
+ if ($node->namespaceURI === C::NS_XS && array_key_exists($node->localName, $allowed)) {
+ $redefineElements[] = $allowed[$node->localName]::fromXML($node);
+ }
+ }
+ }
+
+ return new static(
+ self::getAttribute($xml, 'schemaLocation', AnyURIValue::class),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ $redefineElements,
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Add this Schema to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Schema to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+ $e->setAttribute('schemaLocation', strval($this->getSchemaLocation()));
+
+ if ($this->getId() !== null) {
+ $e->setAttribute('id', strval($this->getId()));
+ }
+
+ foreach ($this->getRedefineElements() as $elt) {
+ $elt->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/ReferencedAttributeGroup.php b/src/XMLSchema/XML/xs/ReferencedAttributeGroup.php
new file mode 100644
index 00000000..008b0b95
--- /dev/null
+++ b/src/XMLSchema/XML/xs/ReferencedAttributeGroup.php
@@ -0,0 +1,53 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', QNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'ref', QNameValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/ReferencedGroup.php b/src/XMLSchema/XML/xs/ReferencedGroup.php
new file mode 100644
index 00000000..b375c56d
--- /dev/null
+++ b/src/XMLSchema/XML/xs/ReferencedGroup.php
@@ -0,0 +1,56 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ reference: self::getAttribute($xml, 'ref', QNameValue::class),
+ annotation: array_pop($annotation),
+ id: self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ namespacedAttributes: self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Restriction.php b/src/XMLSchema/XML/xs/Restriction.php
new file mode 100644
index 00000000..00b99ee5
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Restriction.php
@@ -0,0 +1,161 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ ?LocalSimpleType $simpleType = null,
+ array $facets = [],
+ protected ?QNameValue $base = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+
+ Assert::false(
+ is_null($base) && is_null($simpleType),
+ "Either a 'base' attribute must be set, or an ",
+ );
+ Assert::false(
+ !is_null($base) && !is_null($simpleType),
+ "Either a 'base' attribute must be set, or an , not both",
+ );
+
+ $this->setSimpleType($simpleType);
+ $this->setFacets($facets);
+ }
+
+
+ /**
+ * Collect the value of the base-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null
+ */
+ public function getBase(): ?QNameValue
+ {
+ return $this->base;
+ }
+
+
+ /**
+ * Add this Restriction to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this restriction to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getBase() !== null) {
+ $e->setAttribute('base', strval($this->getBase()));
+ }
+
+ $this->getSimpleType()?->toXML($e);
+
+ foreach ($this->getFacets() as $facet) {
+ /** @var \SimpleSAML\XML\SerializableElementInterface $facet */
+ $facet->toXML($e);
+ }
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($simpleType, 1, TooManyElementsException::class);
+
+ // Facets
+ $maxExclusive = MaxExclusive::getChildrenOfClass($xml);
+ $minExclusive = MinExclusive::getChildrenOfClass($xml);
+ $maxInclusive = MaxInclusive::getChildrenOfClass($xml);
+ $minInclusive = MinInclusive::getChildrenOfClass($xml);
+ $minLength = MinLength::getChildrenOfClass($xml);
+ $maxLength = MaxLength::getChildrenOfClass($xml);
+ $length = Length::getChildrenOfClass($xml);
+ $enumeration = Enumeration::getChildrenOfClass($xml);
+ $whiteSpace = WhiteSpace::getChildrenOfClass($xml);
+ $pattern = Pattern::getChildrenOfClass($xml);
+ $fractionDigits = FractionDigits::getChildrenOfClass($xml);
+ $totalDigits = TotalDigits::getChildrenOfClass($xml);
+
+ $facets = array_merge(
+ $maxExclusive,
+ $minExclusive,
+ $maxInclusive,
+ $minInclusive,
+ $minLength,
+ $maxLength,
+ $length,
+ $enumeration,
+ $whiteSpace,
+ $pattern,
+ $fractionDigits,
+ $totalDigits,
+ );
+
+ return new static(
+ array_pop($simpleType),
+ $facets,
+ self::getOptionalAttribute($xml, 'base', QNameValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Schema.php b/src/XMLSchema/XML/xs/Schema.php
new file mode 100644
index 00000000..9065c5d2
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Schema.php
@@ -0,0 +1,413 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected array $topLevelElements = [],
+ protected array $schemaTopElements = [],
+ protected ?AnyURIValue $targetNamespace = null,
+ protected ?TokenValue $version = null,
+ protected ?FullDerivationSetValue $finalDefault = null,
+ protected ?BlockSetValue $blockDefault = null,
+ protected ?FormChoiceValue $attributeFormDefault = null,
+ protected ?FormChoiceValue $elementFormDefault = null,
+ protected ?IDValue $id = null,
+ protected ?XMLAttribute $lang = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::allIsInstanceOfAny(
+ $topLevelElements,
+ [XsInclude::class, Import::class, Redefine::class, Annotation::class],
+ SchemaViolationException::class,
+ );
+ Assert::allIsInstanceOfAny(
+ $schemaTopElements,
+ [
+ RedefinableInterface::class,
+ TopLevelAttribute::class,
+ TopLevelElement::class,
+ Notation::class,
+ Annotation::class,
+ ],
+ SchemaViolationException::class,
+ );
+
+ parent::__construct($namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the topLevelElements-property
+ *
+ * @return (
+ * \SimpleSAML\XMLSchema\XML\xs\XsInclude|
+ * \SimpleSAML\XMLSchema\XML\xs\Import|
+ * \SimpleSAML\XMLSchema\XML\xs\Redefine|
+ * \SimpleSAML\XMLSchema\XML\xs\Annotation
+ * )[]
+ */
+ public function getTopLevelElements(): array
+ {
+ return $this->topLevelElements;
+ }
+
+
+ /**
+ * Collect the value of the schemaTopElements-property
+ *
+ * @return (
+ * \SimpleSAML\XMLSchema\XML\xs\RedefinableInterface|
+ * \SimpleSAML\XMLSchema\XML\xs\TopLevelAttribute|
+ * \SimpleSAML\XMLSchema\XML\xs\TopLevelElement|
+ * \SimpleSAML\XMLSchema\XML\xs\Notation|
+ * \SimpleSAML\XMLSchema\XML\xs\Annotation
+ * )[]
+ */
+ public function getSchemaTopElements(): array
+ {
+ return $this->schemaTopElements;
+ }
+
+
+ /**
+ * Collect the value of the targetNamespace-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue|null
+ */
+ public function getTargetNamespace(): ?AnyURIValue
+ {
+ return $this->targetNamespace;
+ }
+
+
+ /**
+ * Collect the value of the version-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\TokenValue|null
+ */
+ public function getVersion(): ?TokenValue
+ {
+ return $this->version;
+ }
+
+
+ /**
+ * Collect the value of the blockDefault-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\BlockSetValue|null
+ */
+ public function getBlockDefault(): ?BlockSetValue
+ {
+ return $this->blockDefault;
+ }
+
+
+ /**
+ * Collect the value of the finalDefault-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\FullDerivationSetValue|null
+ */
+ public function getFinalDefault(): ?FullDerivationSetValue
+ {
+ return $this->finalDefault;
+ }
+
+
+ /**
+ * Collect the value of the attributeFormDefault-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\FormChoiceValue|null
+ */
+ public function getAttributeFormDefault(): ?FormChoiceValue
+ {
+ return $this->attributeFormDefault;
+ }
+
+
+ /**
+ * Collect the value of the elementFormDefault-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\FormChoiceValue|null
+ */
+ public function getElementFormDefault(): ?FormChoiceValue
+ {
+ return $this->elementFormDefault;
+ }
+
+
+ /**
+ * Collect the value of the id-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null
+ */
+ public function getID(): ?IDValue
+ {
+ return $this->id;
+ }
+
+
+ /**
+ * Collect the value of the lang-property
+ *
+ * @return \SimpleSAML\XML\Attribute|null
+ */
+ public function getLang(): ?XMLAttribute
+ {
+ return $this->lang;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return parent::isEmptyElement() &&
+ empty($this->getTopLevelElements()) &&
+ empty($this->getSchemaTopElements()) &&
+ empty($this->getTargetNamespace()) &&
+ empty($this->getVersion()) &&
+ empty($this->getFinalDefault()) &&
+ empty($this->getBlockDefault()) &&
+ empty($this->getAttributeFormDefault()) &&
+ empty($this->getElementFormDefault()) &&
+ empty($this->getId()) &&
+ empty($this->getLang());
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $xpCache = XPath::getXPath($xml);
+
+ $beforeAllowed = [
+ 'annotation' => Annotation::class,
+ 'import' => Import::class,
+ 'include' => XsInclude::class,
+ 'redefine' => Redefine::class,
+ ];
+ $beforeSchemaTopElements = XPath::xpQuery(
+ $xml,
+ '('
+ . '/xs:schema/xs:group|'
+ . '/xs:schema/xs:attributeGroup|'
+ . '/xs:schema/xs:complexType|'
+ . '/xs:schema/xs:simpleType|'
+ . '/xs:schema/xs:element|'
+ . '/xs:schema/xs:attribute'
+ . ')[1]/preceding-sibling::xs:*',
+ $xpCache,
+ );
+
+ $topLevelElements = [];
+ foreach ($beforeSchemaTopElements as $node) {
+ /** @var \DOMElement $node */
+ if ($node instanceof DOMElement) {
+ if ($node->namespaceURI === C::NS_XS && array_key_exists($node->localName, $beforeAllowed)) {
+ $topLevelElements[] = $beforeAllowed[$node->localName]::fromXML($node);
+ }
+ }
+ }
+
+ $afterAllowed = [
+ 'annotation' => Annotation::class,
+ 'attribute' => TopLevelAttribute::class,
+ 'attributeGroup' => NamedAttributeGroup::class,
+ 'complexType' => TopLevelComplexType::class,
+ 'element' => TopLevelElement::class,
+ 'notation' => Notation::class,
+ 'simpleType' => TopLevelSimpleType::class,
+ ];
+ $afterSchemaTopElementFirstHit = XPath::xpQuery(
+ $xml,
+ '('
+ . '/xs:schema/xs:group|'
+ . '/xs:schema/xs:attributeGroup|'
+ . '/xs:schema/xs:complexType'
+ . '/xs:schema/xs:simpleType|'
+ . '/xs:schema/xs:element|'
+ . '/xs:schema/xs:attribute'
+ . ')[1]',
+ $xpCache,
+ );
+
+ $afterSchemaTopElementSibling = XPath::xpQuery(
+ $xml,
+ '('
+ . '/xs:schema/xs:group|'
+ . '/xs:schema/xs:attributeGroup|'
+ . '/xs:schema/xs:complexType'
+ . '/xs:schema/xs:simpleType|'
+ . '/xs:schema/xs:element|'
+ . '/xs:schema/xs:attribute'
+ . ')[1]/following-sibling::xs:*',
+ $xpCache,
+ );
+
+ $afterSchemaTopElements = array_merge($afterSchemaTopElementFirstHit, $afterSchemaTopElementSibling);
+
+ $schemaTopElements = [];
+ foreach ($afterSchemaTopElements as $node) {
+ /** @var \DOMElement $node */
+ if ($node instanceof DOMElement) {
+ if ($node->namespaceURI === C::NS_XS && array_key_exists($node->localName, $afterAllowed)) {
+ $schemaTopElements[] = $afterAllowed[$node->localName]::fromXML($node);
+ }
+ }
+ }
+
+ $lang = null;
+ if ($xml->hasAttributeNS(C::NS_XML, 'lang')) {
+ $lang = new XMLAttribute(
+ C::NS_XML,
+ 'xml',
+ 'lang',
+ StringValue::fromString($xml->getAttributeNS(C::NS_XML, 'lang')),
+ );
+ }
+
+ return new static(
+ $topLevelElements,
+ $schemaTopElements,
+ self::getOptionalAttribute($xml, 'targetNamespace', AnyURIValue::class, null),
+ self::getOptionalAttribute($xml, 'version', TokenValue::class, null),
+ self::getOptionalAttribute($xml, 'finalDefault', FullDerivationSetValue::class, null),
+ self::getOptionalAttribute($xml, 'blockDefault', BlockSetValue::class, null),
+ self::getOptionalAttribute($xml, 'attributeFormDefault', FormChoiceValue::class, null),
+ self::getOptionalAttribute($xml, 'elementFormDefault', FormChoiceValue::class, null),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ $lang,
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+
+
+ /**
+ * Add this Schema to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this Schema to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getTargetNamespace() !== null) {
+ $e->setAttribute('targetNamespace', strval($this->getTargetNamespace()));
+ }
+
+ if ($this->getVersion() !== null) {
+ $e->setAttribute('version', strval($this->getVersion()));
+ }
+
+ if ($this->getFinalDefault() !== null) {
+ $e->setAttribute('finalDefault', strval($this->getFinalDefault()));
+ }
+
+ if ($this->getBlockDefault() !== null) {
+ $e->setAttribute('blockDefault', strval($this->getBlockDefault()));
+ }
+
+ if ($this->getAttributeFormDefault() !== null) {
+ $e->setAttribute('attributeFormDefault', strval($this->getAttributeFormDefault()));
+ }
+
+ if ($this->getElementFormDefault() !== null) {
+ $e->setAttribute('elementFormDefault', strval($this->getElementFormDefault()));
+ }
+
+ if ($this->getId() !== null) {
+ $e->setAttribute('id', strval($this->getId()));
+ }
+
+ if ($this->getLang() !== null) {
+ $this->getLang()->toXML($e);
+ }
+
+ foreach ($this->getTopLevelElements() as $tle) {
+ $tle->toXML($e);
+ }
+
+ foreach ($this->getSchemaTopElements() as $ste) {
+ $ste->toXML($e);
+ }
+
+ return $e;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SchemaTopInterface.php b/src/XMLSchema/XML/xs/SchemaTopInterface.php
new file mode 100644
index 00000000..f3fe6693
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SchemaTopInterface.php
@@ -0,0 +1,16 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected StringValue $xpath,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::regex(strval($xpath), self::$selector_regex, SchemaViolationException::class);
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the xpath-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue
+ */
+ public function getXPath(): StringValue
+ {
+ return $this->xpath;
+ }
+
+
+ /**
+ * Add this Selector to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this selector to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+ $e->setAttribute('xpath', strval($this->getXPath()));
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'xpath', StringValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Sequence.php b/src/XMLSchema/XML/xs/Sequence.php
new file mode 100644
index 00000000..5736e1f6
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Sequence.php
@@ -0,0 +1,75 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $any = Any::getChildrenOfClass($xml);
+ $choice = Choice::getChildrenOfClass($xml);
+ $localElement = LocalElement::getChildrenOfClass($xml);
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ $sequence = Sequence::getChildrenOfClass($xml);
+
+ $particles = array_merge($any, $choice, $localElement, $referencedGroup, $sequence);
+
+ return new static(
+ self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null),
+ self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursValue::class, null),
+ $particles,
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleChoice.php b/src/XMLSchema/XML/xs/SimpleChoice.php
new file mode 100644
index 00000000..9f08e6fd
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleChoice.php
@@ -0,0 +1,73 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $minOccurs = self::getOptionalAttribute($xml, 'minOccurs', MinOccursValue::class, null);
+ Assert::null($minOccurs, SchemaViolationException::class);
+
+ $maxOccurs = self::getOptionalAttribute($xml, 'maxOccurs', MaxOccursValue::class, null);
+ Assert::null($maxOccurs, SchemaViolationException::class);
+
+ // Start here
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $any = Any::getChildrenOfClass($xml);
+ $choice = Choice::getChildrenOfClass($xml);
+ $localElement = LocalElement::getChildrenOfClass($xml);
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ $sequence = Sequence::getChildrenOfClass($xml);
+
+ $particles = array_merge($any, $choice, $localElement, $referencedGroup, $sequence);
+
+ return new static(
+ nestedParticles: $particles,
+ annotation: array_pop($annotation),
+ id: self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ namespacedAttributes: self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleContent.php b/src/XMLSchema/XML/xs/SimpleContent.php
new file mode 100644
index 00000000..81b8b5ec
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleContent.php
@@ -0,0 +1,117 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected SimpleRestriction|SimpleExtension $content,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the content-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\SimpleRestriction|\SimpleSAML\XMLSchema\XML\xs\SimpleExtension
+ */
+ public function getContent(): SimpleRestriction|SimpleExtension
+ {
+ return $this->content;
+ }
+
+
+ /**
+ * Test if an object, at the state it's in, would produce an empty XML-element
+ *
+ * @return bool
+ */
+ public function isEmptyElement(): bool
+ {
+ return false;
+ }
+
+
+ /**
+ * Add this SimpleContent to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this SimpleContent to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ $this->getContent()->toXML($e);
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleRestriction = SimpleRestriction::getChildrenOfClass($xml);
+ Assert::maxCount($simpleRestriction, 1, TooManyElementsException::class);
+
+ $simpleExtension = SimpleExtension::getChildrenOfClass($xml);
+ Assert::maxCount($simpleExtension, 1, TooManyElementsException::class);
+
+ $content = array_merge($simpleRestriction, $simpleExtension);
+ Assert::maxCount($content, 1, TooManyElementsException::class);
+
+ return new static(
+ $content[0],
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleDerivationInterface.php b/src/XMLSchema/XML/xs/SimpleDerivationInterface.php
new file mode 100644
index 00000000..c09957ab
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleDerivationInterface.php
@@ -0,0 +1,16 @@
+derivation;
+ }
+
+
+ /**
+ * Set the value of the derivation-property
+ *
+ * @param \SimpleSAML\XMLSchema\XML\xs\SimpleDerivationInterface $derivation
+ */
+ protected function setDerivation(SimpleDerivationInterface $derivation): void
+ {
+ $this->derivation = $derivation;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleExtension.php b/src/XMLSchema/XML/xs/SimpleExtension.php
new file mode 100644
index 00000000..f96acdf2
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleExtension.php
@@ -0,0 +1,59 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $attributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $attributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+ Assert::maxCount($anyAttribute, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'base', QNameValue::class),
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleRestriction.php b/src/XMLSchema/XML/xs/SimpleRestriction.php
new file mode 100644
index 00000000..3b1baa56
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleRestriction.php
@@ -0,0 +1,92 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $attributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $attributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+ Assert::maxCount($anyAttribute, 1, TooManyElementsException::class);
+
+ $localSimpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($localSimpleType, 1, TooManyElementsException::class);
+
+ $minExclusive = MinExclusive::getChildrenOfClass($xml);
+ $minInclusive = MinInclusive::getChildrenOfClass($xml);
+ $maxExclusive = MaxExclusive::getChildrenOfClass($xml);
+ $maxInclusive = MaxInclusive::getChildrenOfClass($xml);
+ $totalDigits = TotalDigits::getChildrenOfClass($xml);
+ $fractionDigits = FractionDigits::getChildrenOfClass($xml);
+ $length = Length::getChildrenOfClass($xml);
+ $minLength = MinLength::getChildrenOfClass($xml);
+ $maxLength = MaxLength::getChildrenOfClass($xml);
+ $enumeration = Enumeration::getChildrenOfClass($xml);
+ $whiteSpace = WhiteSpace::getChildrenOfClass($xml);
+ $pattern = Pattern::getChildrenOfClass($xml);
+
+ $facets = array_merge(
+ $maxExclusive,
+ $maxInclusive,
+ $minExclusive,
+ $minInclusive,
+ $totalDigits,
+ $fractionDigits,
+ $length,
+ $maxLength,
+ $minLength,
+ $enumeration,
+ $whiteSpace,
+ $pattern,
+ );
+
+ return new static(
+ self::getAttribute($xml, 'base', QNameValue::class),
+ array_pop($localSimpleType),
+ $facets,
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleRestrictionModelTrait.php b/src/XMLSchema/XML/xs/SimpleRestrictionModelTrait.php
new file mode 100644
index 00000000..413a716e
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleRestrictionModelTrait.php
@@ -0,0 +1,44 @@
+simpleType;
+ }
+
+
+ /**
+ * Set the value of the simpleType-property
+ *
+ * @param \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType|null $simpleType
+ */
+ protected function setSimpleType(?LocalSimpleType $simpleType = null): void
+ {
+ $this->simpleType = $simpleType;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/SimpleSequence.php b/src/XMLSchema/XML/xs/SimpleSequence.php
new file mode 100644
index 00000000..006925f6
--- /dev/null
+++ b/src/XMLSchema/XML/xs/SimpleSequence.php
@@ -0,0 +1,72 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $name = self::getOptionalAttribute($xml, 'name', NCNameValue::class, null);
+ Assert::null($name, SchemaViolationException::class);
+
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ // Start here
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $any = Any::getChildrenOfClass($xml);
+ $choice = Choice::getChildrenOfClass($xml);
+ $localElement = LocalElement::getChildrenOfClass($xml);
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ $sequence = Sequence::getChildrenOfClass($xml);
+
+ $particles = array_merge($any, $choice, $localElement, $referencedGroup, $sequence);
+
+ return new static(
+ nestedParticles: $particles,
+ annotation: array_pop($annotation),
+ id: self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ namespacedAttributes: self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/TopLevelAttribute.php b/src/XMLSchema/XML/xs/TopLevelAttribute.php
new file mode 100644
index 00000000..aae0c92f
--- /dev/null
+++ b/src/XMLSchema/XML/xs/TopLevelAttribute.php
@@ -0,0 +1,72 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $form = self::getOptionalAttribute($xml, 'form', FormChoiceValue::class, null);
+ Assert::null($form, SchemaViolationException::class);
+
+ $use = self::getOptionalAttribute($xml, 'use', UseValue::class, null);
+ Assert::null($use, SchemaViolationException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($simpleType, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ self::getOptionalAttribute($xml, 'type', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'default', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'fixed', StringValue::class, null),
+ array_pop($simpleType),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/TopLevelComplexType.php b/src/XMLSchema/XML/xs/TopLevelComplexType.php
new file mode 100644
index 00000000..4a80e5b5
--- /dev/null
+++ b/src/XMLSchema/XML/xs/TopLevelComplexType.php
@@ -0,0 +1,95 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleContent = SimpleContent::getChildrenOfClass($xml);
+ Assert::maxCount($simpleContent, 1, TooManyElementsException::class);
+
+ $complexContent = ComplexContent::getChildrenOfClass($xml);
+ Assert::maxCount($complexContent, 1, TooManyElementsException::class);
+
+ $content = array_merge($simpleContent, $complexContent);
+ Assert::maxCount($content, 1, TooManyElementsException::class);
+
+ $referencedGroup = ReferencedGroup::getChildrenOfClass($xml);
+ Assert::maxCount($referencedGroup, 1, TooManyElementsException::class);
+
+ $all = All::getChildrenOfClass($xml);
+ Assert::maxCount($all, 1, TooManyElementsException::class);
+
+ $choice = Choice::getChildrenOfClass($xml);
+ Assert::maxCount($choice, 1, TooManyElementsException::class);
+
+ $sequence = Sequence::getChildrenOfClass($xml);
+ Assert::maxCount($sequence, 1, TooManyElementsException::class);
+
+ $particles = array_merge($referencedGroup, $all, $choice, $sequence);
+ Assert::maxCount($particles, 1, TooManyElementsException::class);
+
+ $localAttribute = LocalAttribute::getChildrenOfClass($xml);
+ $referencedAttributeGroup = ReferencedAttributeGroup::getChildrenOfClass($xml);
+ $attributes = array_merge($localAttribute, $referencedAttributeGroup);
+
+ $anyAttribute = AnyAttribute::getChildrenOfClass($xml);
+ Assert::maxCount($anyAttribute, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ self::getOptionalAttribute($xml, 'mixed', BooleanValue::class, null),
+ self::getOptionalAttribute($xml, 'abstract', BooleanValue::class, null),
+ self::getOptionalAttribute($xml, 'final', DerivationSetValue::class, null),
+ self::getOptionalAttribute($xml, 'block', DerivationSetValue::class, null),
+ array_pop($content),
+ array_pop($particles),
+ $attributes,
+ array_pop($anyAttribute),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/TopLevelElement.php b/src/XMLSchema/XML/xs/TopLevelElement.php
new file mode 100644
index 00000000..5393e4d3
--- /dev/null
+++ b/src/XMLSchema/XML/xs/TopLevelElement.php
@@ -0,0 +1,91 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ // Prohibited attributes
+ $ref = self::getOptionalAttribute($xml, 'ref', QNameValue::class, null);
+ Assert::null($ref, SchemaViolationException::class);
+
+ $form = self::getOptionalAttribute($xml, 'form', FormChoiceValue::class, null);
+ Assert::null($form, SchemaViolationException::class);
+
+ $minCount = self::getOptionalAttribute($xml, 'minCount', MinOccursValue::class, null);
+ Assert::null($minCount, SchemaViolationException::class);
+
+ $maxCount = self::getOptionalAttribute($xml, 'maxCount', MaxOccursValue::class, null);
+ Assert::null($maxCount, SchemaViolationException::class);
+
+ // The annotation
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ // The local type
+ $localSimpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($localSimpleType, 1, TooManyElementsException::class);
+
+ $localComplexType = LocalComplexType::getChildrenOfClass($xml);
+ Assert::maxCount($localComplexType, 1, TooManyElementsException::class);
+
+ $localType = array_merge($localSimpleType, $localComplexType);
+ Assert::maxCount($localType, 1, TooManyElementsException::class);
+
+ // The identity constraint
+ $key = Key::getChildrenOfClass($xml);
+ $keyref = Keyref::getChildrenOfClass($xml);
+ $unique = Unique::getChildrenOfClass($xml);
+ $identityConstraint = array_merge($key, $keyref, $unique);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ array_pop($localType),
+ $identityConstraint,
+ self::getOptionalAttribute($xml, 'type', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'substitutionGroup', QNameValue::class, null),
+ self::getOptionalAttribute($xml, 'default', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'fixed', StringValue::class, null),
+ self::getOptionalAttribute($xml, 'nillable', BooleanValue::class, null),
+ self::getOptionalAttribute($xml, 'abstract', BooleanValue::class, null),
+ self::getOptionalAttribute($xml, 'final', DerivationSetValue::class, null),
+ self::getOptionalAttribute($xml, 'block', BlockSetValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/TopLevelSimpleType.php b/src/XMLSchema/XML/xs/TopLevelSimpleType.php
new file mode 100644
index 00000000..a193b4b9
--- /dev/null
+++ b/src/XMLSchema/XML/xs/TopLevelSimpleType.php
@@ -0,0 +1,71 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $union = Union::getChildrenOfClass($xml);
+ $xsList = XsList::getChildrenOfClass($xml);
+ $restriction = Restriction::getChildrenOfClass($xml);
+
+ $derivation = array_merge($union, $xsList, $restriction);
+ Assert::minCount($derivation, 1, MissingElementException::class);
+ Assert::maxCount($derivation, 1, TooManyElementsException::class);
+
+ return new static(
+ $derivation[0],
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ self::getOptionalAttribute($xml, 'final', SimpleDerivationSetValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/TotalDigits.php b/src/XMLSchema/XML/xs/TotalDigits.php
new file mode 100644
index 00000000..8bd8972d
--- /dev/null
+++ b/src/XMLSchema/XML/xs/TotalDigits.php
@@ -0,0 +1,53 @@
+localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', PositiveIntegerValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/TypeDefParticleInterface.php b/src/XMLSchema/XML/xs/TypeDefParticleInterface.php
new file mode 100644
index 00000000..bed7bbe0
--- /dev/null
+++ b/src/XMLSchema/XML/xs/TypeDefParticleInterface.php
@@ -0,0 +1,14 @@
+particle;
+ }
+
+
+ /**
+ * Set the value of the particle-property
+ *
+ * @param \SimpleSAML\XMLSchema\XML\xs\TypeDefParticleInterface|null $particle
+ */
+ protected function setParticle(?TypeDefParticleInterface $particle = null): void
+ {
+ $this->particle = $particle;
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Union.php b/src/XMLSchema/XML/xs/Union.php
new file mode 100644
index 00000000..af3014cc
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Union.php
@@ -0,0 +1,148 @@
+ $memberTypes
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ protected array $simpleType,
+ protected array $memberTypes = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ Assert::allIsInstanceOf($simpleType, LocalSimpleType::class, SchemaViolationException::class);
+ Assert::allIsInstanceOf($memberTypes, QNameValue::class, SchemaViolationException::class);
+
+ if (empty($memberTypes)) {
+ Assert::minCount($simpleType, 1, MissingElementException::class);
+ }
+
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the simpleType-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType[]
+ */
+ public function getSimpleType(): array
+ {
+ return $this->simpleType;
+ }
+
+
+ /**
+ * Collect the value of the memberTypes-property
+ *
+ * @return array<\SimpleSAML\XMLSchema\Type\Builtin\QNameValue>
+ */
+ public function getMemberTypes(): array
+ {
+ return $this->memberTypes;
+ }
+
+
+ /**
+ * Add this Union to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this union to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ $memberTypes = implode(' ', array_map('strval', $this->getMemberTypes()));
+ if ($memberTypes !== '') {
+ $e->setAttribute('memberTypes', $memberTypes);
+ }
+
+ foreach ($this->getSimpleType() as $simpleType) {
+ $simpleType->toXML($e);
+ }
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $memberTypes = [];
+ $memberTypesValue = self::getOptionalAttribute($xml, 'memberTypes', StringValue::class, null);
+ if ($memberTypesValue !== null) {
+ $exploded = explode(' ', strval($memberTypesValue));
+ /** @var \SimpleSAML\XMLSchema\Type\Builtin\QNameValue[] $memberTypes */
+ $memberTypes = array_map(
+ [QNameValue::class, 'fromDocument'],
+ $exploded,
+ array_fill(0, count($exploded), $xml),
+ );
+ }
+
+ return new static(
+ LocalSimpleType::getChildrenOfClass($xml),
+ $memberTypes,
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/Unique.php b/src/XMLSchema/XML/xs/Unique.php
new file mode 100644
index 00000000..1aaba66a
--- /dev/null
+++ b/src/XMLSchema/XML/xs/Unique.php
@@ -0,0 +1,82 @@
+ $field
+ * @param \SimpleSAML\XMLSchema\XML\xs\Annotation|null $annotation
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IDValue|null $id
+ * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
+ */
+ public function __construct(
+ NCNameValue $name,
+ Selector $selector,
+ array $field = [],
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($name, $selector, $field, $annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $selector = Selector::getChildrenOfClass($xml);
+ Assert::minCount($selector, 1, MissingElementException::class);
+ Assert::maxCount($selector, 1, TooManyElementsException::class);
+
+ $field = Field::getChildrenOfClass($xml);
+
+ return new static(
+ self::getAttribute($xml, 'name', NCNameValue::class),
+ $selector[0],
+ $field,
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/UseEnum.php b/src/XMLSchema/XML/xs/UseEnum.php
new file mode 100644
index 00000000..47506115
--- /dev/null
+++ b/src/XMLSchema/XML/xs/UseEnum.php
@@ -0,0 +1,12 @@
+ $namespacedAttributes
+ */
+ final public function __construct(
+ WhiteSpaceValue $value,
+ ?BooleanValue $fixed = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($value, $fixed, $annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'value', WhiteSpaceValue::class),
+ self::getOptionalAttribute($xml, 'fixed', BooleanValue::class, null),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/WhiteSpaceEnum.php b/src/XMLSchema/XML/xs/WhiteSpaceEnum.php
new file mode 100644
index 00000000..a166dc83
--- /dev/null
+++ b/src/XMLSchema/XML/xs/WhiteSpaceEnum.php
@@ -0,0 +1,12 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected AnyURIValue $schemaLocation,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the schemaLocation-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\AnyURIValue
+ */
+ public function getSchemaLocation(): AnyURIValue
+ {
+ return $this->schemaLocation;
+ }
+
+
+ /**
+ * Add this Import to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this import to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+ $e->setAttribute('schemaLocation', strval($this->getSchemaLocation()));
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ return new static(
+ self::getAttribute($xml, 'schemaLocation', AnyURIValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XMLSchema/XML/xs/XsList.php b/src/XMLSchema/XML/xs/XsList.php
new file mode 100644
index 00000000..e9a7f5c7
--- /dev/null
+++ b/src/XMLSchema/XML/xs/XsList.php
@@ -0,0 +1,120 @@
+ $namespacedAttributes
+ */
+ public function __construct(
+ protected ?LocalSimpleType $simpleType = null,
+ protected ?QNameValue $itemType = null,
+ ?Annotation $annotation = null,
+ ?IDValue $id = null,
+ array $namespacedAttributes = [],
+ ) {
+ parent::__construct($annotation, $id, $namespacedAttributes);
+ }
+
+
+ /**
+ * Collect the value of the simpleType-property
+ *
+ * @return \SimpleSAML\XMLSchema\XML\xs\LocalSimpleType|null
+ */
+ public function getSimpleType(): ?LocalSimpleType
+ {
+ return $this->simpleType;
+ }
+
+
+ /**
+ * Collect the value of the itemType-property
+ *
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\QNameValue|null
+ */
+ public function getItemType(): ?QNameValue
+ {
+ return $this->itemType;
+ }
+
+
+ /**
+ * Add this XsList to an XML element.
+ *
+ * @param \DOMElement|null $parent The element we should append this list to.
+ * @return \DOMElement
+ */
+ public function toXML(?DOMElement $parent = null): DOMElement
+ {
+ $e = parent::toXML($parent);
+
+ if ($this->getItemType() !== null) {
+ $e->setAttribute('itemType', strval($this->getItemType()));
+ }
+
+ $this->getSimpleType()?->toXML($e);
+
+ return $e;
+ }
+
+
+ /**
+ * Create an instance of this object from its XML representation.
+ *
+ * @param \DOMElement $xml
+ * @return static
+ *
+ * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
+ * if the qualified name of the supplied element is wrong
+ */
+ public static function fromXML(DOMElement $xml): static
+ {
+ Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class);
+ Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class);
+
+ $annotation = Annotation::getChildrenOfClass($xml);
+ Assert::maxCount($annotation, 1, TooManyElementsException::class);
+
+ $simpleType = LocalSimpleType::getChildrenOfClass($xml);
+ Assert::maxCount($simpleType, 1, TooManyElementsException::class);
+
+ return new static(
+ array_pop($simpleType),
+ self::getOptionalAttribute($xml, 'itemType', QNameValue::class),
+ array_pop($annotation),
+ self::getOptionalAttribute($xml, 'id', IDValue::class, null),
+ self::getAttributesNSFromXML($xml),
+ );
+ }
+}
diff --git a/src/XsNamespace.php b/src/XsNamespace.php
deleted file mode 100644
index 3d4170b3..00000000
--- a/src/XsNamespace.php
+++ /dev/null
@@ -1,18 +0,0 @@
-failure = 0;
+
+ try {
+ Schema::fromXML($schema);
+ } catch (Exception $e) {
+ $this->failure = 1;
+ $this->assertEquals($this->failure, 0, $e->getMessage() . PHP_EOL . $e->getTraceAsString());
+ }
+
+ $this->assertEquals($this->failure, 0);
+ }
+
+
+ /**
+ * @return array>
+ */
+ public static function provideSchema(): array
+ {
+ $dir = dirname(__FILE__, 3);
+
+ /** @var string $xml */
+ $xml = file_get_contents($dir . '/resources/schemas/xml.xsd');
+ $xmldoc = new DOMDocument();
+ $xmldoc->loadXML($xml);
+
+ /** @var string $xsd */
+ $xsd = file_get_contents($dir . '/resources/schemas/XMLSchema.xsd');
+ $xsddoc = new DOMDocument();
+ $xsddoc->loadXML($xsd);
+
+ /** @var string $xenc */
+ $xenc = file_get_contents($dir . '/resources/schemas/xenc-schema.xsd');
+ $xencdoc = new DOMDocument();
+ $xencdoc->loadXML($xenc);
+
+ /** @var string $xmldsig */
+ $xmldsig = file_get_contents($dir . '/resources/schemas/xmldsig-core-schema.xsd');
+ $xmldsigdoc = new DOMDocument();
+ $xmldsigdoc->loadXML($xmldsig);
+
+ /** @var string $saml2p */
+ $saml2p = file_get_contents($dir . '/resources/schemas/saml-schema-protocol-2.0.xsd');
+ $saml2pdoc = new DOMDocument();
+ $saml2pdoc->loadXML($saml2p);
+
+ /** @var string $saml2a */
+ $saml2a = file_get_contents($dir . '/resources/schemas/saml-schema-assertion-2.0.xsd');
+ $saml2adoc = new DOMDocument();
+ $saml2adoc->loadXML($saml2a);
+
+ /** @var string $saml2m */
+ $saml2m = file_get_contents($dir . '/resources/schemas/saml-schema-metadata-2.0.xsd');
+ $saml2mdoc = new DOMDocument();
+ $saml2mdoc->loadXML($saml2m);
+
+ /** @var string $soapenv11 */
+ $soapenv11 = file_get_contents($dir . '/resources/schemas/soap-envelope-1.1.xsd');
+ $soapenv11doc = new DOMDocument();
+ $soapenv11doc->loadXML($soapenv11);
+
+ return [
+ 'XML' => [
+ $xmldoc->documentElement,
+ ],
+ 'XML Schema' => [
+ $xsddoc->documentElement,
+ ],
+ 'XML Encryption' => [
+ $xencdoc->documentElement,
+ ],
+ 'XML Signatures' => [
+ $xmldsigdoc->documentElement,
+ ],
+ 'SOAP Envelope 1.1' => [
+ $soapenv11doc->documentElement,
+ ],
+ 'SAML 2.0 Protocol' => [
+ $saml2pdoc->documentElement,
+ ],
+ 'SAML 2.0 Assertion' => [
+ $saml2adoc->documentElement,
+ ],
+ 'SAML 2.0 Metadata' => [
+ $saml2mdoc->documentElement,
+ ],
+ ];
+ }
+}
diff --git a/tests/Utils/BooleanElement.php b/tests/Utils/BooleanElement.php
index 9ef08b60..aea8141e 100644
--- a/tests/Utils/BooleanElement.php
+++ b/tests/Utils/BooleanElement.php
@@ -7,7 +7,7 @@
use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait};
use SimpleSAML\XML\TypedTextContentTrait;
-use SimpleSAML\XML\Type\BooleanValue;
+use SimpleSAML\XMLSchema\Type\Builtin\BooleanValue;
/**
* Empty shell class for testing xs:string elements.
diff --git a/tests/Utils/Element.php b/tests/Utils/Element.php
index b1b3a10e..b2162d30 100644
--- a/tests/Utils/Element.php
+++ b/tests/Utils/Element.php
@@ -7,8 +7,8 @@
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\XML\AbstractElement;
-use SimpleSAML\XML\Exception\InvalidDOMElementException;
-use SimpleSAML\XML\Type\{BooleanValue, IntegerValue, StringValue};
+use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
+use SimpleSAML\XMLSchema\Type\Builtin\{BooleanValue, IntegerValue, StringValue};
use function strval;
@@ -27,10 +27,10 @@ final class Element extends AbstractElement
/**
- * @param \SimpleSAML\XML\Type\IntegerValue|null $integer
- * @param \SimpleSAML\XML\Type\BooleanValue|null $boolean
- * @param \SimpleSAML\XML\Type\StringValue|null $text
- * @param \SimpleSAML\XML\Type\StringValue|null $otherText
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\IntegerValue|null $integer
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null $boolean
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $text
+ * @param \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null $otherText
*/
public function __construct(
protected ?IntegerValue $integer = null,
@@ -44,7 +44,7 @@ public function __construct(
/**
* Collect the value of the integer-property
*
- * @return \SimpleSAML\XML\Type\IntegerValue|null
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\IntegerValue|null
*/
public function getInteger(): ?IntegerValue
{
@@ -55,7 +55,7 @@ public function getInteger(): ?IntegerValue
/**
* Collect the value of the boolean-property
*
- * @return \SimpleSAML\XML\Type\BooleanValue|null
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\BooleanValue|null
*/
public function getBoolean(): ?BooleanValue
{
@@ -66,7 +66,7 @@ public function getBoolean(): ?BooleanValue
/**
* Collect the value of the text-property
*
- * @return \SimpleSAML\XML\Type\StringValue|null
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null
*/
public function getString(): ?StringValue
{
@@ -75,9 +75,9 @@ public function getString(): ?StringValue
/**
- * Collect the value of the text2-property
+ * Collect the value of the otherText-property
*
- * @return \SimpleSAML\XML\Type\StringValue|null
+ * @return \SimpleSAML\XMLSchema\Type\Builtin\StringValue|null
*/
public function getOtherString(): ?StringValue
{
diff --git a/tests/Utils/ExtendableAttributesElement.php b/tests/Utils/ExtendableAttributesElement.php
index 5e3240ae..fe063e99 100644
--- a/tests/Utils/ExtendableAttributesElement.php
+++ b/tests/Utils/ExtendableAttributesElement.php
@@ -7,10 +7,10 @@
use DOMElement;
use SimpleSAML\Assert\Assert;
use SimpleSAML\XML\AbstractElement;
-use SimpleSAML\XML\Exception\InvalidDOMElementException;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait};
-use SimpleSAML\XML\XsNamespace as NS;
+use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
+use SimpleSAML\XMLSchema\XML\xs\NamespaceEnum;
/**
* Empty shell class for testing ExtendableAttributesTrait.
@@ -34,8 +34,13 @@ class ExtendableAttributesElement extends AbstractElement implements SchemaValid
/** @var string */
public const SCHEMA = 'tests/resources/schemas/simplesamlphp.xsd';
- /** @var string|\SimpleSAML\XML\XsNamespace */
- final public const XS_ANY_ATTR_NAMESPACE = NS::ANY;
+ /**
+ * @var (
+ * \SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|
+ * array
+ * )
+ */
+ final public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Any;
/** @var array{array{string, string}} */
final public const XS_ANY_ATTR_EXCLUSIONS = [
diff --git a/tests/Utils/ExtendableElement.php b/tests/Utils/ExtendableElement.php
index 66896d0a..ec3785de 100644
--- a/tests/Utils/ExtendableElement.php
+++ b/tests/Utils/ExtendableElement.php
@@ -9,7 +9,7 @@
use SimpleSAML\XML\ExtendableElementTrait;
use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait};
use SimpleSAML\XML\SerializableElementTrait;
-use SimpleSAML\XML\XsNamespace as NS;
+use SimpleSAML\XMLSchema\XML\xs\NamespaceEnum;
/**
* Empty shell class for testing ExtendableElementTrait.
@@ -34,8 +34,13 @@ class ExtendableElement extends AbstractElement implements SchemaValidatableElem
/** @var string */
public const SCHEMA = 'tests/resources/schemas/simplesamlphp.xsd';
- /** @var \SimpleSAML\XML\XsNamespace|array */
- final public const XS_ANY_ELT_NAMESPACE = NS::ANY;
+ /**
+ * @var (
+ * \SimpleSAML\XMLSchema\XML\xs\NamespaceEnum|
+ * array
+ * )
+ */
+ final public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any;
/** @var array{array{string, string}} */
final public const XS_ANY_ELT_EXCLUSIONS = [
diff --git a/tests/Utils/StringElement.php b/tests/Utils/StringElement.php
index 535fc770..23d5f716 100644
--- a/tests/Utils/StringElement.php
+++ b/tests/Utils/StringElement.php
@@ -7,7 +7,7 @@
use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait};
use SimpleSAML\XML\TypedTextContentTrait;
-use SimpleSAML\XML\Type\StringValue;
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
/**
* Empty shell class for testing String elements.
diff --git a/tests/XML/AbstractElementTest.php b/tests/XML/AbstractElementTest.php
index 76c4fa72..0acc8e37 100644
--- a/tests/XML/AbstractElementTest.php
+++ b/tests/XML/AbstractElementTest.php
@@ -9,9 +9,9 @@
use SimpleSAML\Test\XML\Element;
use SimpleSAML\XML\AbstractElement;
use SimpleSAML\XML\DOMDocumentFactory;
-use SimpleSAML\XML\Exception\MissingAttributeException;
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
-use SimpleSAML\XML\Type\{IntegerValue, BooleanValue, StringValue};
+use SimpleSAML\XMLSchema\Exception\MissingAttributeException;
+use SimpleSAML\XMLSchema\Type\Builtin\{IntegerValue, BooleanValue, StringValue};
use function dirname;
diff --git a/tests/Assert/AnyURITest.php b/tests/XML/Assert/AnyURITest.php
similarity index 100%
rename from tests/Assert/AnyURITest.php
rename to tests/XML/Assert/AnyURITest.php
diff --git a/tests/Assert/Base64BinaryTest.php b/tests/XML/Assert/Base64BinaryTest.php
similarity index 100%
rename from tests/Assert/Base64BinaryTest.php
rename to tests/XML/Assert/Base64BinaryTest.php
diff --git a/tests/Assert/BooleanTest.php b/tests/XML/Assert/BooleanTest.php
similarity index 100%
rename from tests/Assert/BooleanTest.php
rename to tests/XML/Assert/BooleanTest.php
diff --git a/tests/Assert/ByteTest.php b/tests/XML/Assert/ByteTest.php
similarity index 100%
rename from tests/Assert/ByteTest.php
rename to tests/XML/Assert/ByteTest.php
diff --git a/tests/Assert/DateTest.php b/tests/XML/Assert/DateTest.php
similarity index 100%
rename from tests/Assert/DateTest.php
rename to tests/XML/Assert/DateTest.php
diff --git a/tests/Assert/DateTimeTest.php b/tests/XML/Assert/DateTimeTest.php
similarity index 100%
rename from tests/Assert/DateTimeTest.php
rename to tests/XML/Assert/DateTimeTest.php
diff --git a/tests/Assert/DayTest.php b/tests/XML/Assert/DayTest.php
similarity index 100%
rename from tests/Assert/DayTest.php
rename to tests/XML/Assert/DayTest.php
diff --git a/tests/Assert/DecimalTest.php b/tests/XML/Assert/DecimalTest.php
similarity index 100%
rename from tests/Assert/DecimalTest.php
rename to tests/XML/Assert/DecimalTest.php
diff --git a/tests/Assert/DoubleTest.php b/tests/XML/Assert/DoubleTest.php
similarity index 100%
rename from tests/Assert/DoubleTest.php
rename to tests/XML/Assert/DoubleTest.php
diff --git a/tests/Assert/DurationTest.php b/tests/XML/Assert/DurationTest.php
similarity index 100%
rename from tests/Assert/DurationTest.php
rename to tests/XML/Assert/DurationTest.php
diff --git a/tests/Assert/EntitiesTest.php b/tests/XML/Assert/EntitiesTest.php
similarity index 100%
rename from tests/Assert/EntitiesTest.php
rename to tests/XML/Assert/EntitiesTest.php
diff --git a/tests/Assert/EntityTest.php b/tests/XML/Assert/EntityTest.php
similarity index 100%
rename from tests/Assert/EntityTest.php
rename to tests/XML/Assert/EntityTest.php
diff --git a/tests/Assert/FloatTest.php b/tests/XML/Assert/FloatTest.php
similarity index 100%
rename from tests/Assert/FloatTest.php
rename to tests/XML/Assert/FloatTest.php
diff --git a/tests/Assert/HexBinaryTest.php b/tests/XML/Assert/HexBinaryTest.php
similarity index 100%
rename from tests/Assert/HexBinaryTest.php
rename to tests/XML/Assert/HexBinaryTest.php
diff --git a/tests/Assert/IDRefTest.php b/tests/XML/Assert/IDRefTest.php
similarity index 100%
rename from tests/Assert/IDRefTest.php
rename to tests/XML/Assert/IDRefTest.php
diff --git a/tests/Assert/IDRefsTest.php b/tests/XML/Assert/IDRefsTest.php
similarity index 100%
rename from tests/Assert/IDRefsTest.php
rename to tests/XML/Assert/IDRefsTest.php
diff --git a/tests/Assert/IDTest.php b/tests/XML/Assert/IDTest.php
similarity index 100%
rename from tests/Assert/IDTest.php
rename to tests/XML/Assert/IDTest.php
diff --git a/tests/Assert/IntTest.php b/tests/XML/Assert/IntTest.php
similarity index 100%
rename from tests/Assert/IntTest.php
rename to tests/XML/Assert/IntTest.php
diff --git a/tests/Assert/IntegerTest.php b/tests/XML/Assert/IntegerTest.php
similarity index 100%
rename from tests/Assert/IntegerTest.php
rename to tests/XML/Assert/IntegerTest.php
diff --git a/tests/Assert/LanguageTest.php b/tests/XML/Assert/LanguageTest.php
similarity index 100%
rename from tests/Assert/LanguageTest.php
rename to tests/XML/Assert/LanguageTest.php
diff --git a/tests/Assert/LongTest.php b/tests/XML/Assert/LongTest.php
similarity index 100%
rename from tests/Assert/LongTest.php
rename to tests/XML/Assert/LongTest.php
diff --git a/tests/Assert/MonthTest.php b/tests/XML/Assert/MonthTest.php
similarity index 100%
rename from tests/Assert/MonthTest.php
rename to tests/XML/Assert/MonthTest.php
diff --git a/tests/Assert/NCNameTest.php b/tests/XML/Assert/NCNameTest.php
similarity index 100%
rename from tests/Assert/NCNameTest.php
rename to tests/XML/Assert/NCNameTest.php
diff --git a/tests/Assert/NMTokenTest.php b/tests/XML/Assert/NMTokenTest.php
similarity index 100%
rename from tests/Assert/NMTokenTest.php
rename to tests/XML/Assert/NMTokenTest.php
diff --git a/tests/Assert/NMTokensTest.php b/tests/XML/Assert/NMTokensTest.php
similarity index 100%
rename from tests/Assert/NMTokensTest.php
rename to tests/XML/Assert/NMTokensTest.php
diff --git a/tests/Assert/NameTest.php b/tests/XML/Assert/NameTest.php
similarity index 100%
rename from tests/Assert/NameTest.php
rename to tests/XML/Assert/NameTest.php
diff --git a/tests/Assert/NegativeIntegerTest.php b/tests/XML/Assert/NegativeIntegerTest.php
similarity index 100%
rename from tests/Assert/NegativeIntegerTest.php
rename to tests/XML/Assert/NegativeIntegerTest.php
diff --git a/tests/Assert/NonNegativeIntegerTest.php b/tests/XML/Assert/NonNegativeIntegerTest.php
similarity index 100%
rename from tests/Assert/NonNegativeIntegerTest.php
rename to tests/XML/Assert/NonNegativeIntegerTest.php
diff --git a/tests/Assert/NonPositiveIntegerTest.php b/tests/XML/Assert/NonPositiveIntegerTest.php
similarity index 100%
rename from tests/Assert/NonPositiveIntegerTest.php
rename to tests/XML/Assert/NonPositiveIntegerTest.php
diff --git a/tests/Assert/NormalizedStringTest.php b/tests/XML/Assert/NormalizedStringTest.php
similarity index 100%
rename from tests/Assert/NormalizedStringTest.php
rename to tests/XML/Assert/NormalizedStringTest.php
diff --git a/tests/Assert/PositiveIntegerTest.php b/tests/XML/Assert/PositiveIntegerTest.php
similarity index 100%
rename from tests/Assert/PositiveIntegerTest.php
rename to tests/XML/Assert/PositiveIntegerTest.php
diff --git a/tests/Assert/QNameTest.php b/tests/XML/Assert/QNameTest.php
similarity index 100%
rename from tests/Assert/QNameTest.php
rename to tests/XML/Assert/QNameTest.php
diff --git a/tests/Assert/ShortTest.php b/tests/XML/Assert/ShortTest.php
similarity index 100%
rename from tests/Assert/ShortTest.php
rename to tests/XML/Assert/ShortTest.php
diff --git a/tests/Assert/StringTest.php b/tests/XML/Assert/StringTest.php
similarity index 100%
rename from tests/Assert/StringTest.php
rename to tests/XML/Assert/StringTest.php
diff --git a/tests/Assert/TimeTest.php b/tests/XML/Assert/TimeTest.php
similarity index 100%
rename from tests/Assert/TimeTest.php
rename to tests/XML/Assert/TimeTest.php
diff --git a/tests/Assert/TokenTest.php b/tests/XML/Assert/TokenTest.php
similarity index 100%
rename from tests/Assert/TokenTest.php
rename to tests/XML/Assert/TokenTest.php
diff --git a/tests/Assert/UnsignedByteTest.php b/tests/XML/Assert/UnsignedByteTest.php
similarity index 100%
rename from tests/Assert/UnsignedByteTest.php
rename to tests/XML/Assert/UnsignedByteTest.php
diff --git a/tests/Assert/UnsignedIntTest.php b/tests/XML/Assert/UnsignedIntTest.php
similarity index 100%
rename from tests/Assert/UnsignedIntTest.php
rename to tests/XML/Assert/UnsignedIntTest.php
diff --git a/tests/Assert/UnsignedLongTest.php b/tests/XML/Assert/UnsignedLongTest.php
similarity index 100%
rename from tests/Assert/UnsignedLongTest.php
rename to tests/XML/Assert/UnsignedLongTest.php
diff --git a/tests/Assert/UnsignedShortTest.php b/tests/XML/Assert/UnsignedShortTest.php
similarity index 100%
rename from tests/Assert/UnsignedShortTest.php
rename to tests/XML/Assert/UnsignedShortTest.php
diff --git a/tests/Assert/XPathFilterTest.php b/tests/XML/Assert/XPathFilterTest.php
similarity index 100%
rename from tests/Assert/XPathFilterTest.php
rename to tests/XML/Assert/XPathFilterTest.php
diff --git a/tests/Assert/YearMonthTest.php b/tests/XML/Assert/YearMonthTest.php
similarity index 100%
rename from tests/Assert/YearMonthTest.php
rename to tests/XML/Assert/YearMonthTest.php
diff --git a/tests/Assert/YearTest.php b/tests/XML/Assert/YearTest.php
similarity index 100%
rename from tests/Assert/YearTest.php
rename to tests/XML/Assert/YearTest.php
diff --git a/tests/XML/AttributeTest.php b/tests/XML/AttributeTest.php
index fc16e786..535f1138 100644
--- a/tests/XML/AttributeTest.php
+++ b/tests/XML/AttributeTest.php
@@ -10,7 +10,7 @@
use SimpleSAML\XML\Attribute;
use SimpleSAML\XML\DOMDocumentFactory;
use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait;
-use SimpleSAML\XML\Type\StringValue;
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
use function strval;
@@ -75,7 +75,7 @@ public function testUnmarshallingArray(): void
* namespaceURI: string,
* namespacePrefix: string|null,
* attrName: string,
- * attrValue: \SimpleSAML\XML\Type\ValueTypeInterface
+ * attrValue: \SimpleSAML\XMLSchema\Type\Helper\ValueTypeInterface
* } $arrayRepresentation
*/
$arrayRepresentation = self::$arrayRepresentation;
diff --git a/tests/XML/ChunkTest.php b/tests/XML/ChunkTest.php
index 084c6d3a..0e781701 100644
--- a/tests/XML/ChunkTest.php
+++ b/tests/XML/ChunkTest.php
@@ -6,11 +6,10 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
-use SimpleSAML\XML\Chunk;
-use SimpleSAML\XML\DOMDocumentFactory;
-use SimpleSAML\XML\Exception\MissingAttributeException;
+use SimpleSAML\XML\{Chunk, DOMDocumentFactory};
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
-use SimpleSAML\XML\Type\{BooleanValue, IntegerValue, StringValue};
+use SimpleSAML\XMLSchema\Exception\MissingAttributeException;
+use SimpleSAML\XMLSchema\Type\Builtin\{BooleanValue, IntegerValue, StringValue};
use function dirname;
use function strval;
diff --git a/tests/XML/ExtendableAttributesTest.php b/tests/XML/ExtendableAttributesTest.php
index 00103312..2dd39707 100644
--- a/tests/XML/ExtendableAttributesTest.php
+++ b/tests/XML/ExtendableAttributesTest.php
@@ -10,7 +10,7 @@
use SimpleSAML\XML\Attribute;
use SimpleSAML\XML\DOMDocumentFactory;
use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait};
-use SimpleSAML\XML\Type\StringValue;
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
use function dirname;
use function strval;
diff --git a/tests/XML/ExtendableAttributesTraitTest.php b/tests/XML/ExtendableAttributesTraitTest.php
index 645717ba..3ee35802 100644
--- a/tests/XML/ExtendableAttributesTraitTest.php
+++ b/tests/XML/ExtendableAttributesTraitTest.php
@@ -11,8 +11,8 @@
use SimpleSAML\XML\Attribute;
use SimpleSAML\XML\ExtendableAttributesTrait;
use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait};
-use SimpleSAML\XML\Type\StringValue;
-use SimpleSAML\XML\XsNamespace as NS;
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
+use SimpleSAML\XMLSchema\XML\xs\NamespaceEnum;
/**
* Class \SimpleSAML\XML\ExtendableAttributesTraitTest
@@ -79,10 +79,10 @@ public function testIllegalNamespaceComboThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$target]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return [NS::OTHER, NS::ANY];
+ return [NamespaceEnum::Other, NamespaceEnum::Any];
}
};
}
@@ -92,8 +92,8 @@ public function testEmptyNamespaceArrayThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
return [];
}
@@ -106,14 +106,14 @@ public function getAttributeNamespace(): array|NS
public function testOtherNamespacePassingOtherSucceeds(): void
{
$c = new class ([self::$other]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::OTHER;
+ return NamespaceEnum::Other;
}
};
- $this->assertEquals(NS::OTHER, $c->getAttributeNamespace());
+ $this->assertEquals(NamespaceEnum::Other, $c->getAttributeNamespace());
}
@@ -123,10 +123,10 @@ public function testOtherNamespacePassingLocalThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$local]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::OTHER;
+ return NamespaceEnum::Other;
}
};
}
@@ -137,14 +137,14 @@ public function getAttributeNamespace(): array|NS
public function testTargetNamespacePassingTargetSucceeds(): void
{
$c = new class ([self::$target]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::TARGET;
+ return NamespaceEnum::TargetNamespace;
}
};
- $this->assertEquals(NS::TARGET, $c->getAttributeNamespace());
+ $this->assertEquals(NamespaceEnum::TargetNamespace, $c->getAttributeNamespace());
}
@@ -153,14 +153,14 @@ public function getAttributeNamespace(): array|NS
public function testTargetNamespacePassingTargetArraySucceeds(): void
{
$c = new class ([self::$target]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return [NS::TARGET];
+ return [NamespaceEnum::TargetNamespace];
}
};
- $this->assertEquals([NS::TARGET], $c->getAttributeNamespace());
+ $this->assertEquals([NamespaceEnum::TargetNamespace], $c->getAttributeNamespace());
}
@@ -169,14 +169,14 @@ public function getAttributeNamespace(): array|NS
public function testTargetNamespacePassingTargetArraySucceedsWithLocal(): void
{
$c = new class ([self::$target]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return [NS::TARGET, NS::LOCAL];
+ return [NamespaceEnum::TargetNamespace, NamespaceEnum::Local];
}
};
- $this->assertEquals([NS::TARGET, NS::LOCAL], $c->getAttributeNamespace());
+ $this->assertEquals([NamespaceEnum::TargetNamespace, NamespaceEnum::Local], $c->getAttributeNamespace());
}
@@ -186,10 +186,10 @@ public function testTargetNamespacePassingOtherThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$other]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::TARGET;
+ return NamespaceEnum::TargetNamespace;
}
};
}
@@ -200,14 +200,14 @@ public function getAttributeNamespace(): array|NS
public function testLocalNamespacePassingLocalSucceeds(): void
{
$c = new class ([self::$local]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::LOCAL;
+ return NamespaceEnum::Local;
}
};
- $this->assertEquals(NS::LOCAL, $c->getAttributeNamespace());
+ $this->assertEquals(NamespaceEnum::Local, $c->getAttributeNamespace());
}
@@ -216,14 +216,14 @@ public function getAttributeNamespace(): array|NS
public function testLocalNamespacePassingLocalArraySucceeds(): void
{
$c = new class ([self::$local]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return [NS::LOCAL];
+ return [NamespaceEnum::Local];
}
};
- $this->assertEquals([NS::LOCAL], $c->getAttributeNamespace());
+ $this->assertEquals([NamespaceEnum::Local], $c->getAttributeNamespace());
}
@@ -233,10 +233,10 @@ public function testLocalNamespacePassingOtherThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$other]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::LOCAL;
+ return NamespaceEnum::Local;
}
};
}
@@ -247,14 +247,14 @@ public function getAttributeNamespace(): array|NS
public function testAnyNamespacePassingTargetSucceeds(): void
{
$c = new class ([self::$target]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::ANY;
+ return NamespaceEnum::Any;
}
};
- $this->assertEquals(NS::ANY, $c->getAttributeNamespace());
+ $this->assertEquals(NamespaceEnum::Any, $c->getAttributeNamespace());
}
@@ -263,13 +263,13 @@ public function getAttributeNamespace(): array|NS
public function testAnyNamespacePassingOtherSucceeds(): void
{
$c = new class ([self::$other]) extends ExtendableAttributesElement {
- /** @return array|NS */
- public function getAttributeNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getAttributeNamespace(): array|NamespaceEnum
{
- return NS::ANY;
+ return NamespaceEnum::Any;
}
};
- $this->assertEquals(NS::ANY, $c->getAttributeNamespace());
+ $this->assertEquals(NamespaceEnum::Any, $c->getAttributeNamespace());
}
}
diff --git a/tests/XML/ExtendableElementTraitTest.php b/tests/XML/ExtendableElementTraitTest.php
index 2eecf978..e9cbb635 100644
--- a/tests/XML/ExtendableElementTraitTest.php
+++ b/tests/XML/ExtendableElementTraitTest.php
@@ -9,10 +9,9 @@
use SimpleSAML\Assert\AssertionFailedException;
use SimpleSAML\Test\XML\ExtendableElement;
use SimpleSAML\XML\{Chunk, DOMDocumentFactory};
-use SimpleSAML\XML\ElementInterface;
-use SimpleSAML\XML\ExtendableElementTrait;
+use SimpleSAML\XML\{ElementInterface, ExtendableElementTrait};
use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait};
-use SimpleSAML\XML\XsNamespace as NS;
+use SimpleSAML\XMLSchema\XML\xs\NamespaceEnum;
/**
* Class \SimpleSAML\XML\ExtendableElementTraitTest
@@ -91,10 +90,10 @@ public function testIllegalNamespaceComboThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return [NS::OTHER, NS::ANY];
+ return [NamespaceEnum::Other, NamespaceEnum::Any];
}
};
}
@@ -106,8 +105,8 @@ public function testEmptyNamespaceArrayThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
return [];
}
@@ -120,14 +119,14 @@ public function getElementNamespace(): array|NS
public function testOtherNamespacePassingOtherSucceeds(): void
{
$c = new class ([self::$other]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::OTHER;
+ return NamespaceEnum::Other;
}
};
- $this->assertEquals(NS::OTHER, $c->getElementNamespace());
+ $this->assertEquals(NamespaceEnum::Other, $c->getElementNamespace());
}
@@ -137,10 +136,10 @@ public function testOtherNamespacePassingLocalThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$local]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::OTHER;
+ return NamespaceEnum::Other;
}
};
}
@@ -151,14 +150,14 @@ public function getElementNamespace(): array|NS
public function testTargetNamespacePassingTargetSucceeds(): void
{
$c = new class ([self::$target]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::TARGET;
+ return NamespaceEnum::TargetNamespace;
}
};
- $this->assertEquals(NS::TARGET, $c->getElementNamespace());
+ $this->assertEquals(NamespaceEnum::TargetNamespace, $c->getElementNamespace());
}
@@ -167,14 +166,14 @@ public function getElementNamespace(): array|NS
public function testTargetNamespacePassingTargetArraySucceeds(): void
{
$c = new class ([self::$target]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return [NS::TARGET];
+ return [NamespaceEnum::TargetNamespace];
}
};
- $this->assertEquals([NS::TARGET], $c->getElementNamespace());
+ $this->assertEquals([NamespaceEnum::TargetNamespace], $c->getElementNamespace());
}
@@ -183,14 +182,14 @@ public function getElementNamespace(): array|NS
public function testTargetNamespacePassingTargetArraySucceedsWithLocal(): void
{
$c = new class ([self::$target]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return [NS::TARGET, NS::LOCAL];
+ return [NamespaceEnum::TargetNamespace, NamespaceEnum::Local];
}
};
- $this->assertEquals([NS::TARGET, NS::LOCAL], $c->getElementNamespace());
+ $this->assertEquals([NamespaceEnum::TargetNamespace, NamespaceEnum::Local], $c->getElementNamespace());
}
@@ -200,10 +199,10 @@ public function testTargetNamespacePassingOtherThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$other]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::TARGET;
+ return NamespaceEnum::TargetNamespace;
}
};
}
@@ -214,14 +213,14 @@ public function getElementNamespace(): array|NS
public function testLocalNamespacePassingLocalSucceeds(): void
{
$c = new class ([self::$local]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::LOCAL;
+ return NamespaceEnum::Local;
}
};
- $this->assertEquals(NS::LOCAL, $c->getElementNamespace());
+ $this->assertEquals(NamespaceEnum::Local, $c->getElementNamespace());
}
@@ -230,14 +229,14 @@ public function getElementNamespace(): array|NS
public function testLocalNamespacePassingLocalArraySucceeds(): void
{
$c = new class ([self::$local]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return [NS::LOCAL];
+ return [NamespaceEnum::Local];
}
};
- $this->assertEquals([NS::LOCAL], $c->getElementNamespace());
+ $this->assertEquals([NamespaceEnum::Local], $c->getElementNamespace());
}
@@ -247,10 +246,10 @@ public function testLocalNamespacePassingTargetThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$target]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::LOCAL;
+ return NamespaceEnum::Local;
}
};
}
@@ -262,10 +261,10 @@ public function testLocalNamespacePassingOtherThrowsAnException(): void
{
$this->expectException(AssertionFailedException::class);
new class ([self::$other]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::LOCAL;
+ return NamespaceEnum::Local;
}
};
}
@@ -276,14 +275,14 @@ public function getElementNamespace(): array|NS
public function testAnyNamespacePassingLocalSucceeds(): void
{
$c = new class ([self::$local]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::ANY;
+ return NamespaceEnum::Any;
}
};
- $this->assertEquals(NS::ANY, $c->getElementNamespace());
+ $this->assertEquals(NamespaceEnum::Any, $c->getElementNamespace());
}
@@ -292,14 +291,14 @@ public function getElementNamespace(): array|NS
public function testAnyNamespacePassingTargetSucceeds(): void
{
$c = new class ([self::$target]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::ANY;
+ return NamespaceEnum::Any;
}
};
- $this->assertEquals(NS::ANY, $c->getElementNamespace());
+ $this->assertEquals(NamespaceEnum::Any, $c->getElementNamespace());
}
@@ -308,13 +307,13 @@ public function getElementNamespace(): array|NS
public function testAnyNamespacePassingOtherSucceeds(): void
{
$c = new class ([self::$other]) extends ExtendableElement {
- /** @return array|NS */
- public function getElementNamespace(): array|NS
+ /** @return array|NamespaceEnum */
+ public function getElementNamespace(): array|NamespaceEnum
{
- return NS::ANY;
+ return NamespaceEnum::Any;
}
};
- $this->assertEquals(NS::ANY, $c->getElementNamespace());
+ $this->assertEquals(NamespaceEnum::Any, $c->getElementNamespace());
}
}
diff --git a/tests/Registry/ElementRegistryTest.php b/tests/XML/Registry/ElementRegistryTest.php
similarity index 97%
rename from tests/Registry/ElementRegistryTest.php
rename to tests/XML/Registry/ElementRegistryTest.php
index adf42532..caba4606 100644
--- a/tests/Registry/ElementRegistryTest.php
+++ b/tests/XML/Registry/ElementRegistryTest.php
@@ -2,7 +2,7 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML;
+namespace SimpleSAML\Test\XML\Registry;
use PHPUnit\Framework\Attributes\{CoversClass, Group};
use PHPUnit\Framework\TestCase;
diff --git a/tests/XML/SchemaValidatableElementTraitTest.php b/tests/XML/SchemaValidatableElementTraitTest.php
index 6892d414..9210aba7 100644
--- a/tests/XML/SchemaValidatableElementTraitTest.php
+++ b/tests/XML/SchemaValidatableElementTraitTest.php
@@ -8,8 +8,9 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use SimpleSAML\XML\DOMDocumentFactory;
-use SimpleSAML\XML\Exception\{IOException, SchemaViolationException};
+use SimpleSAML\XML\Exception\IOException;
use SimpleSAML\XML\SchemaValidatableElementTrait;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
/**
* Class \SimpleSAML\XML\SchemaValidatableElementTraitTest
diff --git a/tests/XML/TypedTextContentTraitTest.php b/tests/XML/TypedTextContentTraitTest.php
index d566de1b..523f46fa 100644
--- a/tests/XML/TypedTextContentTraitTest.php
+++ b/tests/XML/TypedTextContentTraitTest.php
@@ -7,7 +7,7 @@
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
use SimpleSAML\XML\DOMDocumentFactory;
-use SimpleSAML\XML\Exception\{InvalidValueTypeException, SchemaViolationException};
+use SimpleSAML\XMLSchema\Exception\{InvalidValueTypeException, SchemaViolationException};
use SimpleSAML\XML\TypedTextContentTrait;
/**
diff --git a/tests/XMLSchema/Type/BlockSetValueTest.php b/tests/XMLSchema/Type/BlockSetValueTest.php
new file mode 100644
index 00000000..97da2306
--- /dev/null
+++ b/tests/XMLSchema/Type/BlockSetValueTest.php
@@ -0,0 +1,58 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideBlockSet(): array
+ {
+ return [
+ '#all' => ['#all', true],
+ '#all combined' => ['#all extension restriction substitution', false],
+ 'extension' => ['extension', true],
+ 'list' => ['list', false],
+ 'union' => ['union', false],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', true],
+ 'combined' => ['extension restriction substitution', true],
+ 'multiple spaces and newlines' => [
+ "extension restriction \n substitution",
+ true,
+ ],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', true],
+ ];
+ }
+}
diff --git a/tests/Type/AnyURIValueTest.php b/tests/XMLSchema/Type/Builtin/AnyURIValueTest.php
similarity index 88%
rename from tests/Type/AnyURIValueTest.php
rename to tests/XMLSchema/Type/Builtin/AnyURIValueTest.php
index 7d89896c..1be36889 100644
--- a/tests/Type/AnyURIValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/AnyURIValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\AnyURITest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\{AnyURIValue, StringValue};
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\{AnyURIValue, StringValue};
/**
- * Class \SimpleSAML\Test\XML\Type\AnyURIValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\AnyURIValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/Base64BinaryValueTest.php b/tests/XMLSchema/Type/Builtin/Base64BinaryValueTest.php
similarity index 86%
rename from tests/Type/Base64BinaryValueTest.php
rename to tests/XMLSchema/Type/Builtin/Base64BinaryValueTest.php
index 5d898ab2..2581e21a 100644
--- a/tests/Type/Base64BinaryValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/Base64BinaryValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\Base64BinaryTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\Base64BinaryValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\Base64BinaryValue;
/**
- * Class \SimpleSAML\Test\XML\Type\Base64BinaryValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\Base64BinaryValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/BooleanValueTest.php b/tests/XMLSchema/Type/Builtin/BooleanValueTest.php
similarity index 87%
rename from tests/Type/BooleanValueTest.php
rename to tests/XMLSchema/Type/Builtin/BooleanValueTest.php
index 66d4992d..26049d43 100644
--- a/tests/Type/BooleanValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/BooleanValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\BooleanTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\BooleanValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\BooleanValue;
/**
- * Class \SimpleSAML\Test\XML\Type\BooleanValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\BooleanValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/ByteValueTest.php b/tests/XMLSchema/Type/Builtin/ByteValueTest.php
similarity index 87%
rename from tests/Type/ByteValueTest.php
rename to tests/XMLSchema/Type/Builtin/ByteValueTest.php
index ccd04132..76972c8e 100644
--- a/tests/Type/ByteValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/ByteValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\ByteTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\ByteValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\ByteValue;
/**
- * Class \SimpleSAML\Test\XML\Type\ByteValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\ByteValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/DateTimeValueTest.php b/tests/XMLSchema/Type/Builtin/DateTimeValueTest.php
similarity index 90%
rename from tests/Type/DateTimeValueTest.php
rename to tests/XMLSchema/Type/Builtin/DateTimeValueTest.php
index f674f251..bda68f19 100644
--- a/tests/Type/DateTimeValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/DateTimeValueTest.php
@@ -2,17 +2,17 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use DateTimeImmutable;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\DateTimeTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\DateTimeValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\DateTimeValue;
/**
- * Class \SimpleSAML\Test\XML\Type\DateTimeValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\DateTimeValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/DateValueTest.php b/tests/XMLSchema/Type/Builtin/DateValueTest.php
similarity index 87%
rename from tests/Type/DateValueTest.php
rename to tests/XMLSchema/Type/Builtin/DateValueTest.php
index 5bfff41d..1f501bee 100644
--- a/tests/Type/DateValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/DateValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\DateTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\DateValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\DateValue;
/**
- * Class \SimpleSAML\Test\XML\Type\DateValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\DateValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/DayValueTest.php b/tests/XMLSchema/Type/Builtin/DayValueTest.php
similarity index 86%
rename from tests/Type/DayValueTest.php
rename to tests/XMLSchema/Type/Builtin/DayValueTest.php
index 783836eb..8985cca7 100644
--- a/tests/Type/DayValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/DayValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\DayTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\DayValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\DayValue;
/**
- * Class \SimpleSAML\Test\XML\Type\DayValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\DayValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/DecimalValueTest.php b/tests/XMLSchema/Type/Builtin/DecimalValueTest.php
similarity index 86%
rename from tests/Type/DecimalValueTest.php
rename to tests/XMLSchema/Type/Builtin/DecimalValueTest.php
index df1576bb..554043c9 100644
--- a/tests/Type/DecimalValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/DecimalValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\DecimalTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\DecimalValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\DecimalValue;
/**
- * Class \SimpleSAML\Test\XML\Type\DecimalValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\DecimalValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/DoubleValueTest.php b/tests/XMLSchema/Type/Builtin/DoubleValueTest.php
similarity index 86%
rename from tests/Type/DoubleValueTest.php
rename to tests/XMLSchema/Type/Builtin/DoubleValueTest.php
index 2e9fdbde..cbf0231b 100644
--- a/tests/Type/DoubleValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/DoubleValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\DoubleTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\DoubleValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\DoubleValue;
/**
- * Class \SimpleSAML\Test\XML\Type\DoubleValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\DoubleValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/DurationValueTest.php b/tests/XMLSchema/Type/Builtin/DurationValueTest.php
similarity index 87%
rename from tests/Type/DurationValueTest.php
rename to tests/XMLSchema/Type/Builtin/DurationValueTest.php
index 76dfad7f..75f3f447 100644
--- a/tests/Type/DurationValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/DurationValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\DurationTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\DurationValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\DurationValue;
/**
- * Class \SimpleSAML\Test\XML\Type\DurationValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\DurationValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/EntitiesValueTest.php b/tests/XMLSchema/Type/Builtin/EntitiesValueTest.php
similarity index 89%
rename from tests/Type/EntitiesValueTest.php
rename to tests/XMLSchema/Type/Builtin/EntitiesValueTest.php
index 4dc3fca1..ba8b593b 100644
--- a/tests/Type/EntitiesValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/EntitiesValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\EntitiesTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\EntitiesValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\EntitiesValue;
/**
- * Class \SimpleSAML\Test\XML\Type\EntitiesValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\EntitiesValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/EntityValueTest.php b/tests/XMLSchema/Type/Builtin/EntityValueTest.php
similarity index 87%
rename from tests/Type/EntityValueTest.php
rename to tests/XMLSchema/Type/Builtin/EntityValueTest.php
index 1dda3214..e687fd5a 100644
--- a/tests/Type/EntityValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/EntityValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\EntityTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\EntityValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\EntityValue;
/**
- * Class \SimpleSAML\Test\XML\Type\EntityValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\EntityValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/FloatValueTest.php b/tests/XMLSchema/Type/Builtin/FloatValueTest.php
similarity index 86%
rename from tests/Type/FloatValueTest.php
rename to tests/XMLSchema/Type/Builtin/FloatValueTest.php
index eed8dab1..45805deb 100644
--- a/tests/Type/FloatValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/FloatValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\FloatTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\FloatValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\FloatValue;
/**
- * Class \SimpleSAML\Test\XML\Type\FloatValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\FloatValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/HexBinaryValueTest.php b/tests/XMLSchema/Type/Builtin/HexBinaryValueTest.php
similarity index 86%
rename from tests/Type/HexBinaryValueTest.php
rename to tests/XMLSchema/Type/Builtin/HexBinaryValueTest.php
index a4ee9ed3..77c92e1d 100644
--- a/tests/Type/HexBinaryValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/HexBinaryValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\HexBinaryTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\HexBinaryValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\HexBinaryValue;
/**
- * Class \SimpleSAML\Test\XML\Type\HexBinaryValueTest
+ * Class \SimpleSAML\Test\XML\Type\Builtin\HexBinaryValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/IDRefValueTest.php b/tests/XMLSchema/Type/Builtin/IDRefValueTest.php
similarity index 87%
rename from tests/Type/IDRefValueTest.php
rename to tests/XMLSchema/Type/Builtin/IDRefValueTest.php
index 0dae0a0c..0913aa93 100644
--- a/tests/Type/IDRefValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/IDRefValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\IDRefTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\IDRefValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\IDRefValue;
/**
- * Class \SimpleSAML\Test\XML\Type\IDRefValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\IDRefValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/IDRefsValueTest.php b/tests/XMLSchema/Type/Builtin/IDRefsValueTest.php
similarity index 89%
rename from tests/Type/IDRefsValueTest.php
rename to tests/XMLSchema/Type/Builtin/IDRefsValueTest.php
index b0552169..24de325e 100644
--- a/tests/Type/IDRefsValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/IDRefsValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\IDRefsTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\IDRefsValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\IDRefsValue;
/**
- * Class \SimpleSAML\Test\XML\Type\IDRefsValueTest
+ * Class \SimpleSAML\Test\XML\Type\Builtin\IDRefsValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/IDValueTest.php b/tests/XMLSchema/Type/Builtin/IDValueTest.php
similarity index 87%
rename from tests/Type/IDValueTest.php
rename to tests/XMLSchema/Type/Builtin/IDValueTest.php
index 36259901..b4ffecb9 100644
--- a/tests/Type/IDValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/IDValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\IDTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\IDValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\IDValue;
/**
- * Class \SimpleSAML\Test\XML\Type\IDValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\IDValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/IntValueTest.php b/tests/XMLSchema/Type/Builtin/IntValueTest.php
similarity index 87%
rename from tests/Type/IntValueTest.php
rename to tests/XMLSchema/Type/Builtin/IntValueTest.php
index 0153aae7..57a8c661 100644
--- a/tests/Type/IntValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/IntValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\IntTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\IntValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\IntValue;
/**
- * Class \SimpleSAML\Test\XML\Type\IntValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\IntValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/IntegerValueTest.php b/tests/XMLSchema/Type/Builtin/IntegerValueTest.php
similarity index 86%
rename from tests/Type/IntegerValueTest.php
rename to tests/XMLSchema/Type/Builtin/IntegerValueTest.php
index 8a867da9..214efb4e 100644
--- a/tests/Type/IntegerValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/IntegerValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\IntegerTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\IntegerValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\IntegerValue;
/**
- * Class \SimpleSAML\Test\XML\Type\IntegerValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\IntegerValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/LanguageValueTest.php b/tests/XMLSchema/Type/Builtin/LanguageValueTest.php
similarity index 86%
rename from tests/Type/LanguageValueTest.php
rename to tests/XMLSchema/Type/Builtin/LanguageValueTest.php
index 35fcdc06..e971cda2 100644
--- a/tests/Type/LanguageValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/LanguageValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\LanguageTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\LanguageValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\LanguageValue;
/**
- * Class \SimpleSAML\Test\XML\Type\LanguageValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\LanguageValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/LongValueTest.php b/tests/XMLSchema/Type/Builtin/LongValueTest.php
similarity index 87%
rename from tests/Type/LongValueTest.php
rename to tests/XMLSchema/Type/Builtin/LongValueTest.php
index 45e6626d..c6a91159 100644
--- a/tests/Type/LongValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/LongValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\LongTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\LongValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\LongValue;
/**
- * Class \SimpleSAML\Test\XML\Type\LongValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\LongValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/MonthValueTest.php b/tests/XMLSchema/Type/Builtin/MonthValueTest.php
similarity index 87%
rename from tests/Type/MonthValueTest.php
rename to tests/XMLSchema/Type/Builtin/MonthValueTest.php
index 67a0a24b..9dc2a4cd 100644
--- a/tests/Type/MonthValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/MonthValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\MonthTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\MonthValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\MonthValue;
/**
- * Class \SimpleSAML\Test\XML\Type\MonthValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\MonthValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NCNameValueTest.php b/tests/XMLSchema/Type/Builtin/NCNameValueTest.php
similarity index 87%
rename from tests/Type/NCNameValueTest.php
rename to tests/XMLSchema/Type/Builtin/NCNameValueTest.php
index db59ff61..57a5ef1e 100644
--- a/tests/Type/NCNameValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NCNameValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NCNameTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NCNameValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NCNameValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NCNameValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NCNameValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NMTokenValueTest.php b/tests/XMLSchema/Type/Builtin/NMTokenValueTest.php
similarity index 86%
rename from tests/Type/NMTokenValueTest.php
rename to tests/XMLSchema/Type/Builtin/NMTokenValueTest.php
index 8095a2df..a08a8879 100644
--- a/tests/Type/NMTokenValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NMTokenValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NMTokenTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NMTokenValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NMTokenValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NMTokenValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NMTokenValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NMTokensValueTest.php b/tests/XMLSchema/Type/Builtin/NMTokensValueTest.php
similarity index 88%
rename from tests/Type/NMTokensValueTest.php
rename to tests/XMLSchema/Type/Builtin/NMTokensValueTest.php
index e0169b61..a73c8017 100644
--- a/tests/Type/NMTokensValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NMTokensValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NMTokensTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NMTokensValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NMTokensValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NMTokensValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NMTokensValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NameValueTest.php b/tests/XMLSchema/Type/Builtin/NameValueTest.php
similarity index 87%
rename from tests/Type/NameValueTest.php
rename to tests/XMLSchema/Type/Builtin/NameValueTest.php
index 7d8d0c9f..749596d8 100644
--- a/tests/Type/NameValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NameValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NameTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NameValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NameValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NameValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NameValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NegativeIntegerValueTest.php b/tests/XMLSchema/Type/Builtin/NegativeIntegerValueTest.php
similarity index 87%
rename from tests/Type/NegativeIntegerValueTest.php
rename to tests/XMLSchema/Type/Builtin/NegativeIntegerValueTest.php
index 9f735934..7b51b5a0 100644
--- a/tests/Type/NegativeIntegerValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NegativeIntegerValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NegativeIntegerTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NegativeIntegerValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NegativeIntegerValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NegativeIntegerValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NegativeIntegerValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NonNegativeIntegerValueTest.php b/tests/XMLSchema/Type/Builtin/NonNegativeIntegerValueTest.php
similarity index 87%
rename from tests/Type/NonNegativeIntegerValueTest.php
rename to tests/XMLSchema/Type/Builtin/NonNegativeIntegerValueTest.php
index c482aa87..905a0cac 100644
--- a/tests/Type/NonNegativeIntegerValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NonNegativeIntegerValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NonNegativeIntegerTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NonNegativeIntegerValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NonNegativeIntegerValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NonNegativeIntegerValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NonNegativeIntegerValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NonPositiveIntegerValueTest.php b/tests/XMLSchema/Type/Builtin/NonPositiveIntegerValueTest.php
similarity index 87%
rename from tests/Type/NonPositiveIntegerValueTest.php
rename to tests/XMLSchema/Type/Builtin/NonPositiveIntegerValueTest.php
index 6436c94a..92de8ec8 100644
--- a/tests/Type/NonPositiveIntegerValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NonPositiveIntegerValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NonPositiveIntegerTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\NonPositiveIntegerValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\NonPositiveIntegerValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NonPositiveIntegerValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NonPositiveIntegerValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/NormalizedStringValueTest.php b/tests/XMLSchema/Type/Builtin/NormalizedStringValueTest.php
similarity index 85%
rename from tests/Type/NormalizedStringValueTest.php
rename to tests/XMLSchema/Type/Builtin/NormalizedStringValueTest.php
index cbfe3334..096e357a 100644
--- a/tests/Type/NormalizedStringValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/NormalizedStringValueTest.php
@@ -2,15 +2,15 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\NormalizedStringTest;
-use SimpleSAML\XML\Type\NormalizedStringValue;
+use SimpleSAML\XMLSchema\Type\Builtin\NormalizedStringValue;
/**
- * Class \SimpleSAML\Test\XML\Type\NormalizedStringValueValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\NormalizedStringValueValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/PositiveIntegerValueTest.php b/tests/XMLSchema/Type/Builtin/PositiveIntegerValueTest.php
similarity index 87%
rename from tests/Type/PositiveIntegerValueTest.php
rename to tests/XMLSchema/Type/Builtin/PositiveIntegerValueTest.php
index 47dafd65..409c98f7 100644
--- a/tests/Type/PositiveIntegerValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/PositiveIntegerValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\PositiveIntegerTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\PositiveIntegerValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\PositiveIntegerValue;
/**
- * Class \SimpleSAML\Test\XML\Type\PositiveIntegerValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\PositiveIntegerValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/QNameValueTest.php b/tests/XMLSchema/Type/Builtin/QNameValueTest.php
similarity index 90%
rename from tests/Type/QNameValueTest.php
rename to tests/XMLSchema/Type/Builtin/QNameValueTest.php
index a3fe9dec..76f309ae 100644
--- a/tests/Type/QNameValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/QNameValueTest.php
@@ -2,15 +2,15 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\QNameValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\QNameValue;
/**
- * Class \SimpleSAML\Test\XML\Type\QNameValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\QNameValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/ShortValueTest.php b/tests/XMLSchema/Type/Builtin/ShortValueTest.php
similarity index 87%
rename from tests/Type/ShortValueTest.php
rename to tests/XMLSchema/Type/Builtin/ShortValueTest.php
index 379479f8..d35eb8cb 100644
--- a/tests/Type/ShortValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/ShortValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\ShortTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\ShortValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\ShortValue;
/**
- * Class \SimpleSAML\Test\XML\Type\ShortValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\ShortValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/StringValueTest.php b/tests/XMLSchema/Type/Builtin/StringValueTest.php
similarity index 87%
rename from tests/Type/StringValueTest.php
rename to tests/XMLSchema/Type/Builtin/StringValueTest.php
index 4215eb7d..aafff9c7 100644
--- a/tests/Type/StringValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/StringValueTest.php
@@ -2,15 +2,15 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\StringTest;
-use SimpleSAML\XML\Type\StringValue;
+use SimpleSAML\XMLSchema\Type\Builtin\StringValue;
/**
- * Class \SimpleSAML\Test\XML\Type\StringValueValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\StringValueValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/TimeValueTest.php b/tests/XMLSchema/Type/Builtin/TimeValueTest.php
similarity index 86%
rename from tests/Type/TimeValueTest.php
rename to tests/XMLSchema/Type/Builtin/TimeValueTest.php
index f8a5c65f..ae9078a0 100644
--- a/tests/Type/TimeValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/TimeValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\TimeTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\TimeValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\TimeValue;
/**
- * Class \SimpleSAML\Test\XML\Type\TimeValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\TimeValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/TokenValueTest.php b/tests/XMLSchema/Type/Builtin/TokenValueTest.php
similarity index 87%
rename from tests/Type/TokenValueTest.php
rename to tests/XMLSchema/Type/Builtin/TokenValueTest.php
index 474d230d..580d4b2c 100644
--- a/tests/Type/TokenValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/TokenValueTest.php
@@ -2,15 +2,15 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\TokenTest;
-use SimpleSAML\XML\Type\TokenValue;
+use SimpleSAML\XMLSchema\Type\Builtin\TokenValue;
/**
- * Class \SimpleSAML\Test\XML\Type\TokenValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\TokenValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/UnsignedByteValueTest.php b/tests/XMLSchema/Type/Builtin/UnsignedByteValueTest.php
similarity index 87%
rename from tests/Type/UnsignedByteValueTest.php
rename to tests/XMLSchema/Type/Builtin/UnsignedByteValueTest.php
index e5587eb1..fb5fb36a 100644
--- a/tests/Type/UnsignedByteValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/UnsignedByteValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\UnsignedByteTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\UnsignedByteValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\UnsignedByteValue;
/**
- * Class \SimpleSAML\Test\XML\Type\UnsignedByteValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\UnsignedByteValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/UnsignedIntValueTest.php b/tests/XMLSchema/Type/Builtin/UnsignedIntValueTest.php
similarity index 87%
rename from tests/Type/UnsignedIntValueTest.php
rename to tests/XMLSchema/Type/Builtin/UnsignedIntValueTest.php
index fd7992d8..4baee8fc 100644
--- a/tests/Type/UnsignedIntValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/UnsignedIntValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\UnsignedIntTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\UnsignedIntValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\UnsignedIntValue;
/**
- * Class \SimpleSAML\Test\XML\Type\UnsignedIntValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\UnsignedIntValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/UnsignedLongValueTest.php b/tests/XMLSchema/Type/Builtin/UnsignedLongValueTest.php
similarity index 87%
rename from tests/Type/UnsignedLongValueTest.php
rename to tests/XMLSchema/Type/Builtin/UnsignedLongValueTest.php
index e505ceeb..f5a99250 100644
--- a/tests/Type/UnsignedLongValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/UnsignedLongValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\UnsignedLongTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\UnsignedLongValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\UnsignedLongValue;
/**
- * Class \SimpleSAML\Test\XML\Type\UnsignedLongValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\UnsignedLongValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/UnsignedShortValueTest.php b/tests/XMLSchema/Type/Builtin/UnsignedShortValueTest.php
similarity index 87%
rename from tests/Type/UnsignedShortValueTest.php
rename to tests/XMLSchema/Type/Builtin/UnsignedShortValueTest.php
index e13fca99..8f06712b 100644
--- a/tests/Type/UnsignedShortValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/UnsignedShortValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\UnsignedShortTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\UnsignedShortValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\UnsignedShortValue;
/**
- * Class \SimpleSAML\Test\XML\Type\UnsignedShortValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\UnsignedShortValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/YearMonthValueTest.php b/tests/XMLSchema/Type/Builtin/YearMonthValueTest.php
similarity index 86%
rename from tests/Type/YearMonthValueTest.php
rename to tests/XMLSchema/Type/Builtin/YearMonthValueTest.php
index a4a5070d..24eebdce 100644
--- a/tests/Type/YearMonthValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/YearMonthValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\YearMonthTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\YearMonthValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\YearMonthValue;
/**
- * Class \SimpleSAML\Test\XML\Type\YearMonthValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\YearMonthValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/Type/YearValueTest.php b/tests/XMLSchema/Type/Builtin/YearValueTest.php
similarity index 85%
rename from tests/Type/YearValueTest.php
rename to tests/XMLSchema/Type/Builtin/YearValueTest.php
index 7202c060..43d2cd85 100644
--- a/tests/Type/YearValueTest.php
+++ b/tests/XMLSchema/Type/Builtin/YearValueTest.php
@@ -2,16 +2,16 @@
declare(strict_types=1);
-namespace SimpleSAML\Test\XML\Type;
+namespace SimpleSAML\Test\XMLSchema\Type\Builtin;
use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass};
use PHPUnit\Framework\TestCase;
use SimpleSAML\Test\XML\Assert\YearTest;
-use SimpleSAML\XML\Exception\SchemaViolationException;
-use SimpleSAML\XML\Type\YearValue;
+use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
+use SimpleSAML\XMLSchema\Type\Builtin\YearValue;
/**
- * Class \SimpleSAML\Test\XML\Type\YearValueTest
+ * Class \SimpleSAML\Test\XMLSchema\Type\Builtin\YearValueTest
*
* @package simplesamlphp/xml-common
*/
diff --git a/tests/XMLSchema/Type/DerivationControlValueTest.php b/tests/XMLSchema/Type/DerivationControlValueTest.php
new file mode 100644
index 00000000..3e391e04
--- /dev/null
+++ b/tests/XMLSchema/Type/DerivationControlValueTest.php
@@ -0,0 +1,65 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = DerivationControlValue::fromEnum(DerivationControlEnum::Extension);
+ $this->assertEquals(DerivationControlEnum::Extension, $x->toEnum());
+
+ $y = DerivationControlValue::fromString('extension');
+ $this->assertEquals(DerivationControlEnum::Extension, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideDerivationControl(): array
+ {
+ return [
+ 'extension' => ['extension', true],
+ 'list' => ['list', true],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', true],
+ 'union' => ['union', true],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/DerivationSetValueTest.php b/tests/XMLSchema/Type/DerivationSetValueTest.php
new file mode 100644
index 00000000..8e5c9ce0
--- /dev/null
+++ b/tests/XMLSchema/Type/DerivationSetValueTest.php
@@ -0,0 +1,66 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = DerivationSetValue::fromEnum(DerivationControlEnum::Extension);
+ $this->assertEquals(DerivationControlEnum::Extension, $x->toEnum());
+
+ $y = DerivationSetValue::fromString('extension');
+ $this->assertEquals(DerivationControlEnum::Extension, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideDerivationSet(): array
+ {
+ return [
+ '#all' => ['#all', true],
+ 'extension' => ['extension', true],
+ 'list' => ['list', false],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', false],
+ 'union' => ['union', false],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', true],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/FormChoiceValueTest.php b/tests/XMLSchema/Type/FormChoiceValueTest.php
new file mode 100644
index 00000000..842e0115
--- /dev/null
+++ b/tests/XMLSchema/Type/FormChoiceValueTest.php
@@ -0,0 +1,62 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = FormChoiceValue::fromEnum(FormChoiceEnum::Qualified);
+ $this->assertEquals(FormChoiceEnum::Qualified, $x->toEnum());
+
+ $y = FormChoiceValue::fromString('qualified');
+ $this->assertEquals(FormChoiceEnum::Qualified, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideFormChoice(): array
+ {
+ return [
+ 'qualified' => ['qualified', true],
+ 'unqualified' => ['unqualified', true],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/FullDerivationSetValueTest.php b/tests/XMLSchema/Type/FullDerivationSetValueTest.php
new file mode 100644
index 00000000..36cff53e
--- /dev/null
+++ b/tests/XMLSchema/Type/FullDerivationSetValueTest.php
@@ -0,0 +1,58 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideFullDerivationSet(): array
+ {
+ return [
+ '#all' => ['#all', true],
+ '#all combined' => ['#all list restriction union', false],
+ 'extension' => ['extension', true],
+ 'list' => ['list', true],
+ 'union' => ['union', true],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', false],
+ 'combined' => ['restriction union list', true],
+ 'multiple spaces and newlines' => [
+ "restriction list \n union",
+ true,
+ ],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', true],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/MaxOccursValueTest.php b/tests/XMLSchema/Type/MaxOccursValueTest.php
new file mode 100644
index 00000000..39f43abd
--- /dev/null
+++ b/tests/XMLSchema/Type/MaxOccursValueTest.php
@@ -0,0 +1,49 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideMaxOccurs(): array
+ {
+ return [
+ 'negative' => ['-1', false],
+ 'zero' => ['0', true],
+ 'positive' => ['1', true],
+ 'unbounded' => ['unbounded', true],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/MinOccursValueTest.php b/tests/XMLSchema/Type/MinOccursValueTest.php
new file mode 100644
index 00000000..a8d84795
--- /dev/null
+++ b/tests/XMLSchema/Type/MinOccursValueTest.php
@@ -0,0 +1,49 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideMinOccurs(): array
+ {
+ return [
+ 'negative' => ['-1', false],
+ 'zero' => ['0', true],
+ 'positive' => ['1', true],
+ 'unbounded' => ['unbounded', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/NamespaceListValueTest.php b/tests/XMLSchema/Type/NamespaceListValueTest.php
new file mode 100644
index 00000000..7625e9c0
--- /dev/null
+++ b/tests/XMLSchema/Type/NamespaceListValueTest.php
@@ -0,0 +1,71 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = NamespaceListValue::fromEnum(NamespaceEnum::Any);
+ $this->assertEquals(NamespaceEnum::Any, $x->toEnum());
+
+ $y = NameSpaceListValue::fromString('##any');
+ $this->assertEquals(NamespaceEnum::Any, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideNamespaceList(): array
+ {
+ return [
+ '##any' => ['##any', true],
+ '##any combined' => ['##any urn:x-simplesamlphp:namespace', false],
+ '##other' => ['##other', true],
+ '##other combined' => ['##other urn:x-simplesamlphp:namespace', false],
+ '##local' => ['##local', true],
+ '##local combined' => ['##local urn:x-simplesamlphp:namespace', true],
+ '##targetNamespace' => ['##targetNamespace', true],
+ '##targetNamespace combined' => ['##targetNamespace urn:x-simplesamlphp:namespace', true],
+ 'multiple spaces and newlines' => [
+ "urn:x-simplesamlphp:namespace1 urn:x-simplesamlphp:namespace2 \n urn:x-simplesamlphp:namespace3",
+ true,
+ ],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/ProcessContentsValueTest.php b/tests/XMLSchema/Type/ProcessContentsValueTest.php
new file mode 100644
index 00000000..bf982c0e
--- /dev/null
+++ b/tests/XMLSchema/Type/ProcessContentsValueTest.php
@@ -0,0 +1,63 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = ProcessContentsValue::fromEnum(ProcessContentsEnum::Lax);
+ $this->assertEquals(ProcessContentsEnum::Lax, $x->toEnum());
+
+ $y = ProcessContentsValue::fromString('lax');
+ $this->assertEquals(ProcessContentsEnum::Lax, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideProcessContents(): array
+ {
+ return [
+ 'lax' => ['lax', true],
+ 'skip' => ['skip', true],
+ 'strict' => ['strict', true],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/PublicValueTest.php b/tests/XMLSchema/Type/PublicValueTest.php
new file mode 100644
index 00000000..bfc10373
--- /dev/null
+++ b/tests/XMLSchema/Type/PublicValueTest.php
@@ -0,0 +1,57 @@
+assertEquals($normalizedPublic, $value->getValue());
+ $this->assertEquals($public, $value->getRawValue());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function providePublic(): array
+ {
+ return [
+ 'empty string' => ['', ''],
+ 'fpi' => [
+ "-//W3C//DTD HTML 4.01 Transitional//EN",
+ '-//W3C//DTD HTML 4.01 Transitional//EN',
+ ],
+ 'trim' => [
+ " -//W3C//DTD HTML\t\n\r4.01 Transitional//EN ",
+ '-//W3C//DTD HTML 4.01 Transitional//EN',
+ ],
+ 'replace whitespace' => [
+ "-//W3C//DTD HTML\t4.01 Transitional//EN",
+ '-//W3C//DTD HTML 4.01 Transitional//EN',
+ ],
+ 'collapse' => [
+ "-//W3C//DTD HTML\t\n\r4.01 Transitional//EN",
+ '-//W3C//DTD HTML 4.01 Transitional//EN',
+ ],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/ReducedDerivationControlValueTest.php b/tests/XMLSchema/Type/ReducedDerivationControlValueTest.php
new file mode 100644
index 00000000..52e441b2
--- /dev/null
+++ b/tests/XMLSchema/Type/ReducedDerivationControlValueTest.php
@@ -0,0 +1,65 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = ReducedDerivationControlValue::fromEnum(DerivationControlEnum::Extension);
+ $this->assertEquals(DerivationControlEnum::Extension, $x->toEnum());
+
+ $y = ReducedDerivationControlValue::fromString('extension');
+ $this->assertEquals(DerivationControlEnum::Extension, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideReducedDerivationControl(): array
+ {
+ return [
+ 'extension' => ['extension', true],
+ 'list' => ['list', false],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', false],
+ 'union' => ['union', false],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/SimpleDerivationSetValueTest.php b/tests/XMLSchema/Type/SimpleDerivationSetValueTest.php
new file mode 100644
index 00000000..0830e0f2
--- /dev/null
+++ b/tests/XMLSchema/Type/SimpleDerivationSetValueTest.php
@@ -0,0 +1,58 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideSimpleDerivationSet(): array
+ {
+ return [
+ '#all' => ['#all', true],
+ '#all combined' => ['#all list restriction union', false],
+ 'extension' => ['extension', false],
+ 'list' => ['list', true],
+ 'union' => ['union', true],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', false],
+ 'combined' => ['restriction union list', true],
+ 'multiple spaces and newlines' => [
+ "restriction list \n union",
+ true,
+ ],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', true],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/TypeDerivationControlValueTest.php b/tests/XMLSchema/Type/TypeDerivationControlValueTest.php
new file mode 100644
index 00000000..2df2c2f1
--- /dev/null
+++ b/tests/XMLSchema/Type/TypeDerivationControlValueTest.php
@@ -0,0 +1,65 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = TypeDerivationControlValue::fromEnum(DerivationControlEnum::Extension);
+ $this->assertEquals(DerivationControlEnum::Extension, $x->toEnum());
+
+ $y = TypeDerivationControlValue::fromString('extension');
+ $this->assertEquals(DerivationControlEnum::Extension, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideTypeDerivationControl(): array
+ {
+ return [
+ 'extension' => ['extension', true],
+ 'list' => ['list', true],
+ 'restriction' => ['restriction', true],
+ 'substitution' => ['substitution', false],
+ 'union' => ['union', true],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/UseValueTest.php b/tests/XMLSchema/Type/UseValueTest.php
new file mode 100644
index 00000000..f76189c5
--- /dev/null
+++ b/tests/XMLSchema/Type/UseValueTest.php
@@ -0,0 +1,63 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = UseValue::fromEnum(UseEnum::Optional);
+ $this->assertEquals(UseEnum::Optional, $x->toEnum());
+
+ $y = UseValue::fromString('optional');
+ $this->assertEquals(UseEnum::Optional, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideUse(): array
+ {
+ return [
+ 'optional' => ['optional', true],
+ 'prohibited' => ['prohibited', true],
+ 'required' => ['required', true],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/Type/WhiteSpaceValueTest.php b/tests/XMLSchema/Type/WhiteSpaceValueTest.php
new file mode 100644
index 00000000..1251e14f
--- /dev/null
+++ b/tests/XMLSchema/Type/WhiteSpaceValueTest.php
@@ -0,0 +1,63 @@
+assertTrue($shouldPass);
+ } catch (SchemaViolationException $e) {
+ $this->assertFalse($shouldPass);
+ }
+ }
+
+
+ /**
+ * Test helpers
+ */
+ public function testHelpers(): void
+ {
+ $x = WhiteSpaceValue::fromEnum(WhiteSpaceEnum::Collapse);
+ $this->assertEquals(WhiteSpaceEnum::Collapse, $x->toEnum());
+
+ $y = WhiteSpaceValue::fromString('collapse');
+ $this->assertEquals(WhiteSpaceEnum::Collapse, $y->toEnum());
+ }
+
+
+ /**
+ * @return array
+ */
+ public static function provideWhiteSpace(): array
+ {
+ return [
+ 'collapse' => ['collapse', true],
+ 'preserve' => ['preserve', true],
+ 'replace' => ['replace', true],
+ 'undefined' => ['undefined', false],
+ 'empty' => ['', false],
+ ];
+ }
+}
diff --git a/tests/XMLSchema/XML/ElementRegistryTest.php b/tests/XMLSchema/XML/ElementRegistryTest.php
new file mode 100644
index 00000000..d0addc70
--- /dev/null
+++ b/tests/XMLSchema/XML/ElementRegistryTest.php
@@ -0,0 +1,37 @@
+ $elements) {
+ foreach ($elements as $localName => $fqdn) {
+ $this->assertTrue(class_exists($fqdn), sprintf('Class \'%s\' could not be found.', $fqdn));
+ $this->assertEquals($fqdn::getLocalName(), $localName);
+ $this->assertEquals($fqdn::getNamespaceURI(), $namespaceURI);
+ }
+ }
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/AllTest.php b/tests/XMLSchema/XML/xs/AllTest.php
new file mode 100644
index 00000000..88f46128
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/AllTest.php
@@ -0,0 +1,252 @@
+appendChild($simpleTypeText);
+
+ $complexTypeDocument = DOMDocumentFactory::create();
+ $complexTypeText = new DOMText('ComplexType');
+ $complexTypeDocument->appendChild($complexTypeText);
+
+ $groupDocument = DOMDocumentFactory::create();
+ $groupText = new DOMText('Group');
+ $groupDocument->appendChild($groupText);
+
+ $attributeGroupDocument = DOMDocumentFactory::create();
+ $attributeGroupText = new DOMText('AttributeGroup');
+ $attributeGroupDocument->appendChild($attributeGroupText);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $documentation1 = new Documentation(
+ $simpleTypeDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation1 = new Annotation(
+ [],
+ [$documentation1],
+ IDValue::fromString('phpunit_annotation1'),
+ [$attr1],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+
+ // TopLevelSimpleType
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ );
+
+ $xsList = new XsList(
+ $localSimpleType,
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ );
+
+ $topLevelSimpleType = new TopLevelSimpleType(
+ $xsList,
+ NCNameValue::fromString('phpunit'),
+ SimpleDerivationSetValue::fromString('#all'),
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ // TopLevelComplexType
+ $anyAttribute1 = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute1'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group1'),
+ [$attr4],
+ );
+
+ $topLevelComplexType = new TopLevelComplexType(
+ NCNameValue::fromString('complex'),
+ BooleanValue::fromBoolean(true),
+ BooleanValue::fromBoolean(false),
+ DerivationSetValue::fromEnum(DerivationControlEnum::Restriction),
+ DerivationSetValue::fromString('#all'),
+ null, // content
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute1,
+ null,
+ IDValue::fromString('phpunit_complexType'),
+ [$attr4],
+ );
+
+ // Group
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $narrowMaxMinElement = new NarrowMaxMinElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ minOccurs: MinOccursValue::fromInteger(0),
+ maxOccurs: MaxOccursValue::fromInteger(1),
+ default: StringValue::fromString('1'),
+ nillable: BooleanValue::fromBoolean(true),
+ block: BlockSetValue::fromString('#all'),
+ form: FormChoiceValue::fromEnum(FormChoiceEnum::Qualified),
+ annotation: null,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ $all = new All(
+ null,
+ null,
+ [$narrowMaxMinElement],
+ $annotation1,
+ IDValue::fromString('phpunit_all'),
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($all),
+ );
+
+ $this->assertFalse($all->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/AnnotationTest.php b/tests/XMLSchema/XML/xs/AnnotationTest.php
new file mode 100644
index 00000000..e918a06d
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/AnnotationTest.php
@@ -0,0 +1,118 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit'),
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($annotation),
+ );
+
+ $this->assertFalse($annotation->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/AnyAttributeTest.php b/tests/XMLSchema/XML/xs/AnyAttributeTest.php
new file mode 100644
index 00000000..e1505d44
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/AnyAttributeTest.php
@@ -0,0 +1,133 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ $annotation,
+ IDValue::fromString('phpunit_anyattribute'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($anyAttribute),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/AnyTest.php b/tests/XMLSchema/XML/xs/AnyTest.php
new file mode 100644
index 00000000..019a670e
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/AnyTest.php
@@ -0,0 +1,156 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $any = new Any(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ $annotation,
+ IDValue::fromString('phpunit_any'),
+ [$attr4],
+ MinOccursValue::fromInteger(1),
+ MaxOccursValue::fromString('unbounded'),
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($any),
+ );
+ }
+
+
+ /**
+ * Adding an empty xs:Any element should yield an empty element.
+ */
+ public function testMarshallingEmptyElement(): void
+ {
+ $xsns = C::NS_XS;
+ $any = new Any();
+ $this->assertEquals(
+ "",
+ strval($any),
+ );
+ $this->assertTrue($any->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/AppinfoTest.php b/tests/XMLSchema/XML/xs/AppinfoTest.php
new file mode 100644
index 00000000..9c93d9b3
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/AppinfoTest.php
@@ -0,0 +1,68 @@
+appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $appinfo = new Appinfo($document->childNodes, AnyURIValue::fromString('urn:x-simplesamlphp:source'), [$attr1]);
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($appinfo),
+ );
+
+ $this->assertFalse($appinfo->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ChoiceTest.php b/tests/XMLSchema/XML/xs/ChoiceTest.php
new file mode 100644
index 00000000..dfe1b664
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ChoiceTest.php
@@ -0,0 +1,152 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ );
+
+ $choice = new Choice(
+ MinOccursValue::fromInteger(0),
+ MaxOccursValue::fromString('unbounded'),
+ [$referencedGroup],
+ $annotation,
+ IDValue::fromString('phpunit_choice'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($choice),
+ );
+ }
+
+
+ /**
+ * Creating an empty Choice element should yield an empty element.
+ */
+ public function testMarshallingEmptyElement(): void
+ {
+ $choice = new Choice();
+ $this->assertEquals(
+ '',
+ strval($choice),
+ );
+ $this->assertTrue($choice->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ComplexContentTest.php b/tests/XMLSchema/XML/xs/ComplexContentTest.php
new file mode 100644
index 00000000..5e98a473
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ComplexContentTest.php
@@ -0,0 +1,168 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $complexRestriction = new ComplexRestriction(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ null,
+ IDValue::fromString('phpunit_restriction'),
+ [$attr4],
+ );
+
+ $complexContent = new ComplexContent(
+ $complexRestriction,
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_complexContent'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($complexContent),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ComplexRestrictionTest.php b/tests/XMLSchema/XML/xs/ComplexRestrictionTest.php
new file mode 100644
index 00000000..61157d41
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ComplexRestrictionTest.php
@@ -0,0 +1,162 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $complexRestriction = new ComplexRestriction(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_restriction'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($complexRestriction),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/DocumentationTest.php b/tests/XMLSchema/XML/xs/DocumentationTest.php
new file mode 100644
index 00000000..0c5b9c6c
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/DocumentationTest.php
@@ -0,0 +1,76 @@
+appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $documentation = new Documentation(
+ $document->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($documentation),
+ );
+
+ $this->assertFalse($documentation->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/EnumerationTest.php b/tests/XMLSchema/XML/xs/EnumerationTest.php
new file mode 100644
index 00000000..0141d242
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/EnumerationTest.php
@@ -0,0 +1,129 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $enumeration = new Enumeration(
+ StringValue::fromString('dummy'),
+ $annotation,
+ IDValue::fromString('phpunit_enumeration'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($enumeration),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ExtensionTest.php b/tests/XMLSchema/XML/xs/ExtensionTest.php
new file mode 100644
index 00000000..98d6a6db
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ExtensionTest.php
@@ -0,0 +1,160 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $extension = new Extension(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_extension'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($extension),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/FieldTest.php b/tests/XMLSchema/XML/xs/FieldTest.php
new file mode 100644
index 00000000..6ed0da45
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/FieldTest.php
@@ -0,0 +1,127 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ $annotation,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($field),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/FractionDigitsTest.php b/tests/XMLSchema/XML/xs/FractionDigitsTest.php
new file mode 100644
index 00000000..5c0e8932
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/FractionDigitsTest.php
@@ -0,0 +1,132 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $fractionDigits = new FractionDigits(
+ NonNegativeIntegerValue::fromInteger(2),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_fractionDigits'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($fractionDigits),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ImportTest.php b/tests/XMLSchema/XML/xs/ImportTest.php
new file mode 100644
index 00000000..6e6d8b93
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ImportTest.php
@@ -0,0 +1,128 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $import = new Import(
+ AnyURIValue::fromString('urn:x-simplesamlphp:namespace'),
+ AnyURIValue::fromString('file:///tmp/schema.xsd'),
+ $annotation,
+ IDValue::fromString('phpunit_import'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($import),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/IncludeTest.php b/tests/XMLSchema/XML/xs/IncludeTest.php
new file mode 100644
index 00000000..4aba3b80
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/IncludeTest.php
@@ -0,0 +1,127 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $include = new XsInclude(
+ AnyURIValue::fromString('file:///tmp/schema.xsd'),
+ $annotation,
+ IDValue::fromString('phpunit_include'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($include),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/KeyTest.php b/tests/XMLSchema/XML/xs/KeyTest.php
new file mode 100644
index 00000000..4a10acaa
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/KeyTest.php
@@ -0,0 +1,162 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation1 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation1'),
+ [$attr3],
+ );
+ $annotation2 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation2'),
+ [$attr3],
+ );
+ $annotation3 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation3'),
+ [$attr3],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ $annotation2,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ $annotation3,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $key = new Key(
+ NCNameValue::fromString('phpunit_key'),
+ $selector,
+ [$field],
+ $annotation1,
+ IDValue::fromString('phpunit'),
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($key),
+ );
+
+ $this->assertFalse($key->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/KeyrefTest.php b/tests/XMLSchema/XML/xs/KeyrefTest.php
new file mode 100644
index 00000000..1a665396
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/KeyrefTest.php
@@ -0,0 +1,163 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation1 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation1'),
+ [$attr3],
+ );
+ $annotation2 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation2'),
+ [$attr3],
+ );
+ $annotation3 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation3'),
+ [$attr3],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ $annotation2,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ $annotation3,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ $annotation1,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($keyref),
+ );
+
+ $this->assertFalse($keyref->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/LengthTest.php b/tests/XMLSchema/XML/xs/LengthTest.php
new file mode 100644
index 00000000..fc405924
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/LengthTest.php
@@ -0,0 +1,132 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $length = new Length(
+ NonNegativeIntegerValue::fromInteger(512),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_length'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($length),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ListTest.php b/tests/XMLSchema/XML/xs/ListTest.php
new file mode 100644
index 00000000..5be8c8f8
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ListTest.php
@@ -0,0 +1,128 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $xsList = new XsList(
+ null, // simpleType
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ $annotation,
+ IDValue::fromString('phpunit_list'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($xsList),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/LocalAttributeTest.php b/tests/XMLSchema/XML/xs/LocalAttributeTest.php
new file mode 100644
index 00000000..7c01146a
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/LocalAttributeTest.php
@@ -0,0 +1,153 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $simpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $attribute = new LocalAttribute(
+ null,
+ null,
+ QNameValue::fromString('{http://www.w3.org/XML/1998/namespace}xml:lang'),
+ UseValue::fromEnum(UseEnum::Required),
+ StringValue::fromString('en'),
+ StringValue::fromString('en'),
+ FormChoiceValue::fromEnum(FormChoiceEnum::Unqualified),
+ $simpleType,
+ $annotation,
+ IDValue::fromString('phpunit_attribute'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($attribute),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/LocalComplexTypeTest.php b/tests/XMLSchema/XML/xs/LocalComplexTypeTest.php
new file mode 100644
index 00000000..ac2d0699
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/LocalComplexTypeTest.php
@@ -0,0 +1,165 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $localComplexType = new LocalComplexType(
+ BooleanValue::fromBoolean(true),
+ null, // content
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_complexType'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($localComplexType),
+ );
+
+ $this->assertFalse($localComplexType->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/LocalElementTest.php b/tests/XMLSchema/XML/xs/LocalElementTest.php
new file mode 100644
index 00000000..a9e77647
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/LocalElementTest.php
@@ -0,0 +1,185 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $localElement = new LocalElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ minOccurs: MinOccursValue::fromInteger(0),
+ maxOccurs: MaxOccursValue::fromString('unbounded'),
+ default: StringValue::fromString('1'),
+ nillable: BooleanValue::fromBoolean(true),
+ block: BlockSetValue::fromString('#all'),
+ form: FormChoiceValue::fromEnum(FormChoiceEnum::Qualified),
+ annotation: $annotation,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($localElement),
+ );
+
+ $this->assertFalse($localElement->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/LocalSimpleTypeTest.php b/tests/XMLSchema/XML/xs/LocalSimpleTypeTest.php
new file mode 100644
index 00000000..56ce90a3
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/LocalSimpleTypeTest.php
@@ -0,0 +1,139 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ $annotation,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($localSimpleType),
+ );
+
+ $this->assertFalse($localSimpleType->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/MaxExclusiveTest.php b/tests/XMLSchema/XML/xs/MaxExclusiveTest.php
new file mode 100644
index 00000000..2be7c753
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/MaxExclusiveTest.php
@@ -0,0 +1,130 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $maxExclusive = new MaxExclusive(
+ StringValue::fromString('1024'),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_maxexclusive'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($maxExclusive),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/MaxInclusiveTest.php b/tests/XMLSchema/XML/xs/MaxInclusiveTest.php
new file mode 100644
index 00000000..d2a5e3f9
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/MaxInclusiveTest.php
@@ -0,0 +1,130 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $maxInclusive = new MaxInclusive(
+ StringValue::fromString('1024'),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_maxinclusive'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($maxInclusive),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/MaxLengthTest.php b/tests/XMLSchema/XML/xs/MaxLengthTest.php
new file mode 100644
index 00000000..f4b13175
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/MaxLengthTest.php
@@ -0,0 +1,132 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $MaxLength = new MaxLength(
+ NonNegativeIntegerValue::fromInteger(1024),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_maxlength'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($MaxLength),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/MinExclusiveTest.php b/tests/XMLSchema/XML/xs/MinExclusiveTest.php
new file mode 100644
index 00000000..48222702
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/MinExclusiveTest.php
@@ -0,0 +1,130 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $minExclusive = new MinExclusive(
+ StringValue::fromString('128'),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_minexclusive'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($minExclusive),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/MinInclusiveTest.php b/tests/XMLSchema/XML/xs/MinInclusiveTest.php
new file mode 100644
index 00000000..e2c07f3d
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/MinInclusiveTest.php
@@ -0,0 +1,130 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $minInclusive = new MinInclusive(
+ StringValue::fromString('128'),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_mininclusive'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($minInclusive),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/MinLengthTest.php b/tests/XMLSchema/XML/xs/MinLengthTest.php
new file mode 100644
index 00000000..87b0a2f3
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/MinLengthTest.php
@@ -0,0 +1,132 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $minLength = new MinLength(
+ NonNegativeIntegerValue::fromInteger(128),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_minlength'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($minLength),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/NamedAttributeGroupTest.php b/tests/XMLSchema/XML/xs/NamedAttributeGroupTest.php
new file mode 100644
index 00000000..5c8ed55f
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/NamedAttributeGroupTest.php
@@ -0,0 +1,156 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $attributeGroup = new NamedAttributeGroup(
+ NCNameValue::fromString("number"),
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_attributeGroup'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($attributeGroup),
+ );
+
+ $this->assertFalse($attributeGroup->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/NamedGroupTest.php b/tests/XMLSchema/XML/xs/NamedGroupTest.php
new file mode 100644
index 00000000..1f37d69f
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/NamedGroupTest.php
@@ -0,0 +1,197 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $narrowMaxMinElement = new NarrowMaxMinElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ minOccurs: MinOccursValue::fromInteger(0),
+ maxOccurs: MaxOccursValue::fromInteger(1),
+ default: StringValue::fromString('1'),
+ nillable: BooleanValue::fromBoolean(true),
+ block: BlockSetValue::fromString('#all'),
+ form: FormChoiceValue::fromEnum(FormChoiceEnum::Qualified),
+ annotation: $annotation,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ $all = new All(null, null, [$narrowMaxMinElement], null, IDValue::fromString('phpunit_all'));
+
+ $namedGroup = new NamedGroup(
+ $all,
+ NCNameValue::fromString("dulyNoted"),
+ $annotation,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($namedGroup),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/NarrowMaxMinElementTest.php b/tests/XMLSchema/XML/xs/NarrowMaxMinElementTest.php
new file mode 100644
index 00000000..67ac350d
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/NarrowMaxMinElementTest.php
@@ -0,0 +1,185 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $narrowMaxMinElement = new NarrowMaxMinElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ minOccurs: MinOccursValue::fromInteger(0),
+ maxOccurs: MaxOccursValue::fromInteger(1),
+ default: StringValue::fromString('1'),
+ nillable: BooleanValue::fromBoolean(true),
+ block: BlockSetValue::fromString('#all'),
+ form: FormChoiceValue::fromEnum(FormChoiceEnum::Qualified),
+ annotation: $annotation,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($narrowMaxMinElement),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/NotationTest.php b/tests/XMLSchema/XML/xs/NotationTest.php
new file mode 100644
index 00000000..03828f45
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/NotationTest.php
@@ -0,0 +1,130 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $notation = new Notation(
+ NCNameValue::fromString('jpeg'),
+ PublicValue::fromString('image/jpeg'),
+ AnyURIValue::fromString('viewer.exe'),
+ $annotation,
+ IDValue::fromString('phpunit_notation'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($notation),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/PatternTest.php b/tests/XMLSchema/XML/xs/PatternTest.php
new file mode 100644
index 00000000..28f1ddad
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/PatternTest.php
@@ -0,0 +1,129 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $pattern = new Pattern(
+ StringValue::fromString('[A-Za-z0-9]'),
+ $annotation,
+ IDValue::fromString('phpunit_pattern'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($pattern),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/RedefineTest.php b/tests/XMLSchema/XML/xs/RedefineTest.php
new file mode 100644
index 00000000..c06bec24
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/RedefineTest.php
@@ -0,0 +1,327 @@
+appendChild($simpleTypeText);
+
+ $complexTypeDocument = DOMDocumentFactory::create();
+ $complexTypeText = new DOMText('ComplexType');
+ $complexTypeDocument->appendChild($complexTypeText);
+
+ $groupDocument = DOMDocumentFactory::create();
+ $groupText = new DOMText('Group');
+ $groupDocument->appendChild($groupText);
+
+ $attributeGroupDocument = DOMDocumentFactory::create();
+ $attributeGroupText = new DOMText('AttributeGroup');
+ $attributeGroupDocument->appendChild($attributeGroupText);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $documentation1 = new Documentation(
+ $simpleTypeDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+ $documentation2 = new Documentation(
+ $complexTypeDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+ $documentation3 = new Documentation(
+ $groupDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+ $documentation4 = new Documentation(
+ $attributeGroupDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation1 = new Annotation(
+ [],
+ [$documentation1],
+ IDValue::fromString('phpunit_annotation1'),
+ [$attr1],
+ );
+
+ $annotation2 = new Annotation(
+ [],
+ [$documentation2],
+ IDValue::fromString('phpunit_annotation2'),
+ [$attr1],
+ );
+
+ $annotation3 = new Annotation(
+ [],
+ [$documentation3],
+ IDValue::fromString('phpunit_annotation3'),
+ [$attr1],
+ );
+
+ $annotation4 = new Annotation(
+ [],
+ [$documentation4],
+ IDValue::fromString('phpunit_annotation4'),
+ [$attr1],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+
+ // TopLevelSimpleType
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ );
+
+ $xsList = new XsList(
+ $localSimpleType,
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ );
+
+ $topLevelSimpleType = new TopLevelSimpleType(
+ $xsList,
+ NCNameValue::fromString('phpunit'),
+ SimpleDerivationSetValue::fromString('#all'),
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ // TopLevelComplexType
+ $anyAttribute1 = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute1'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group1'),
+ [$attr4],
+ );
+
+ $topLevelComplexType = new TopLevelComplexType(
+ NCNameValue::fromString('complex'),
+ BooleanValue::fromBoolean(true),
+ BooleanValue::fromBoolean(false),
+ DerivationSetValue::fromEnum(DerivationControlEnum::Restriction),
+ DerivationSetValue::fromString('#all'),
+ null, // content
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute1,
+ null,
+ IDValue::fromString('phpunit_complexType'),
+ [$attr4],
+ );
+
+ // Group
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $narrowMaxMinElement = new NarrowMaxMinElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ minOccurs: MinOccursValue::fromInteger(0),
+ maxOccurs: MaxOccursValue::fromInteger(1),
+ default: StringValue::fromString('1'),
+ nillable: BooleanValue::fromBoolean(true),
+ block: BlockSetValue::fromString('#all'),
+ form: FormChoiceValue::fromEnum(FormChoiceEnum::Qualified),
+ annotation: null,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ $all = new All(null, null, [$narrowMaxMinElement], null, IDValue::fromString('phpunit_all'));
+
+ $namedGroup = new NamedGroup(
+ $all,
+ NCNameValue::fromString("dulyNoted"),
+ null,
+ IDValue::fromString('phpunit_group2'),
+ [$attr4],
+ );
+
+ // AttributeGroup
+ $anyAttribute2 = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute2'),
+ );
+
+ $attributeGroup = new NamedAttributeGroup(
+ NCNameValue::fromString("number"),
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute2,
+ null,
+ IDValue::fromString('phpunit_attributeGroup'),
+ [$attr4],
+ );
+
+ $redefine = new Redefine(
+ AnyURIValue::fromString('https://example.org/schema.xsd'),
+ IDValue::fromString('phpunit_redefine'),
+ [
+ $annotation1,
+ $topLevelSimpleType,
+ $annotation2,
+ $topLevelComplexType,
+ $annotation3,
+ $namedGroup,
+ $annotation4,
+ $attributeGroup,
+ ],
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($redefine),
+ );
+
+ $this->assertFalse($redefine->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ReferencedAttributeGroupTest.php b/tests/XMLSchema/XML/xs/ReferencedAttributeGroupTest.php
new file mode 100644
index 00000000..64891d67
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ReferencedAttributeGroupTest.php
@@ -0,0 +1,133 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $attributeGroup = new ReferencedAttributeGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:occurs"),
+ $annotation,
+ IDValue::fromString('phpunit_attributeGroup'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($attributeGroup),
+ );
+
+ $this->assertFalse($attributeGroup->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/ReferencedGroupTest.php b/tests/XMLSchema/XML/xs/ReferencedGroupTest.php
new file mode 100644
index 00000000..55ce918d
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/ReferencedGroupTest.php
@@ -0,0 +1,133 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ $annotation,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($referencedGroup),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/RestrictionTest.php b/tests/XMLSchema/XML/xs/RestrictionTest.php
new file mode 100644
index 00000000..c11f6bc7
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/RestrictionTest.php
@@ -0,0 +1,141 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $enum1 = new Enumeration(NonNegativeIntegerValue::fromInteger(0));
+ $enum2 = new Enumeration(NonNegativeIntegerValue::fromInteger(1));
+ $facets = [$enum1, $enum2];
+
+ $restriction = new Restriction(
+ null, // simpleType
+ $facets,
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ $annotation,
+ IDValue::fromString('phpunit_restriction'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($restriction),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SchemaTest.php b/tests/XMLSchema/XML/xs/SchemaTest.php
new file mode 100644
index 00000000..a9919b7e
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SchemaTest.php
@@ -0,0 +1,249 @@
+appendChild($importText);
+
+ $elementDocument = DOMDocumentFactory::create();
+ $elementText = new DOMText('Element');
+ $elementDocument->appendChild($elementText);
+
+ $attributeDocument = DOMDocumentFactory::create();
+ $attributeText = new DOMText('Attribute');
+ $attributeDocument->appendChild($attributeText);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $documentation1 = new Documentation(
+ $importDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+ $documentation2 = new Documentation(
+ $elementDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+ $documentation3 = new Documentation(
+ $attributeDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation1 = new Annotation(
+ [],
+ [$documentation1],
+ IDValue::fromString('phpunit_annotation1'),
+ [$attr1],
+ );
+
+ $annotation2 = new Annotation(
+ [],
+ [$documentation2],
+ IDValue::fromString('phpunit_annotation2'),
+ [$attr1],
+ );
+
+ $annotation3 = new Annotation(
+ [],
+ [$documentation3],
+ IDValue::fromString('phpunit_annotation3'),
+ [$attr1],
+ );
+
+ // Import
+ $import = new Import(
+ AnyURIValue::fromString('urn:x-simplesamlphp:namespace'),
+ AnyURIValue::fromString('file:///tmp/schema.xsd'),
+ null,
+ IDValue::fromString('phpunit_import'),
+ [$attr4],
+ );
+
+ // Element
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $topLevelElement = new TopLevelElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ substitutionGroup: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:typeDefParticle'),
+ fixed: StringValue::fromString('1'),
+ final: DerivationSetValue::fromEnum(DerivationControlEnum::Extension),
+ block: BlockSetValue::fromString('#all'),
+ annotation: null,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ // Attribute
+ $simpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $attribute = new TopLevelAttribute(
+ NCNameValue::fromString('number'),
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ StringValue::fromString('1'),
+ StringValue::fromString('1'),
+ $simpleType,
+ null,
+ IDValue::fromString('phpunit_attribute'),
+ [$attr4],
+ );
+
+ $schema = new Schema(
+ [
+ $annotation1,
+ $import,
+ $annotation2,
+ ],
+ [
+ $topLevelElement,
+ $annotation3,
+ $attribute,
+ ],
+ AnyURIValue::fromString('http://www.w3.org/2001/XMLSchema'),
+ TokenValue::fromString('1.0'),
+ FullDerivationSetValue::fromEnum(DerivationControlEnum::Union),
+ BlockSetValue::fromString('restriction'),
+ FormChoiceValue::fromEnum(FormChoiceEnum::Unqualified),
+ FormChoiceValue::fromEnum(FormChoiceEnum::Unqualified),
+ IDValue::fromString('phpunit_schema'),
+ new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('en')),
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($schema),
+ );
+
+ $this->assertFalse($schema->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SelectorTest.php b/tests/XMLSchema/XML/xs/SelectorTest.php
new file mode 100644
index 00000000..03de3b1f
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SelectorTest.php
@@ -0,0 +1,127 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ $annotation,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($selector),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SequenceTest.php b/tests/XMLSchema/XML/xs/SequenceTest.php
new file mode 100644
index 00000000..52ed8e46
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SequenceTest.php
@@ -0,0 +1,138 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ );
+
+ $sequence = new Sequence(
+ MinOccursValue::fromInteger(0),
+ MaxOccursValue::fromString('unbounded'),
+ [$referencedGroup],
+ $annotation,
+ IDValue::fromString('phpunit_sequence'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($sequence),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SimpleChoiceTest.php b/tests/XMLSchema/XML/xs/SimpleChoiceTest.php
new file mode 100644
index 00000000..55b1db12
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SimpleChoiceTest.php
@@ -0,0 +1,152 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ );
+
+ $choice = new SimpleChoice(
+ [$referencedGroup],
+ $annotation,
+ IDValue::fromString('phpunit_choice'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($choice),
+ );
+ }
+
+
+ /**
+ * Creating an empty Choice element should yield an empty element.
+ */
+ public function testMarshallingEmptyElement(): void
+ {
+ $choice = new SimpleChoice();
+ $this->assertEquals(
+ '',
+ strval($choice),
+ );
+ $this->assertTrue($choice->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SimpleContentTest.php b/tests/XMLSchema/XML/xs/SimpleContentTest.php
new file mode 100644
index 00000000..3fca6d95
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SimpleContentTest.php
@@ -0,0 +1,160 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $simpleExtension = new SimpleExtension(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ null,
+ IDValue::fromString('phpunit_extension'),
+ [$attr4],
+ );
+
+ $simpleContent = new SimpleContent(
+ $simpleExtension,
+ $annotation,
+ IDValue::fromString('phpunit_simpleContent'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($simpleContent),
+ );
+
+ $this->assertFalse($simpleContent->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SimpleExtensionTest.php b/tests/XMLSchema/XML/xs/SimpleExtensionTest.php
new file mode 100644
index 00000000..6c4ea95f
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SimpleExtensionTest.php
@@ -0,0 +1,153 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $simpleExtension = new SimpleExtension(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_extension'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($simpleExtension),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SimpleRestrictionTest.php b/tests/XMLSchema/XML/xs/SimpleRestrictionTest.php
new file mode 100644
index 00000000..4f89c4be
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SimpleRestrictionTest.php
@@ -0,0 +1,277 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $facets = [
+ new MaxExclusive(
+ StringValue::fromString('1024'),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_maxexclusive'),
+ [$attr4],
+ ),
+ new MaxInclusive(
+ StringValue::fromString('1024'),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_maxinclusive'),
+ [$attr4],
+ ),
+ new MinExclusive(
+ StringValue::fromString('128'),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_minexclusive'),
+ [$attr4],
+ ),
+ new MinInclusive(
+ StringValue::fromString('128'),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_mininclusive'),
+ [$attr4],
+ ),
+ new TotalDigits(
+ PositiveIntegerValue::fromInteger(2),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_totalDigits'),
+ [$attr4],
+ ),
+ new FractionDigits(
+ NonNegativeIntegerValue::fromInteger(2),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_fractionDigits'),
+ [$attr4],
+ ),
+ new Length(
+ NonNegativeIntegerValue::fromInteger(512),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_length'),
+ [$attr4],
+ ),
+ new MaxLength(
+ NonNegativeIntegerValue::fromInteger(1024),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_maxlength'),
+ [$attr4],
+ ),
+ new MinLength(
+ NonNegativeIntegerValue::fromInteger(128),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_minlength'),
+ [$attr4],
+ ),
+ new Enumeration(
+ StringValue::fromString('dummy'),
+ null,
+ IDValue::fromString('phpunit_enumeration'),
+ [$attr4],
+ ),
+ new WhiteSpace(
+ WhiteSpaceValue::fromEnum(WhiteSpaceEnum::Collapse),
+ BooleanValue::fromBoolean(true),
+ null,
+ IDValue::fromString('phpunit_whitespace'),
+ [$attr4],
+ ),
+ new Pattern(
+ StringValue::fromString('[A-Za-z0-9]'),
+ null,
+ IDValue::fromString('phpunit_pattern'),
+ [$attr4],
+ ),
+ ];
+
+ $simpleRestriction = new SimpleRestriction(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ $localSimpleType,
+ $facets,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_restriction'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($simpleRestriction),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/SimpleSequenceTest.php b/tests/XMLSchema/XML/xs/SimpleSequenceTest.php
new file mode 100644
index 00000000..1129ffa0
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/SimpleSequenceTest.php
@@ -0,0 +1,138 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ );
+
+ $sequence = new SimpleSequence(
+ [$referencedGroup],
+ $annotation,
+ IDValue::fromString('phpunit_sequence'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($sequence),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/TopLevelAttributeTest.php b/tests/XMLSchema/XML/xs/TopLevelAttributeTest.php
new file mode 100644
index 00000000..453cb263
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/TopLevelAttributeTest.php
@@ -0,0 +1,150 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $simpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $attribute = new TopLevelAttribute(
+ NCNameValue::fromString('number'),
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ StringValue::fromString('1'),
+ StringValue::fromString('1'),
+ $simpleType,
+ $annotation,
+ IDValue::fromString('phpunit_attribute'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($attribute),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/TopLevelComplexTypeTest.php b/tests/XMLSchema/XML/xs/TopLevelComplexTypeTest.php
new file mode 100644
index 00000000..b206bfe2
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/TopLevelComplexTypeTest.php
@@ -0,0 +1,180 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $anyAttribute = new AnyAttribute(
+ NamespaceListValue::fromEnum(NamespaceEnum::Any),
+ ProcessContentsValue::fromEnum(ProcessContentsEnum::Strict),
+ null,
+ IDValue::fromString('phpunit_anyattribute'),
+ );
+
+ $referencedGroup = new ReferencedGroup(
+ QNameValue::fromString("{http://www.w3.org/2001/XMLSchema}xs:nestedParticle"),
+ null,
+ IDValue::fromString('phpunit_group'),
+ [$attr4],
+ );
+
+ $topLevelComplexType = new TopLevelComplexType(
+ NCNameValue::fromString('complex'),
+ BooleanValue::fromBoolean(true),
+ BooleanValue::fromBoolean(false),
+ DerivationSetValue::fromEnum(DerivationControlEnum::Restriction),
+ DerivationSetValue::fromString('#all'),
+ null, // content
+ $referencedGroup,
+ [
+ new LocalAttribute(
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ name: NCNameValue::fromString('phpunit'),
+ ),
+ new ReferencedAttributeGroup(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:defRef'),
+ ),
+ ],
+ $anyAttribute,
+ $annotation,
+ IDValue::fromString('phpunit_complexType'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($topLevelComplexType),
+ );
+
+ $this->assertFalse($topLevelComplexType->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/TopLevelElementTest.php b/tests/XMLSchema/XML/xs/TopLevelElementTest.php
new file mode 100644
index 00000000..412df49e
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/TopLevelElementTest.php
@@ -0,0 +1,184 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ null,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ null,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ null,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $keyref = new Keyref(
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ NCNameValue::fromString('phpunit_keyref'),
+ $selector,
+ [$field],
+ null,
+ IDValue::fromString('phpunit_keyref'),
+ [$attr3],
+ );
+
+ $topLevelElement = new TopLevelElement(
+ name: NCNameValue::fromString('phpunit'),
+ localType: $localSimpleType,
+ identityConstraint: [$keyref],
+ type: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:group'),
+ substitutionGroup: QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:typeDefParticle'),
+ fixed: StringValue::fromString('1'),
+ final: DerivationSetValue::fromEnum(DerivationControlEnum::Extension),
+ block: BlockSetValue::fromString('#all'),
+ annotation: $annotation,
+ id: IDValue::fromString('phpunit_localElement'),
+ namespacedAttributes: [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($topLevelElement),
+ );
+
+ $this->assertFalse($topLevelElement->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/TopLevelSimpleTypeTest.php b/tests/XMLSchema/XML/xs/TopLevelSimpleTypeTest.php
new file mode 100644
index 00000000..053c06f1
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/TopLevelSimpleTypeTest.php
@@ -0,0 +1,154 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $restriction = new Restriction(
+ null,
+ [],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:nonNegativeInteger'),
+ );
+
+ $localSimpleType = new LocalSimpleType(
+ $restriction,
+ );
+
+ $xsList = new XsList(
+ $localSimpleType,
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ );
+
+ $topLevelSimpleType = new TopLevelSimpleType(
+ $xsList,
+ NCNameValue::fromString('phpunit'),
+ SimpleDerivationSetValue::fromString('#all'),
+ $annotation,
+ IDValue::fromString('phpunit_simpleType'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($topLevelSimpleType),
+ );
+
+ $this->assertFalse($topLevelSimpleType->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/TotalDigitsTest.php b/tests/XMLSchema/XML/xs/TotalDigitsTest.php
new file mode 100644
index 00000000..97091652
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/TotalDigitsTest.php
@@ -0,0 +1,132 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $totalDigits = new TotalDigits(
+ PositiveIntegerValue::fromInteger(2),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_totalDigits'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($totalDigits),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/UnionTest.php b/tests/XMLSchema/XML/xs/UnionTest.php
new file mode 100644
index 00000000..90e99ac2
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/UnionTest.php
@@ -0,0 +1,161 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $simpleType1 = new LocalSimpleType(
+ new Restriction(
+ null,
+ [
+ new Enumeration(
+ StringValue::fromString('#all'),
+ ),
+ ],
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:token'),
+ ),
+ );
+
+ $simpleType2 = new LocalSimpleType(
+ new XsList(
+ null,
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:typeDerivationControl'),
+ ),
+ );
+
+ $union = new Union(
+ [$simpleType1, $simpleType2],
+ [
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:integer'),
+ QNameValue::fromString('{http://www.w3.org/2001/XMLSchema}xs:string'),
+ ],
+ $annotation,
+ IDValue::fromString('phpunit_union'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($union),
+ );
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/UniqueTest.php b/tests/XMLSchema/XML/xs/UniqueTest.php
new file mode 100644
index 00000000..3139bd98
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/UniqueTest.php
@@ -0,0 +1,162 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $langattr = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $langattr,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation1 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation1'),
+ [$attr3],
+ );
+ $annotation2 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation2'),
+ [$attr3],
+ );
+ $annotation3 = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation3'),
+ [$attr3],
+ );
+
+ $selector = new Selector(
+ StringValue::fromString('.//annotation'),
+ $annotation2,
+ IDValue::fromString('phpunit_selector'),
+ [$attr4],
+ );
+
+ $field = new Field(
+ StringValue::fromString('@id'),
+ $annotation3,
+ IDValue::fromString('phpunit_field'),
+ [$attr4],
+ );
+
+ $unique = new Unique(
+ NCNameValue::fromString('phpunit_unique'),
+ $selector,
+ [$field],
+ $annotation1,
+ IDValue::fromString('phpunit'),
+ [$attr3],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($unique),
+ );
+
+ $this->assertFalse($unique->isEmptyElement());
+ }
+}
diff --git a/tests/XMLSchema/XML/xs/WhiteSpaceTest.php b/tests/XMLSchema/XML/xs/WhiteSpaceTest.php
new file mode 100644
index 00000000..e6439db8
--- /dev/null
+++ b/tests/XMLSchema/XML/xs/WhiteSpaceTest.php
@@ -0,0 +1,132 @@
+appendChild($text);
+
+ $otherAppinfoDocument = DOMDocumentFactory::create();
+ $otherText = new DOMText('Other Application Information');
+ $otherAppinfoDocument->appendChild($otherText);
+
+ $documentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Some Documentation');
+ $documentationDocument->appendChild($text);
+
+ $otherDocumentationDocument = DOMDocumentFactory::create();
+ $text = new DOMText('Other Documentation');
+ $otherDocumentationDocument->appendChild($text);
+
+ $attr1 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('value1'));
+ $attr2 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr2', StringValue::fromString('value2'));
+ $attr3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr3', StringValue::fromString('value3'));
+ $attr4 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr4', StringValue::fromString('value4'));
+ $attrlang = new XMLAttribute(C::NS_XML, 'xml', 'lang', StringValue::fromString('nl'));
+
+ $appinfo1 = new Appinfo(
+ $appinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $appinfo2 = new Appinfo(
+ $otherAppinfoDocument->childNodes,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $documentation1 = new Documentation(
+ $documentationDocument->childNodes,
+ $attrlang,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr1],
+ );
+ $documentation2 = new Documentation(
+ $otherDocumentationDocument->childNodes,
+ $attrlang,
+ AnyURIValue::fromString('urn:x-simplesamlphp:source'),
+ [$attr2],
+ );
+
+ $annotation = new Annotation(
+ [$appinfo1, $appinfo2],
+ [$documentation1, $documentation2],
+ IDValue::fromString('phpunit_annotation'),
+ [$attr3],
+ );
+
+ $whiteSpace = new WhiteSpace(
+ WhiteSpaceValue::fromEnum(WhiteSpaceEnum::Collapse),
+ BooleanValue::fromBoolean(true),
+ $annotation,
+ IDValue::fromString('phpunit_whitespace'),
+ [$attr4],
+ );
+
+ $this->assertEquals(
+ self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
+ strval($whiteSpace),
+ );
+ }
+}
diff --git a/tests/resources/xml/xs/all.xml b/tests/resources/xml/xs/all.xml
new file mode 100644
index 00000000..b18207b6
--- /dev/null
+++ b/tests/resources/xml/xs/all.xml
@@ -0,0 +1,14 @@
+
+
+ SimpleType
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/annotation.xml b/tests/resources/xml/xs/annotation.xml
new file mode 100644
index 00000000..1a9b5e42
--- /dev/null
+++ b/tests/resources/xml/xs/annotation.xml
@@ -0,0 +1,6 @@
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
diff --git a/tests/resources/xml/xs/any.xml b/tests/resources/xml/xs/any.xml
new file mode 100644
index 00000000..d017257b
--- /dev/null
+++ b/tests/resources/xml/xs/any.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/anyAttribute.xml b/tests/resources/xml/xs/anyAttribute.xml
new file mode 100644
index 00000000..5ef30f63
--- /dev/null
+++ b/tests/resources/xml/xs/anyAttribute.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/appinfo.xml b/tests/resources/xml/xs/appinfo.xml
new file mode 100644
index 00000000..cfd03c56
--- /dev/null
+++ b/tests/resources/xml/xs/appinfo.xml
@@ -0,0 +1 @@
+Application Information
diff --git a/tests/resources/xml/xs/choice.xml b/tests/resources/xml/xs/choice.xml
new file mode 100644
index 00000000..9cb3a7cf
--- /dev/null
+++ b/tests/resources/xml/xs/choice.xml
@@ -0,0 +1,9 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/complexContent.xml b/tests/resources/xml/xs/complexContent.xml
new file mode 100644
index 00000000..f188786c
--- /dev/null
+++ b/tests/resources/xml/xs/complexContent.xml
@@ -0,0 +1,14 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/complexRestriction.xml b/tests/resources/xml/xs/complexRestriction.xml
new file mode 100644
index 00000000..99ebc286
--- /dev/null
+++ b/tests/resources/xml/xs/complexRestriction.xml
@@ -0,0 +1,12 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/documentation.xml b/tests/resources/xml/xs/documentation.xml
new file mode 100644
index 00000000..7a7dd2ae
--- /dev/null
+++ b/tests/resources/xml/xs/documentation.xml
@@ -0,0 +1 @@
+Some Documentation
diff --git a/tests/resources/xml/xs/enumeration.xml b/tests/resources/xml/xs/enumeration.xml
new file mode 100644
index 00000000..ef63756a
--- /dev/null
+++ b/tests/resources/xml/xs/enumeration.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/extension.xml b/tests/resources/xml/xs/extension.xml
new file mode 100644
index 00000000..28d6dad2
--- /dev/null
+++ b/tests/resources/xml/xs/extension.xml
@@ -0,0 +1,12 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/field.xml b/tests/resources/xml/xs/field.xml
new file mode 100644
index 00000000..4bd66280
--- /dev/null
+++ b/tests/resources/xml/xs/field.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/fractionDigits.xml b/tests/resources/xml/xs/fractionDigits.xml
new file mode 100644
index 00000000..dc41ecbf
--- /dev/null
+++ b/tests/resources/xml/xs/fractionDigits.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/import.xml b/tests/resources/xml/xs/import.xml
new file mode 100644
index 00000000..27905aa8
--- /dev/null
+++ b/tests/resources/xml/xs/import.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/include.xml b/tests/resources/xml/xs/include.xml
new file mode 100644
index 00000000..f8fec19a
--- /dev/null
+++ b/tests/resources/xml/xs/include.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/key.xml b/tests/resources/xml/xs/key.xml
new file mode 100644
index 00000000..8d2d8811
--- /dev/null
+++ b/tests/resources/xml/xs/key.xml
@@ -0,0 +1,24 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/keyref.xml b/tests/resources/xml/xs/keyref.xml
new file mode 100644
index 00000000..17c0c4a5
--- /dev/null
+++ b/tests/resources/xml/xs/keyref.xml
@@ -0,0 +1,24 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/length.xml b/tests/resources/xml/xs/length.xml
new file mode 100644
index 00000000..801a0aa8
--- /dev/null
+++ b/tests/resources/xml/xs/length.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/list.xml b/tests/resources/xml/xs/list.xml
new file mode 100644
index 00000000..17997fb5
--- /dev/null
+++ b/tests/resources/xml/xs/list.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/localAttribute.xml b/tests/resources/xml/xs/localAttribute.xml
new file mode 100644
index 00000000..42b8cc4b
--- /dev/null
+++ b/tests/resources/xml/xs/localAttribute.xml
@@ -0,0 +1,11 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
diff --git a/tests/resources/xml/xs/localComplexType.xml b/tests/resources/xml/xs/localComplexType.xml
new file mode 100644
index 00000000..7ce7c0b2
--- /dev/null
+++ b/tests/resources/xml/xs/localComplexType.xml
@@ -0,0 +1,12 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/localElement.xml b/tests/resources/xml/xs/localElement.xml
new file mode 100644
index 00000000..87bb92aa
--- /dev/null
+++ b/tests/resources/xml/xs/localElement.xml
@@ -0,0 +1,15 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/localSimpleType.xml b/tests/resources/xml/xs/localSimpleType.xml
new file mode 100644
index 00000000..976bef3d
--- /dev/null
+++ b/tests/resources/xml/xs/localSimpleType.xml
@@ -0,0 +1,9 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/maxExclusive.xml b/tests/resources/xml/xs/maxExclusive.xml
new file mode 100644
index 00000000..5440459c
--- /dev/null
+++ b/tests/resources/xml/xs/maxExclusive.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/maxInclusive.xml b/tests/resources/xml/xs/maxInclusive.xml
new file mode 100644
index 00000000..96bd2af7
--- /dev/null
+++ b/tests/resources/xml/xs/maxInclusive.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/maxLength.xml b/tests/resources/xml/xs/maxLength.xml
new file mode 100644
index 00000000..f96b30d3
--- /dev/null
+++ b/tests/resources/xml/xs/maxLength.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/minExclusive.xml b/tests/resources/xml/xs/minExclusive.xml
new file mode 100644
index 00000000..13e19809
--- /dev/null
+++ b/tests/resources/xml/xs/minExclusive.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/minInclusive.xml b/tests/resources/xml/xs/minInclusive.xml
new file mode 100644
index 00000000..2b81af39
--- /dev/null
+++ b/tests/resources/xml/xs/minInclusive.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/minLength.xml b/tests/resources/xml/xs/minLength.xml
new file mode 100644
index 00000000..5cd6f7e7
--- /dev/null
+++ b/tests/resources/xml/xs/minLength.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/namedAttributeGroup.xml b/tests/resources/xml/xs/namedAttributeGroup.xml
new file mode 100644
index 00000000..f65bd7da
--- /dev/null
+++ b/tests/resources/xml/xs/namedAttributeGroup.xml
@@ -0,0 +1,11 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
diff --git a/tests/resources/xml/xs/namedGroup.xml b/tests/resources/xml/xs/namedGroup.xml
new file mode 100644
index 00000000..8efff816
--- /dev/null
+++ b/tests/resources/xml/xs/namedGroup.xml
@@ -0,0 +1,25 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/narrowMaxMinElement.xml b/tests/resources/xml/xs/narrowMaxMinElement.xml
new file mode 100644
index 00000000..ae893437
--- /dev/null
+++ b/tests/resources/xml/xs/narrowMaxMinElement.xml
@@ -0,0 +1,15 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/notation.xml b/tests/resources/xml/xs/notation.xml
new file mode 100644
index 00000000..f951127c
--- /dev/null
+++ b/tests/resources/xml/xs/notation.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/pattern.xml b/tests/resources/xml/xs/pattern.xml
new file mode 100644
index 00000000..b7dc2c68
--- /dev/null
+++ b/tests/resources/xml/xs/pattern.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/redefine.xml b/tests/resources/xml/xs/redefine.xml
new file mode 100644
index 00000000..1e60ec40
--- /dev/null
+++ b/tests/resources/xml/xs/redefine.xml
@@ -0,0 +1,45 @@
+
+
+ SimpleType
+
+
+
+
+
+
+
+
+
+ ComplexType
+
+
+
+
+
+
+
+
+ Group
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AttributeGroup
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/referencedAttributeGroup.xml b/tests/resources/xml/xs/referencedAttributeGroup.xml
new file mode 100644
index 00000000..4035ab1a
--- /dev/null
+++ b/tests/resources/xml/xs/referencedAttributeGroup.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/referencedGroup.xml b/tests/resources/xml/xs/referencedGroup.xml
new file mode 100644
index 00000000..e730dc8d
--- /dev/null
+++ b/tests/resources/xml/xs/referencedGroup.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/restriction.xml b/tests/resources/xml/xs/restriction.xml
new file mode 100644
index 00000000..b2913c51
--- /dev/null
+++ b/tests/resources/xml/xs/restriction.xml
@@ -0,0 +1,10 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
diff --git a/tests/resources/xml/xs/schema.xml b/tests/resources/xml/xs/schema.xml
new file mode 100644
index 00000000..b05d1903
--- /dev/null
+++ b/tests/resources/xml/xs/schema.xml
@@ -0,0 +1,26 @@
+
+
+ Import
+
+
+
+ Element
+
+
+
+
+
+
+
+
+
+
+
+ Attribute
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/selector.xml b/tests/resources/xml/xs/selector.xml
new file mode 100644
index 00000000..431724d6
--- /dev/null
+++ b/tests/resources/xml/xs/selector.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/sequence.xml b/tests/resources/xml/xs/sequence.xml
new file mode 100644
index 00000000..19749e23
--- /dev/null
+++ b/tests/resources/xml/xs/sequence.xml
@@ -0,0 +1,9 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/simpleChoice.xml b/tests/resources/xml/xs/simpleChoice.xml
new file mode 100644
index 00000000..123a7980
--- /dev/null
+++ b/tests/resources/xml/xs/simpleChoice.xml
@@ -0,0 +1,9 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/simpleContent.xml b/tests/resources/xml/xs/simpleContent.xml
new file mode 100644
index 00000000..b28ceed3
--- /dev/null
+++ b/tests/resources/xml/xs/simpleContent.xml
@@ -0,0 +1,13 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/simpleExtension.xml b/tests/resources/xml/xs/simpleExtension.xml
new file mode 100644
index 00000000..ed831bf6
--- /dev/null
+++ b/tests/resources/xml/xs/simpleExtension.xml
@@ -0,0 +1,11 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
diff --git a/tests/resources/xml/xs/simpleRestriction.xml b/tests/resources/xml/xs/simpleRestriction.xml
new file mode 100644
index 00000000..bbe5ef46
--- /dev/null
+++ b/tests/resources/xml/xs/simpleRestriction.xml
@@ -0,0 +1,26 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/simpleSequence.xml b/tests/resources/xml/xs/simpleSequence.xml
new file mode 100644
index 00000000..184c9b91
--- /dev/null
+++ b/tests/resources/xml/xs/simpleSequence.xml
@@ -0,0 +1,9 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/topLevelAttribute.xml b/tests/resources/xml/xs/topLevelAttribute.xml
new file mode 100644
index 00000000..2eaee90a
--- /dev/null
+++ b/tests/resources/xml/xs/topLevelAttribute.xml
@@ -0,0 +1,11 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
diff --git a/tests/resources/xml/xs/topLevelComplexType.xml b/tests/resources/xml/xs/topLevelComplexType.xml
new file mode 100644
index 00000000..437e2d36
--- /dev/null
+++ b/tests/resources/xml/xs/topLevelComplexType.xml
@@ -0,0 +1,12 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/topLevelElement.xml b/tests/resources/xml/xs/topLevelElement.xml
new file mode 100644
index 00000000..856d0771
--- /dev/null
+++ b/tests/resources/xml/xs/topLevelElement.xml
@@ -0,0 +1,15 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/topLevelSimpleType.xml b/tests/resources/xml/xs/topLevelSimpleType.xml
new file mode 100644
index 00000000..c749c133
--- /dev/null
+++ b/tests/resources/xml/xs/topLevelSimpleType.xml
@@ -0,0 +1,13 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/totalDigits.xml b/tests/resources/xml/xs/totalDigits.xml
new file mode 100644
index 00000000..6531362b
--- /dev/null
+++ b/tests/resources/xml/xs/totalDigits.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
diff --git a/tests/resources/xml/xs/union.xml b/tests/resources/xml/xs/union.xml
new file mode 100644
index 00000000..398b8836
--- /dev/null
+++ b/tests/resources/xml/xs/union.xml
@@ -0,0 +1,16 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/resources/xml/xs/unique.xml b/tests/resources/xml/xs/unique.xml
new file mode 100644
index 00000000..a80287d2
--- /dev/null
+++ b/tests/resources/xml/xs/unique.xml
@@ -0,0 +1,24 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+
+
diff --git a/tests/resources/xml/xs/whiteSpace.xml b/tests/resources/xml/xs/whiteSpace.xml
new file mode 100644
index 00000000..e7fdfa10
--- /dev/null
+++ b/tests/resources/xml/xs/whiteSpace.xml
@@ -0,0 +1,8 @@
+
+
+ Application Information
+ Other Application Information
+ Some Documentation
+ Other Documentation
+
+