Package org.opengis.cite.iso19136
Class ETSAssert
java.lang.Object
org.opengis.cite.iso19136.ETSAssert
Provides a set of custom assertion methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertDescendantElementCount
(Document xmlEntity, QName elementName, int expectedCount) Asserts that the given XML entity contains the expected number of descendant elements having the specified name.static void
assertQualifiedName
(Node node, QName qName) Asserts that the qualified name of a DOM Node matches the expected value.static void
assertSchematronValid
(URL schemaRef, Source xmlSource) Asserts that an XML resource satisfies all applicable constraints specified in a Schematron (ISO 19757-3) schema.static void
assertSchemaValid
(Validator validator, Source source) Asserts that an XML resource is schema-valid.static void
assertURLIsResolvable
(URL url, jakarta.ws.rs.core.MediaType expectedMediaType) Asserts that the given URL is resolvable; that is, it can be dereferenced to obtain a resource representation that corresponds to an expected media type.static void
assertValidPropertyType
(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration propertyDecl, org.apache.xerces.xs.XSElementDeclaration head) Asserts that the content model of the given type definition mimics a GML property type.static void
assertValidPropertyType
(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration propertyDecl, org.apache.xerces.xs.XSElementDeclaration head, boolean includeHeadInSubstition) Asserts that the content model of the given type definition mimics a GML property type.static void
Asserts that an XPath 1.0 expression holds true for the given evaluation context.
-
Method Details
-
assertQualifiedName
Asserts that the qualified name of a DOM Node matches the expected value.- Parameters:
node
- The Node to check.qName
- A QName object containing a namespace name (URI) and a local part.
-
assertXPath
Asserts that an XPath 1.0 expression holds true for the given evaluation context. The following standard namespace bindings do not need to be explicitly declared:- Parameters:
expr
- A valid XPath 1.0 expression.context
- The context node.namespaceBindings
- A collection of namespace bindings for the XPath expression, where each entry maps a namespace URI (key) to a prefix (value). It may benull
.
-
assertSchemaValid
Asserts that an XML resource is schema-valid.- Parameters:
validator
- The Validator to use.source
- The XML Source to be validated.
-
assertSchematronValid
Asserts that an XML resource satisfies all applicable constraints specified in a Schematron (ISO 19757-3) schema. The "xslt2" query language binding is supported. All patterns are checked.- Parameters:
schemaRef
- A URL that denotes the location of a Schematron schema.xmlSource
- The XML Source to be validated.
-
assertURLIsResolvable
Asserts that the given URL is resolvable; that is, it can be dereferenced to obtain a resource representation that corresponds to an expected media type.- Parameters:
url
- The URL to be dereferenced.expectedMediaType
- The expected media type of the representation; if not specified any type of content is acceptable.
-
assertValidPropertyType
public static void assertValidPropertyType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration propertyDecl, org.apache.xerces.xs.XSElementDeclaration head) Asserts that the content model of the given type definition mimics a GML property type. The type is presumably not derived (by restriction) from some base GML property type (gml:AssociationRoleType, gml:ReferenceType, gml:InlinePropertyType). The following constraints apply to the content model:- if the content model is not empty, one of the following cases must be true:
- it contains only one element declaration (the property value), which may occur more than once in an array property type;
- it contains a choice compositor that allows at most one element (an allowable substitution) to occur.
- if it is empty (or possibly empty), it includes the attribute group gml:AssociationAttributeGroup.
- includes the attribute group gml:OwnershipAttributeGroup.
- does not contain a wildcard schema component.
- the property value must substitute for the designated head element (if specified).
Sources
- ISO 19136:2007, cl. 7.2.3.3: abstractAssociationRole, AssociationRoleType
- ISO 19136:2007, cl. 7.2.3.7: abstractReference, ReferenceType
- ISO 19136:2007, cl. 7.2.3.8: abstractInlineProperty, InlinePropertyType
- Parameters:
model
- An XSModel object representing an XML Schema resource.propertyDecl
- An XSElementDeclaration object representing a property element declaration.head
- The head of the substitution group to which the property value belongs (may benull
).
- if the content model is not empty, one of the following cases must be true:
-
assertValidPropertyType
public static void assertValidPropertyType(org.apache.xerces.xs.XSModel model, org.apache.xerces.xs.XSElementDeclaration propertyDecl, org.apache.xerces.xs.XSElementDeclaration head, boolean includeHeadInSubstition) Asserts that the content model of the given type definition mimics a GML property type. The type is presumably not derived (by restriction) from some base GML property type (gml:AssociationRoleType, gml:ReferenceType, gml:InlinePropertyType). The following constraints apply to the content model:- if the content model is not empty, one of the following cases must be true:
- it contains only one element declaration (the property value), which may occur more than once in an array property type;
- it contains a choice compositor that allows at most one element (an allowable substitution) to occur.
- if it is empty (or possibly empty), it includes the attribute group gml:AssociationAttributeGroup.
- includes the attribute group gml:OwnershipAttributeGroup.
- does not contain a wildcard schema component.
- the property value must substitute for the designated head element (if specified).
Sources
- ISO 19136:2007, cl. 7.2.3.3: abstractAssociationRole, AssociationRoleType
- ISO 19136:2007, cl. 7.2.3.7: abstractReference, ReferenceType
- ISO 19136:2007, cl. 7.2.3.8: abstractInlineProperty, InlinePropertyType
- Parameters:
model
- An XSModel object representing an XML Schema resource.propertyDecl
- An XSElementDeclaration object representing a property element declaration.head
- The head of the substitution group to which the property value belongs (may benull
).includeHeadInSubstition
-true
if the property value may belong to the head,false
otherwise
- if the content model is not empty, one of the following cases must be true:
-
assertDescendantElementCount
public static void assertDescendantElementCount(Document xmlEntity, QName elementName, int expectedCount) Asserts that the given XML entity contains the expected number of descendant elements having the specified name.- Parameters:
xmlEntity
- A Document representing an XML entity.elementName
- The qualified name of the element.expectedCount
- The expected number of occurrences.
-