6.10 Notes on the javax.xml.validation Package
The following table gives cautionary notes on the javax.xml.validation package.
No. |
Notes |
---|---|
1 |
In multi-thread programming, the SchemaFactory, Validator, ValidatorHandler, and TypeInfoProvider classes are not thread-safe. Therefore, make sure that each thread exclusively accesses these objects. |
2 |
The URI "http://www.w3.org/2001/XMLSchema" is the only URI that you can specify as the argument of the newInstance(String schemaLanguage) method of the SchemaFactory class. |
3 |
for the isSchemaLanguageSupported method of the SchemaFactory class. Specify http://www.w3.org/2001/XMLSchema. If you specify other schema languages, this method returns false. |
4 |
Specify a schema document with a different targetNamespace for each array element of the schemas argument for the newSchema(Source[] schemas) method of the SchemaFactory class. If you specify multiple schema documents with the same targetNamespace or with no targetNamespace, a schema document for an array element with a lower index is prioritized. |
5 |
If you execute the newSchema(Source[] schemas) method of the SchemaFactory class under the following condition, exceptions may not occur:
To avoid this problem, use the following workaround:
|
6 |
If you use a schema document including the definition for ID type attributes to validate XML documents by using the validate method of the Validator class, use either the validate(SAXSource), validate(DOMSource), or validate(SAXSource, SAXResult) method rather than the validate(DOMSource, DOMResult) method. |
7 |
When all of the following conditions are met, if you execute the validate(Source source, Result result) method of the Validator class, a DOMException may occur:
Therefore, make sure that the Document object described in condition 2 does not have any child node. |
8 |
If a schema document includes the xsd:ENTITY type or xsd:ENTITIES type, schema validation by using the ValidatorHandler class is not supported. In such cases, perform the schema validation by using other methods such as the Validator class. |
9 |
If the validation fails, a TypeInfo object obtained from the element or attribute that is not defined in the schema document becomes the same as the TypeInfo object of the xsd:anyType type. |
10 |
If you specify the DOMSource object for the Source argument of the validate(Source) and validate(Source, Result) of the Validator class, make sure that the Node object owned by the DOMSource object meets all of the following conditions:
|
11 |
If you specify the SAXSource object for the Source argument of the validate(Source) and validate(Source, Result) of the Validator class and the SAXSource object uses the XMLReader object, the XMLReader object must meet all of the following conditions:
|
12 |
When all of the following conditions come in succession, the exception DOMException with the exception code NO_MODIFICATION_ALLOWED_ERR might occur:
|
13 |
Using the newSchema method of the javax.xml.validation.SchemaFactory class, if you want to specify a SAXSource with an XMLReader specified, the XMLReader to be specified must satisfy the following conditions:
|
14 |
When you specify StAXSource and StAXResult in an argument of the validate(Source, Result) method of the Validator class, specify the same encoding in StAXSource and StAXResult. |
15 |
Condition When the getElementTypeInfo() method of the javax.xml.validation. TypeInfoProvider class is executed in the endElement event of ContentHandler set in ValidatorHandler. Operation of Cosminexus XML Processor The IllegalStateException exception is thrown. The TypeInfo object is not returned. |