Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "COSMOS SML Test Plan"

(Introduction)
Line 9: Line 9:
 
The goal of this test plan is to document the test coverage for the SML and SML-IF validator found in the Eclipse COSMOS project.  Using this document, we will describe the test suite used to achieve compliance with the SML and SML-IF 1.1 specifications.
 
The goal of this test plan is to document the test coverage for the SML and SML-IF validator found in the Eclipse COSMOS project.  Using this document, we will describe the test suite used to achieve compliance with the SML and SML-IF 1.1 specifications.
  
The source for these tests can be found in the <code>org.eclipse.cosmos.rm.validation.tests</code> plug-in in CVS.
+
The source for these tests can be found in the [http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cosmos/tests/resource-modeling/org.eclipse.cosmos.rm.validation.tests/?root=Technology_Project <code>org.eclipse.cosmos.rm.validation.tests</code> plug-in in CVS].
  
 
== Test Suite ==
 
== Test Suite ==

Revision as of 12:54, 13 June 2008

COSMOS SML and SML-IF Validator Test Plan

Version 1.1, 13 June 2008

Author: David Whiteman

Introduction

The goal of this test plan is to document the test coverage for the SML and SML-IF validator found in the Eclipse COSMOS project. Using this document, we will describe the test suite used to achieve compliance with the SML and SML-IF 1.1 specifications.

The source for these tests can be found in the org.eclipse.cosmos.rm.validation.tests plug-in in CVS.

Test Suite

Acyclic Tests

Tests that check for valid cycles using sml:acyclic

Test Name File Description
InvalidCyclesWithAcyclicReferences acyclic\InValidCycles.xml (src) This test verifies that it is an error to create cycles with instances of acyclic references
InvalidDerivationWithAcyclicAttribute acyclic\InValidDerivation.xml (src) A model is invalid if it has a reference type R1 with sml:acyclic=?true? and another reference type R2 derived from R1 such that sml:acyclic=?false?
ValidateAcyclicDefinition acyclic\ValidateDefinition.xml (src) This test returns a warning if the sml:acyclic attribute is defined on an element declaration
ValidCyclesWithAcyclicReference1 acyclic\ValidCycles1.xml (src) Let R1 and R2 be two reference types with sml:acyclic=?true?. Then a model is valid if it has inter-document cycles that using instances of both R1 and R2
ValidCyclesWithAcyclicReference2 acyclic\ValidCycles2.xml (src) Let R1 be a reference type with sml:acyclic=?false?. Then a model is valid if it has inter-document cycles using instances of R1
ValidCycles3 acyclic\ValidCycles3.xml (src) This test verifies that it is valid to create cycles within documents, as long as instances of acyclic references do not create cycles.
ValidDerivationWithAcyclicAttribute acyclic\ValidDerivation.xml (src) A model is valid if it has a reference type R1 with sml:acyclic=?false? and another reference type R2 derived from R1 such that sml:acyclic=?true?

Deref Tests

Tests that ensure proper operation of the deref() function

Test Name File Description
MultipleDeref deref\Multiple.xml (src) Verify that deref() can accept a node set of reference elements, i.e., elements for which sml:ref=?true?, and return a node set that is union of the element nodes targeted by references in the node set such that the reference targets exactly one element in the model. The returned node set must not contain any nodes for references that do not target an element in the model.
MultipleXpointer deref\MultipleNonRoot.xml (src) Verify that deref() can resolve references that target non-root elements using XPointer scheme.
SingleRef deref\Single.xml (src) Verify that deref() can resolve a single reference. The deref() function must return a single node (i.e. a node set with a single node) that corresponds to the element node of the reference’s target when the reference targets a single element in the model.

Identity Tests

Tests that validate the resolution of key references to elements

Test Name File Description
InValidKeyDuplicate identity\InValidKeyDuplicate.xml (src) Verify that a model with a key constraint is invalid if the field values are not unique.
InValidKeyMissing identity\InValidKeyMissing.xml (src) Verify that a model with a key constraint is invalid if some field values are missing.
InValidUnique identity\InValidUnique.xml (src) Verify that a model with a unique constraint is invalid if the field values are not unique.
InvalidConstraintDefinition identity\sml1.1\InValidConstraintDefinition.xml (src) This test returns a warning when the id constraints are defined on a complexType. They should be defined on an element declaration.
InvalidConstraintRefAttributes identity\sml1.1\InValidConstraintRefAttributes.xml (src) Verifies that the code returns an error when the name attribute is specified on a constraint with the ref attribute specified. Ref attribute I am referring to here is the one defined on the keybase type. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: 1.The name attribute MUST NOT be specified.
InvalidConstraintRefElements identity\sml1.1\InValidConstraintRefElements.xml (src) Verifies that the code returns an error when the sml:field and sml:selector child elements are defined on a constraint with the ref attribute specified. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: 2.The sml:selector and sml:field child elements MUST NOT be specified.
InvalidConstraintRefKey identity\sml1.1\InValidConstraintRefKey.xml (src) Verifies that the code returns an error when the key's ref attribute value resolves to an element which is not a key.
InvalidConstraintRefKeyref identity\sml1.1\InValidConstraintRefKeyref.xml (src) Verifies that the code returns an error when the keyref's ref attribute value resolves to a key element instead of a keyref element. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: If element is sml:keyref, then the value of the ref attribute MUST resolve to an SML keyref constraint [..]
InvalidConstraintRefNoKey identity\sml1.1\InValidConstraintRefNoKey.xml (src) Verifies that the code returns an error when the key's ref attribute value doesn't resolve to an SML key constraint. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: If the element is sml:key, then the value of ref attribute MUST resolve to an SML key constraint.
InvalidConstraintRefNoKeyRef identity\sml1.1\InValidConstraintRefNoKeyref.xml (src) Verifies that the code returns an error when the keyref's ref attribute value doesn't resolve to an SML keyref constraint. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: If element is sml:keyref, then the value of the ref attribute MUST resolve to an SML keyref constraint, and the refer attribute MUST NOT be specified.
InvalidConstraintRefNoKeyUnique identity\sml1.1\InValidConstraintRefNoUnique.xml (src) Verifies that the code returns an error when the unique's ref attribute value doesn't resolve to an SML unique constraint. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: If the element is sml:unique, then the value of the ref attribute MUST resolve to an SML unique constraint.
InvalidConstraintRefUnique identity\sml1.1\InValidConstraintRefUnique.xml (src) Verifies that the code returns an error when the unique's ref attribute value resolves to an element that is not of type sml:unique.
InvalidConstraintSubstitution identity\sml1.1\InValidConstraintSubstitution.xml (src) This test verifies that substitution group elements validate id constraints defined on their group affiliation. If an element declaration S has a {substitution group affiliation} G, then its {SML identity-constraints definitions} also contains members of {SML identity-constraints definitions} of G.
InvalidDuplicateConstraintName identity\sml1.1\InValidDuplicateConstraintName.xml (src) This test verifies that the code returns a error when two constraints defined on an element have the same name ( Constraints should have unique names; ie there cannot be an sml:key that has the same name with a sml:key, sml:keyref or sml:unique on the same element declaration).
InvalidDuplicateConstraintName1 identity\sml1.1\InValidDuplicateConstraintName1.xml (src) This test verifies that the code returns a error when two constraints defined on an element have the same name ( Constraints should have unique names; ie there cannot be an sml:key that has the same name with a sml:key, sml:keyref or sml:unique on the same element declaration). The {SML identity-constraints definitions} of an element declaration MUST NOT contain two identity constraints with the same name.
InvalidDuplicateConstraintSubst identity\sml1.1\InValidDuplicateConstraintNameSubst.xml (src) This test verifies that the code returns a error when two constraints defined on an element have the same name ( Constraints should have unique names; ie there cannot be an sml:key that has the same name with a sml:key, sml:keyref or sml:unique on the same element declaration). If a global element declaration S has a {substitution group affiliation} G, then {SML identity-constraints definitions} of S MUST be a superset of that of G.
ValidConstraintRefKeyref identity\sml1.1\ValidConstraintRefKeyref.xml (src) Verifies that the code returns success when the keyref's ref attribute value resolves to a keyref element. For each sml:key, sml:unique, or sml:keyref element with the ref attribute specified, {SML identity-constraints definitions} contains the component resolved to by the actual value of the ref attribute, with the following conditions: If element is sml:keyref, then the value of the ref attribute MUST resolve to an SML keyref constraint [..]
ValidKeyref identity\ValidKeyref.xml (src) Verify keyref constraint.
ValidKeyUnique identity\ValidKeyUnique.xml (src) Verify that a model with a key and unique constraint is valid if the field values are unique, though some field values for the unique constraint may be missing.
ValidKeyUniqueInScopeOnly identity\ValidKeyUniqueInScopeOnly.xml (src) Verify that a model with a key and unique constraint is valid if the constraints are satisfied in scope even though the constraints may not be satisfied globally in the model.

Model Completeness Tests

Tests that check for the completeness of the model

Test Name File Description
InValidInCompleteModel incomplete\InValid.xml (src) This test verifies that an incomplete model is invalid

Miscellaneous Tests

Tests that check miscellaneous issues to ensure valid SML documents

Test Name File Description
InValidAliasValue others\InValidAliasValue.xml (src) This test verifies that the code returns an error when an alias contains an invalid value.
InValidAliasHasFragmentComp others\InValidAliasWithFragment.xml (src) This test verifies that the code returns an error when an alias contains a fragment component.
InvalidBase64Content others\InValidBase64Content.xml (src) This test verifies that the code returns an error when a document that is a child of the base64Data element is not encoded in Base64 format.
InvalidDataContentBase64 others\InValidDataContentBase64.xml (src) This test verifies that the code returns an error when a document that is a child of the data element is encoded in base64 format.
InValidDuplicateAliases others\InValidDuplicateAliases.xml (src) This test verifies that the code returns an error when two aliases resolve to the same URI
InvalidMultipleDocument others\InValidMultipleDocument.xml (src) This test verifies that the code returns an error if the data element contains more than one document.
TestDocumentLocator others\remote-document.xml (src) Tests the correct implementation of the locator element
TestRulesWithMultiplePatterns others\rulesWithMultiplePattern.xml (src) Tests that rules that have multiple patterns are handled correctly
TestMultipleRulesUnderOnePattern others\rulesWithMultipleRulesUnderOnePattern.xml (src) Tests that patterns with multiple rules are handled correctly
ValidateSchemaBinding others\SchemaBindingWarning.xml (src) Used to ensure that a warning is displayed when a schema binding element is used in an SML-IF document
TestSchemaValidationFailure others\schemaValidationFailure.xml (src) Tests that validation against the schema fails.
ValidBase64Content others\ValidBase64Content.xml (src) This test verifies that the code returns success when a document that is a child of the base64Data element is encoded in Base64 format.
ValidateDefaultSchemaBinding others\ValidDefaultSchemaBinding.xml (src) This test verifies that the code is using the defaultSchema information to locate the definition file for instance documents not included in schemaBinding. In this sample, the Course1 and Course2 instances should be validated against the University.xsd schema. Course3 will be validated against the Univerity_v1.xsd schema since Course3 is not included in any schemaBinding element.
ValidEmptyDocument others\ValidEmptyDocument.xml (src) This test verifies that it is valid to have an empty document.
ValidateNoSchemaBinding others\ValidNoSchemaBinding.xml (src) If a namespace ns is not included in any schemaBinding or defaultSchema element, then the schema defining this namespace is built by composing all definition documents whose target namespace matches ns. This resulted schema will be used to validate any instance document using ns namespace. The test should return an error on acyclic
ValidateSchemaBinding others\ValidSchemaBinding.xml (src) This test verifies that the code is using the schemaBinding information to locate the definition file for instance documents. In this sample, there are two xsd files with the same namespace, tns. The instance documents are bound to the first xsd definition, University.xsd using the schemaBinding element. As a result, the validation should be run using the schema defined in University.xsd and ignore University_v1.xsd. The validation returns success since Univesity.xsd does not have the acyclic attribute specified on the OptionalCourseRefType type. If the schemaBinding is ignored, then the validator should return error ( the schema file used to validate the instances will be composed from both xsd files; the first definition of the OptionalCourseRefType type in the University.xsd will be overwritten by the OptionalCourseRefType - acyclic = true in the University_v1.xsd )

Reference Tests

Tests that validate the implementation of sml:ref

Test Name File Description
InvalidRefOneSchemeResolves references\ConsistentReferences\InvalidRefOneSchemeResolves.xml (src) An SML model MUST be declared invalid when a recognized scheme resolves to a target that's different from the target resolved to by another recognized scheme or when one recognized scheme resolves and another does not. This test verifies that the code returns an error when an SML references contains two reference scheme, resolving to two different elements.
InvalidRefResolvesToMultipleElements references\ConsistentReferences\InvalidRefResolvesToMultipleElements.xml (src) Every non-null reference MUST target at most one element in a model. When a recognized scheme in a reference resolves to more than one target then the model MUST be declared invalid. This test verifies that the code returns an error when an SML references contains a reference scheme that resolves to more than one element.
InvalidRefTwoSchemes references\ConsistentReferences\InvalidRefTwoSchemes.xml (src) An SML model MUST be declared invalid when a recognized scheme resolves to a target that's different from the target resolved to by another recognized scheme or when one recognized scheme resolves and another does not. This test verifies that the code returns an error when an SML references contains two reference scheme, and one scheme resolves while the other doesn't.
ValidRefNilrefSpecified1 references\ConsistentReferences\ValidRefNilrefSpecified1.xml (src) A null reference is an explicit declaration of intent by the document author that the reference itself does not exist, and a processing directive (not a hint) to processors not to attempt to recognize any reference schemes in it.If a reference element is recognized as null, then processors MUST NOT attempt to resolve it. The question of whether a null reference is resolved or not is undefined; it is an ill-formed question. This test verifies that the validator does not try to resolve a reference that is marked as null. If the reference is to be resolved, the validator will return an exception since the two reference schemes resolve to two different elements. This test should return success because the sml:nilref is specified.
ValidRefOneSchemeResolvesOtherUnknown references\ConsistentReferences\ValidRefOneSchemeResolvesOtherUnknown.xml (src) An SML model MUST be declared invalid when a recognized scheme resolves to a target that's different from the target resolved to by another recognized scheme or when one recognized scheme resolves and another does not. This test verifies that the code returns success when an SML references contains two reference scheme, one resolving to a valid target and the other scheme being unknown to the processor.
ValidRefTwoSchemes references\ConsistentReferences\ValidRefTwoSchemes.xml (src) An SML model MUST be declared invalid when a recognized scheme resolves to a target that's different from the target resolved to by another recognized scheme or when one recognized scheme resolves and another does not. This test verifies that the code returns success when an SML references contains two reference scheme, both resolving to the same target.
ValidRefTwoSchemesNilSpecified references\ConsistentReferences\ValidRefTwoSchemesNilSpecified.xml (src) A null reference is an explicit declaration of intent by the document author that the reference itself does not exist, and a processing directive (not a hint) to processors not to attempt to recognize any reference schemes in it.If a reference element is recognized as null, then processors MUST NOT attempt to resolve it. The question of whether a null reference is resolved or not is undefined; it is an ill-formed question. This test verifies that the validator does not try to resolve a reference that is marked as null. If the reference below is to be resolved, the validator will return an exception since only one reference scheme resolves. This test should return success because the sml:nilref is specified.
ValidRefTwoSchemesReturnsNull references\ConsistentReferences\ValidRefTwoSchemesReturnsNull.xml (src) A null reference is an explicit declaration of intent by the document author that the reference itself does not exist, and a processing directive (not a hint) to processors not to attempt to recognize any reference schemes in it.If a reference element is recognized as null, then processors MUST NOT attempt to resolve it. The question of whether a null reference is resolved or not is undefined; it is an ill-formed question. This test verifies that the validator does not try to resolve a reference that is marked as null. If the reference below is to be resolved, the validator will return a non null target element. This test should return success but with a reference target of null.
DanglingRef references\DanglingRef.xml (src) This test verifies that a valid model can contain dangling references
EmptyRefElement references\EmptyRefElement.xml (src) This test verifies that reference elements can be empty
IntraDocumentRef references\IntraDocumentRef.xml (src) This test verifies that a reference element can target an element in the same document
InValidBaseURI references\InValidBaseURI.xml (src) This test verifies that the code returns an error when the base URI is not an absolute URI
InValidBaseURIHasFragmentComp references\InValidBaseURI2.xml (src) This test verifies that the code returns an error when the base URI contains a fragment component.
InValidMissingBaseURIAttr1 references\InValidMissingBaseURIAttr.xml (src) This test verifies that the code returns an error when there is relative reference in a document and the baseURI is not defined.
MultipleRefToAnElement references\MultipleRefToAnElement.xml (src) This test verifies that an element can be targeted by multiple different references
NullRefElement references\NullRefElement.xml (src) This test verifies that reference elements can be null
InvalidNillRefDefinition references\NullReferences\InvalidNilRefDefinition.xml (src) This test verifies that sml:nilref attribute is only defined on instance elements with sml:ref="true" specified. This global attribute is used to identify null reference elements. This attribute MUST NOT be used on an element unless it also has sml:ref="true" specified.
InvalidNillRefDefinition references\NullReferences\ValidNilRefDefinition.xml (src) This test verifies that sml:nilref attribute can only be defined on instance elements with sml:ref="true" specified. This global attribute is used to identify null reference elements. This attribute MUST NOT be used on an element unless it also has sml:ref="true" specified.
RefToNonRootElement references\RefToNonRootElement.xml (src) This test verifies that a reference element in a document can target non-root elements in some other document
RefToRootElement references\RefToRootElement.xml (src) This test verifies that a reference element in a document can target the root element in some other document
InvalidSchemeDerefUsed references\smlxpath1Scheme\InvalidSchemeDerefUsed.xml (src) This test verifies that the code returns error when an smlxpath1 scheme contains a deref() in the evaluator. The deref() XPath extension function MUST NOT be present in the expression evaluation context function library when processing the location path in SMLXPath1_SchemeData : SMLXPath1_Fragment_ID ::= 'smlxpath1' '(' SMLXPath1_SchemeData ')' SMLXPath1_SchemeData ::= XPath1.0_LocationPath
InvalidSchemeNamespaceUnknown references\smlxpath1Scheme\InvalidSchemeNamespaceUnknown.xml (src) This test verifies that the code returns error when an smlxpath1 scheme uses a namespace not defined in the containing element. Namespace Binding Context: The smlxpath1() scheme inherits the set of namespace bindings available to the containing element.
InvalidSchemeResultContainsNonElements references\smlxpath1Scheme\InvalidSchemeResultContainsNonElements.xml (src) This test verifies that the code returns error when an smlxpath1 scheme resolves to a set containing non-elements. The element(s) targeted by a scheme instance are obtained by applying the location path in SMLXPath1_SchemeData to the root element of the document in the document context. The result MUST be a set of elements. The set MAY be empty. If the result of applying the location path is something other than a set of elements, then the XPointer result is an error.
InvalidSchemeSyntaxError references\smlxpath1Scheme\InvalidSchemeSyntaxError.xml (src) This test verifies that the code returns error when an smlxpath1 location path has an invalid syntax.
ValidSchemeNamespaceInherited references\smlxpath1Scheme\ValidSchemeNamespaceInherited.xml (src) This test verifies that the code returns success when an smlxpath1 scheme uses a namespace defined by the containing element. Namespace Binding Context: The smlxpath1() scheme inherits the set of namespace bindings available to the containing element.
ValidMissingBaseURIAttr1 references\ValidBaseURIAttr1.xml (src) This test verifies that it is valid to not define the baseURI when there is no relative URI defined within any document.
ValidMissingBaseURIAttr2 references\ValidBaseURIAttr2.xml (src) This test verifies that it is valid to have no baseURI, no aliases and a relative reference in a document, if the reference contains only a fragment component. In which case the reference points to an element within the same document.

Rule Tests

Tests that ensure that Schematron rules and rule bindings are correctly handled

Test Name File Description
InValidSchematronRule Rules\InValid.xml (src) A model with a Schematron rule defined for an element is invalid if at least one instances of the element does not satisfy the rule.
InValidRuleBinding-MultipleRulesSameDocument Rules\InValidRuleBinding-MultipleRulesSameDocument-BothFail.xml (src) Two rules are bound to the same document - both fail.
InValidRuleBinding-MultipleRulesSameDocument Rules\InValidRuleBinding-MultipleRulesSameDocument.xml (src) Two rules are bound to the same document. One passes, one fails.
InValidRuleBinding Rules\InValidRuleBinding.xml (src) A model with a Schematron rule that is bound to some instance documents is invalid if the rule is not satisfied by some bound documents.
InValidRuleType Rules\InValidRuleType.xml (src) A model with a Schematron rule defined for a type CT is invalid if at least one instance element of CT type doesn't satisfy the rule.
InValidRuleTypeExtension Rules\InValidRuleTypeExtension.xml (src) A model with a Schematron rule defined for a type CT is invalid if at least one instance element of CT type or a type derived from CT ( derivation by extension ) doesn't satisfy the rule.
InValidRuleTypeRestriction Rules\InValidRuleTypeRestriction.xml (src) A model with a Schematron rule defined for a type CT is invalid if at least one instance element of CT type or a type derived from CT ( derivation by restriction ) doesn't satisfy the rule.
ValidSchematronRule Rules\Valid.xml (src) A model with a Schematron rule defined for an element is valid if all instances of the element satisfy the rule.
ValidXMLSchema Rules\ValidNoSML.xml (src) Basic XML Schema file, no SML extensions used.
ValidRuleBinding Rules\ValidRuleBinding.xml (src) A model with a Schematron rule that is bound to some instance documents is valid if the rule is satisfied by all bound documents.

Target Element Tests

Tests that ensure correct implementation of targetElement

Test Name File Description
InValidTargetElement targetElement\InValid.xml (src) If targetElement=?GTE? for a global element declaration E, then a model is invalid if the target of some instance of E in the model is not an instance of GTE.
InValidDerivationByRestriction targetElement\InValidDerivationByRestriction.xml (src) If the element declaration ED is contained (directly, indirectly, or implicitly) in a content model of a complex type D, who is a restriction of another complex type B and B contains an element declaration EB with the same name as ED, then{target element} of ED is the same as that of EB. In the example below, the EnrolledCourse element contained by the GraduateStudentType should have the same {targetElement} as the EnrolledCourse element contained by the StudentType.
InValidSameNameElements targetElement\InValidSameNameElements.xml (src) If two element declarations E1 and E2 have the same {namespace name} and {name} and they are both contained (directly, indirectly, or implicitly) in a content model of a complex type, then E1 and E2 have the same {target required}, {target element}, and {target type}. In the example below, the two EnrolledCourse elements contained by the StudentType through the graduateGroup and basicGroup should have the same {targetElement}.
ValidateTargetElementExists2 targetElement\InvalidValue.xml (src) This test verifies that the value of the sml:targetElement is a global element. Returns an error if the value does not match any element in the corresponding namespace. The test verifies that the error is displayed even when no model instances are defined for this IF document (ie the validation runs against the xsd file containing the sml:targetElement, regardless of the instances being defined in that model)
InValidTargetElementWithSubstitutionGroup targetElement\InValidWithSubstitutionGroup.xml (src) Let targetElement=?GTE? be specified for a GED E. Let SubE be another GED in the substitution group whose head element is E for which the targetElement attribute is not specified. Then a model is invalid if an instance of SubE targets an element that is not an instance of GTE or an instance of some GED in the substitution group hierarchy whose head is GTE.
ValidTargetElement targetElement\Valid.xml (src) If targetElement=?GTE? for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE.
ValidateTargetElementDefinition targetElement\ValidateTargetElementDefinition.xml (src) This test returns a warning if the sml:targetElement attribute is defined on a type definition.
ValidDerivationByRestriction targetElement\ValidDerivationByRestriction.xml (src) If the element declaration ED is contained (directly, indirectly, or implicitly) in a content model of a complex type D, who is a restriction of another complex type B and B contains an element declaration EB with the same name as ED, then{target element} of ED is the same as that of EB. In the example below, the EnrolledCourse element contained by the GraduateStudentType has the same {targetElement} as the EnrolledCourse element contained by the StudentType.
ValidSameNameElements targetElement\ValidSameNameElements.xml (src) If two element declarations E1 and E2 have the same {namespace name} and {name} and they are both contained (directly, indirectly, or implicitly) in a content model of a complex type, then E1 and E2 have the same {target required}, {target element}, and {target type}. In the example below, the two EnrolledCourse elements contained by the StudentType through the basicGroup and graduateGroup have the same {targetElement}.
ValidTargetElementWithSubstitutionGroup targetElement\ValidWithSubstitutionGroup.xml (src) If targetElement=?GTE? for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE, or an instance of some global element declaration in the substitution group hierarchy whose head is GTE

Target Required Tests

Tests that ensure correct validation of sml:targetRequired attribute

Test Name File Description
ValidTargetElement targetRequired\InValid.xml (src) If targetElement=GTE for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE.
InValidDerivationByRestriction targetRequired\InValidDerivationByRestriction.xml (src) If the element declaration ED is contained (directly, indirectly, or implicitly) in a content model of a complex type D, who is a restriction of another complex type B and B contains an element declaration EB with the same name as ED, then {target required} of ED is the same as that of EB. In the example below, the EnrolledCourse element contained by the GraduateStudentType should have the same {target required} as the EnrolledCourse element contained by the StudentType.
InValidSameNameElements targetRequired\InValidSameNameElements.xml (src) If two element declarations E1 and E2 have the same {namespace name} and {name} and they are both contained (directly, indirectly, or implicitly) in a content model of a complex type, then E1 and E2 have the same {target required}, {target element}, and {target type}. In the example below, the two EnrolledCourse elements contained by the StudentType through the graduateGroup and basicGroup should have the same {target required}.
ValidTargetType targetRequired\InValidType.xml (src) If targetType=?T? for a global element declaration E, then a model is valid if the type of the target of each instances of E in the model is T or a derived type of T
ValidTargetElementWithSubstitutionGroup targetRequired\InValidWithSubstitutionGroup.xml (src) If targetElement="GTE" for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE, or an instance of some global element declaration in the substitution group hierarchy whose head is GTE
ValidTargetElement targetRequired\valid.xml (src) If targetElement=GTE for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE.
ValidateTargetRequireDefinition targetRequired\ValidateTargetRequiredDefinition.xml (src) This test returns a warning if the sml:targetRequired attribute is defined on a type definition.
ValidDerivationByRestriction targetRequired\ValidDerivationByRestriction.xml (src) If the element declaration ED is contained (directly, indirectly, or implicitly) in a content model of a complex type D, who is a restriction of another complex type B and B contains an element declaration EB with the same name as ED, then {target required} of ED is the same as that of EB. In the example below, the EnrolledCourse element contained by the GraduateStudentType has the same {target required} as the EnrolledCourse element contained by the StudentType.
ValidTargetElement targetRequired\ValidFalseRequire.xml (src) If targetElement=GTE for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE.
ValidSameNameElements targetRequired\ValidSameNameElements.xml (src) If two element declarations E1 and E2 have the same {namespace name} and {name} and they are both contained (directly, indirectly, or implicitly) in a content model of a complex type, then E1 and E2 have the same {target required}, {target element}, and {target type}. In the example below, the two EnrolledCourse elements contained by the StudentType through the basicGroup and graduateGroup have the same {target required}.
ValidTargetType targetRequired\ValidType.xml (src) If targetType="T" for a global element declaration E, then a model is valid if the type of the target of each instances of E in the model is T or a derived type of T
ValidTargetType targetRequired\ValidTypeFalse.xml (src) If targetType="T" for a global element declaration E, then a model is valid if the type of the target of each instances of E in the model is T or a derived type of T
ValidTargetElementWithSubstitutionGroup targetRequired\ValidWithSubstitutionGroup.xml (src) If targetElement="GTE" for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE, or an instance of some global element declaration in the substitution group hierarchy whose head is GTE
ValidTargetElementWithSubstitutionGroup targetRequired\ValidWithSubstitutionGroupFalseRequire.xml (src) If targetElement="GTE" for a global element declaration E, then a model is valid if the target of each instances of E in the model is an instance of GTE, or an instance of some global element declaration in the substitution group hierarchy whose head is GTE

Target Type Tests

Tests that ensure correct validation of targetType

Test Name File Description
InValidTargetType targetType\InValid.xml (src) If targetType=?T? for a global element declaration E, then a model is invalid if the type of the target of some instance of E in the model is not T
InValidDerivationByRestriction targetType\InValidDerivationByRestriction.xml (src) If the element declaration ED is contained (directly, indirectly, or implicitly) in a content model of a complex type D, who is a restriction of another complex type B and B contains an element declaration EB with the same name as ED, then {target type} of ED is the same as that of EB. In the example below, the EnrolledCourse element contained by the GraduateStudentType should have the same {targetType} as the EnrolledCourse element contained by the StudentType.
InValidSameNameElements targetType\InValidSameNameElements.xml (src) If two element declarations E1 and E2 have the same {namespace name} and {name} and they are both contained (directly, indirectly, or implicitly) in a content model of a complex type, then E1 and E2 have the same {target required}, {target element}, and {target type}. In the example below, the two EnrolledCourse elements contained by the StudentType through the graduateGroup and basicGroup should have the same {target type}.
ValidateTargetTypeExists1 targetType\InValidValue.xml (src) This test verifies that the value of the sml:targetType resolves to a global type definition. Returns an error if the value does not match any type in the corresponding namespace. The test verifies that the error is displayed even when no model instances are defined for this IF document (ie the validation runs against the xsd file containing the sml:targetType, regardless of the instances being defined in that model)
InValidTargetTypeWithSubstitutionGroup targetType\InValidWithSubstitutionGroup.xml (src) Let targetType=?T? be specified for a GED E. Let SubE be another GED in the substitution group whose head element is E for which the targetType attribute is not specified. Then a model is invalid if an instance of SubE targets an element that is not an instance of T or an instance of some derived type of T.
ValidTargetType targetType\Valid.xml (src) If targetType=?T? for a global element declaration E, then a model is valid if the type of the target of each instances of E in the model is T or a derived type of T
ValidateTargetTypeDefinition targetType\ValidateTargetTypeDefinition.xml (src) This test returns a warning if the sml:targetType attribute is defined on a type definition.
ValidDerivationByRestriction targetType\ValidDerivationByRestriction.xml (src) If the element declaration ED is contained (directly, indirectly, or implicitly) in a content model of a complex type D, who is a restriction of another complex type B and B contains an element declaration EB with the same name as ED, then {target type} of ED is the same as that of EB. In the example below, the EnrolledCourse element contained by the GraduateStudentType has the same {targetType} as the EnrolledCourse element contained by the StudentType.
ValidSameNameElements targetType\ValidSameNameElements.xml (src) If two element declarations E1 and E2 have the same {namespace name} and {name} and they are both contained (directly, indirectly, or implicitly) in a content model of a complex type, then E1 and E2 have the same {target required}, {target element}, and {target type}. In the example below, the two EnrolledCourse elements contained by the StudentType through the graduateGroup and basicGroup have the same {target type}.
ValidTargetTypeWithSubstitutionGroup targetType\ValidWithSubstitutionGroup.xml (src) Let targetType=?T? be specified for a GED E. Let SubE be another GED in the substitution group whose head element is E for which the targetType attribute is not specified. Then a model is valid if all instances of SubE target elements whose type is T.

Back to the top