M
Marcin Wielgus
help please. The code below throws this:
java.lang.UnsupportedOperationException: This parser
does not support specification "null" version "null"
in code:
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(new File("filename.xsd"));
Schema schema = factory.newSchema(schemaFile);
dbfactory.setSchema(schema); <--here the exception is thrown
dbfactory.setNamespaceAware(true);
DocumentBuilder parser = dbfactory.newDocumentBuilder();
parser.setErrorHandler(new ConfigurationFileErrorHandler());
doc = parser.parse(is);
filename.xsd looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/
XMLSchema"
targetNamespace="http://ernie.icslab.agh.edu.pl/
wielgus/chameleon/Operation"
xmlns="http://ernie.icslab.agh.edu.pl/wielgus/
chameleon/Operation">
<xsd:element name="chameleonoperation"
type="ChameleonOperation"/>
<xsd:complexType name="ChameleonOperation"/>
</xsd:schema>
I would like to know why is this happening. Not really interested in how
to fix this, but mainly why. This code used to work some time ago, and i
don't know what has changed that it is no longer working.
java.lang.UnsupportedOperationException: This parser
does not support specification "null" version "null"
in code:
DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(new File("filename.xsd"));
Schema schema = factory.newSchema(schemaFile);
dbfactory.setSchema(schema); <--here the exception is thrown
dbfactory.setNamespaceAware(true);
DocumentBuilder parser = dbfactory.newDocumentBuilder();
parser.setErrorHandler(new ConfigurationFileErrorHandler());
doc = parser.parse(is);
filename.xsd looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/
XMLSchema"
targetNamespace="http://ernie.icslab.agh.edu.pl/
wielgus/chameleon/Operation"
xmlns="http://ernie.icslab.agh.edu.pl/wielgus/
chameleon/Operation">
<xsd:element name="chameleonoperation"
type="ChameleonOperation"/>
<xsd:complexType name="ChameleonOperation"/>
</xsd:schema>
I would like to know why is this happening. Not really interested in how
to fix this, but mainly why. This code used to work some time ago, and i
don't know what has changed that it is no longer working.