This section provides a tutorial example showing that sax.Writer does not support XSD 1.1.
As you can see from tests in the previous section, sax.Writer can be used
as a nice validation tool on XML documents associated with an XSD schema.
Now I want to see if sax.Writer supports XSD 1.1 or not:
>type hello_xsd11.xsd
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="p" type="xsd:anyAtomicType"/>
</xsd:schema>
>type hello_xsd11.xml
<?xml version="1.0"?>
<p xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="hello_xsd11.xsd">
Hello world!</p>
>jdk8x2r sax.Writer -v -s hello_xsd11.xml
[Error] hello_xsd11.xsd:3:50: src-resolve.4.2: Error resolving
^^^ component 'xsd:anyAtomicType'. It was detected that
^^^ 'xsd:anyAtomicType' is in namespace
^^^ 'http://www.w3.org/2001/XMLSchema', but components from this
^^^ namespace are not referenceable from schema document
^^^ 'file:///C:/herong/hello_xsd11.xsd'. If this is the incorrect
^^^ namespace, perhaps the prefix of 'xsd:anyAtomicType' needs to be
^^^ changed. If this is the correct namespace, then an appropriate
^^^ 'import' tag should be added to
^^^ 'file:///C:/herong/hello_xsd11.xsd'.
[Error] hello_xsd11.xsd:3:50: src-resolve: Cannot resolve the name
^^^ 'xsd:anyAtomicType' to a(n) 'type definition' component.
<?xml version="1.0" encoding="UTF-8"?>
<p xsi:noNamespaceSchemaLocation="hello_xsd11.xsd">
Hello world!</p>
Too bad, sax.Writer does not support XSD 1.1.
As you can see, the new datatype xsd:anyAtomicType
introduced in XSD 1.1 is not recognized.