Hi guys,
i had this simple schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:hl7-org:v2xml" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns="urn:hl7-org:v2xml" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo>
<jaxb:schemaBindings>
<jaxb:package name="net.stracca.xml"/>
</jaxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
<xs:element name="QRY_A19">
<xs:complexType>
<xs:sequence>
<xs:element name="MSH" type="MSH" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="MSH">
<xs:sequence>
<xs:element ref="MSH.1" minOccurs="1" maxOccurs="1"/>
<xs:element ref="MSH.2" minOccurs="1" maxOccurs="1"/>
<xs:element ref="MSH.3" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:element name="MSH.1" type="xs:string"/>
<xs:element name="MSH.2" type="xs:string"/>
<xs:element name="MSH.3" type="xs:string"/>
</xs:schema>
I generate my classes but when i try to unmarshall XMLs without the namespace defined like this one:
<QRY_A19>
<MSH>
<MSH.1>foo</MSH.1>
<MSH.2>bar</MSH.2>
<MSH.3>foo</MSH.3>
</MSH>
</QRY_A19>
i had this error:
javax.xml.bind.UnmarshalException: No manager configured for QRY_A19
at org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:101)
at net.stracca.tests.testXml.executeUnMarshall(testXml.java:47)
at net.stracca.tests.testXml.main(testXml.java:37)
Caused by:
javax.xml.bind.UnmarshalException: No manager configured for QRY_A19
at org.apache.ws.jaxme.impl.JAXBContextImpl.getJMHandler(JAXBContextImpl.java:258)
at org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl.startElement(JMUnmarshallerHandlerImpl.java:118)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:98)
at net.stracca.tests.testXml.executeUnMarshall(testXml.java:47)
at net.stracca.tests.testXml.main(testXml.java:37)
but when i try to unmarshall xmls like this one:
<QRY_A19 xmlns="urn:hl7-org:v2xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MSH>
<MSH.1>foo</MSH.1>
<MSH.2>bar</MSH.2>
<MSH.3>foo</MSH.3>
</MSH>
</QRY_A19>
it's all right.
There's the possibility to accept the 2 types of xml? i receive this xml from different other application and they sent me this 2 types of xmls :(
Thank's a Lot
Stefano Stracuzzi
