XMLSchema, validation

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top