org.opengis.cite.osxgeotime
Class ETSAssert

java.lang.Object
  extended by org.opengis.cite.osxgeotime.ETSAssert

public class ETSAssert
extends Object

Provides a set of custom assertion methods.


Method Summary
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.
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 assertXPath(String expr, Node context, Map<String,String> namespaceBindings)
          Asserts that an XPath 1.0 expression holds true for the given evaluation context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertQualifiedName

public static void assertQualifiedName(Node node,
                                       QName qName)
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

public static void assertXPath(String expr,
                               Node context,
                               Map<String,String> namespaceBindings)
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 be null.

assertSchemaValid

public static void assertSchemaValid(Validator validator,
                                     Source source)
Asserts that an XML resource is schema-valid.

Parameters:
validator - The Validator to use.
source - The XML Source to be validated.

assertSchematronValid

public static void assertSchematronValid(URL schemaRef,
                                         Source xmlSource)
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.

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.


Copyright © 2014. All Rights Reserved.