I have a given xsd file and given examples for this file. the xsd is very similar to http://www.forum-datenaustausch.ch/hospitalinvoicerequest_400.xsd but with one additional element below the root.
The problem is if i validate the given xml against the schema (using moxy as JAXBCOntextFactory) i got this error:
enterCaused by: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 221; cvc-elt.1: Cannot find the declaration of element 'invoice:request'.
invoice:request is the root element the xml begins:
<invoice:request role="production" xmlns:invoice="http://www.medidata.ch/QO/XSD" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.medidata.ch/QO/XSD QO_MDInvoiceRequest_400.xsd">
xsd begins with:
<schema targetNamespace="http://www.medidata.ch/QO/XSD" xmlns:invoice="http://www.medidata.ch/QO/XSD" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
If i validate the xml against the schema online or in eclipse (right click validate) all works fine. And if i change the name space from
xmlns:invoice="http://www.medidata.ch/QO/XSD"
to
xmlns:invoice="http://www.xmlData.ch/xmlInvoice/XSD"
the error disappears - but i get another one because of the additional element.
With this name space declaration i can't even read the contents without validation: the getter for root returns null. With the alternative declaration ("http://www.xmlData.ch/xmlInvoice/XSD") and without validation all works fine!
So whats wrong with the name space declaration?
[Updated on: Thu, 14 March 2013 15:14]
Report message to a moderator