Skip to main content

SAXParseException while validating a schema

No replies
sarabura
Offline
Joined: 2010-04-26
Points: 0

I am testing schema validation on a JBoss server 5.1.0 using JBoss WS 3.2.2, java jdk 1.6_19. When I send in a request to the web service I get this error back:

org.xml.sax.SAXParseException: s4s-elt-schema-ns: The namespace of element 'definitions' must be from the schema namespace, 'http://www.w3.org/2001/XMLSchema'.

I don't get it. The namespace of the 'definitions" entity is in fact the wsdl namespace "http://schemas.xmlsoap.org/wsdl/", not 'http://www.w3.org/2001/XMLSchema'. This error prevents me from enabling schema validation, so I am stuck and would appreciate any recommendations. I have searched in vain for any other mention of this particular error.

Here is the tag in my wsdl:

and here is the code that sets up the document builder:

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdURL.toExternalForm());
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
DocumentBuilder builder = factory.newDocumentBuilder();

and here is the stack trace...

StrictlyValidErrorHandler.error(SAXParseException) line: 43
ErrorHandlerWrapper.error(String, String, XMLParseException) line: not available
XMLErrorReporter.reportError(XMLLocator, String, String, Object[], short, Exception) line: not available
XMLErrorReporter.reportError(XMLLocator, String, String, Object[], short) line: not available
XSDHandler.reportSchemaError(String, Object[], Element) line: not available
XSAttributeChecker.reportSchemaError(String, Object[], Element) line: not available
XSAttributeChecker.checkAttributes(Element, boolean, XSDocumentInfo, boolean) line: not available
XSAttributeChecker.checkAttributes(Element, boolean, XSDocumentInfo) line: not available
XSDocumentInfo.(Element, XSAttributeChecker, SymbolTable) line: not available
XSDHandler.constructTrees(Element, String, XSDDescription) line: not available
XSDHandler.parseSchema(XMLInputSource, XSDDescription, Hashtable) line: not available
XMLSchemaLoader.loadSchema(XSDDescription, XMLInputSource, Hashtable) line: not available
XMLSchemaLoader.processJAXPSchemaSource(Hashtable) line: not available
XMLSchemaLoader.loadSchema(XSDDescription, XMLInputSource, Hashtable) line: not available
XMLSchemaValidator.findSchemaGrammar(short, String, QName, QName, XMLAttributes) line: not available
XMLSchemaValidator.handleStartElement(QName, XMLAttributes, Augmentations) line: not available
XMLSchemaValidator.startElement(QName, XMLAttributes, Augmentations) line: not available
XMLNSDocumentScannerImpl.scanStartElement() line: not available
XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook() line: not available
XMLNSDocumentScannerImpl$NSContentDispatcher(XMLDocumentFragmentScannerImpl$FragmentContentDispatcher).dispatch(boolean) line: not available
XMLNSDocumentScannerImpl(XMLDocumentFragmentScannerImpl).scanDocument(boolean) line: not available
XIncludeAwareParserConfiguration(XML11Configuration).parse(boolean) line: not available
XIncludeAwareParserConfiguration(XML11Configuration).parse(XMLInputSource) line: not available
DOMParser(XMLParser).parse(XMLInputSource) line: not available
DOMParser.parse(InputSource) line: not available
DocumentBuilderImpl.parse(InputSource) line: not available
SchemaValidationHelper.validateDocument(InputSource) line: 80
SchemaValidationHelper.validateDocument(String) line: 62
SchemaValidationHelper.validateDocument(Element) line: 68
SOAPBodyElementDoc.validatePayload(Source) line: 121
SOAPBodyElementDoc.transitionTo(SOAPContent$State) line: 82
SOAPBodyElementDoc(SOAPContentElement).getObjectValue() line: 175
etc etc