Class XmlSchemaElementValidator
java.lang.Object
org.apache.ws.commons.schema.docpath.XmlSchemaElementValidator
Methods to confirm that an XML element and its attributes all conform to its
XML Schema.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidcheckEnumerationFacet(String name, String value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) private static voiddigitsFacetCheck(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type facetType) private static voiddigitsFacetChecks(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) private static BigDecimalgetBigDecimalOf(Object numericValue) private static DatatypeFactoryprivate static voidlistLengthCheck(String name, String[] value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type facetType) private static voidlistLengthChecks(String name, String[] value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) private static voidrangeCheck(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type rangeType) private static voidrangeChecks(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) private static voidstringLengthCheck(String name, String value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type facetType) private static voidstringLengthChecks(String name, String value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) private static voidvalidateAtomicType(String name, String value, XmlSchemaTypeInfo typeInfo, NamespaceContext nsContext) (package private) static voidvalidateAttributes(XmlSchemaStateMachineNode state, Attributes attrs, NamespaceContext nsContext) Confirms all of the SAXAttributesprovided conform to their types listed in theXmlSchemaStateMachineNode.(package private) static voidvalidateContent(XmlSchemaStateMachineNode state, String elementContent, NamespaceContext nsContext) Confirms the provided content conforms to the element's expected content type.private static voidvalidateType(String name, String value, XmlSchemaTypeInfo typeInfo, NamespaceContext nsContext)
-
Field Details
-
datatypeFactory
-
-
Constructor Details
-
XmlSchemaElementValidator
XmlSchemaElementValidator()
-
-
Method Details
-
getDatatypeFactory
-
validateAttributes
static void validateAttributes(XmlSchemaStateMachineNode state, Attributes attrs, NamespaceContext nsContext) throws ValidationException Confirms all of the SAXAttributesprovided conform to their types listed in theXmlSchemaStateMachineNode. If one of the types is aQName, uses theNamespaceContextto confirm its namespace is recognized.Throws a
ValidationExceptionif the content is not valid.- Parameters:
state- The state machine node containing the attribute types.attrs- The attributes to verify.nsContext- The namespace context to use to confirm QNames of.- Throws:
ValidationException- If the content is not valid.
-
validateContent
static void validateContent(XmlSchemaStateMachineNode state, String elementContent, NamespaceContext nsContext) throws ValidationException Confirms the provided content conforms to the element's expected content type. If the expected content is aQName, uses the providedNamespaceContextto confirm the namespace is recognized and valid.Throws a
ValidationExceptionif the element's content is invalid.- Parameters:
state- TheXmlSchemaStateMachineNodecontaining the type information of the element's expected content.elementContent- The element content to verify.nsContext- TheNamespaceContextto use to verifyQNames are valid.- Throws:
ValidationException- if the element content is not valid.
-
validateType
private static void validateType(String name, String value, XmlSchemaTypeInfo typeInfo, NamespaceContext nsContext) throws ValidationException - Throws:
ValidationException
-
validateAtomicType
private static void validateAtomicType(String name, String value, XmlSchemaTypeInfo typeInfo, NamespaceContext nsContext) throws ValidationException - Throws:
ValidationException
-
rangeChecks
private static void rangeChecks(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) throws ValidationException- Throws:
ValidationException
-
rangeCheck
private static void rangeCheck(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type rangeType) throws ValidationException- Throws:
ValidationException
-
getBigDecimalOf
-
stringLengthChecks
private static void stringLengthChecks(String name, String value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) throws ValidationException- Throws:
ValidationException
-
stringLengthCheck
private static void stringLengthCheck(String name, String value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type facetType) throws ValidationException- Throws:
ValidationException
-
listLengthChecks
private static void listLengthChecks(String name, String[] value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) throws ValidationException- Throws:
ValidationException
-
listLengthCheck
private static void listLengthCheck(String name, String[] value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type facetType) throws ValidationException- Throws:
ValidationException
-
digitsFacetChecks
private static void digitsFacetChecks(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) throws ValidationException- Throws:
ValidationException
-
digitsFacetCheck
private static void digitsFacetCheck(String name, BigDecimal value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets, XmlSchemaRestriction.Type facetType) throws ValidationException- Throws:
ValidationException
-
checkEnumerationFacet
private static void checkEnumerationFacet(String name, String value, Map<XmlSchemaRestriction.Type, List<XmlSchemaRestriction>> facets) throws ValidationException- Throws:
ValidationException
-