You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Stracuzzi Stefano <St...@siemens.com> on 2005/02/08 09:27:02 UTC

Problems with unmarshalling and targetNameSpace

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.jav
a: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:2
58)
	at
org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl.startElement(JMUnmarshall
erHandlerImpl.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.scanRoot
ElementHook(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.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.jav
a: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

Re: Problems with unmarshalling and targetNameSpace

Posted by Jochen Wiedmann <jo...@gmail.com>.
On Tue, 8 Feb 2005 09:27:02 +0100, Stracuzzi Stefano
<St...@siemens.com> wrote:

> 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 :( 

Stefano,

for whatever reason, this is a common problem. I have therefore
written a new entry in the FAQ. See
http://wiki.apache.org/ws/JaxMe/FrequentlyAskedQuestions/Unmarshalling
. Hopefully, you're the first one reading it. Feel free to proofread
and fix whatever you want.

Regards,

Jochen


-- 
Sum. Cogitone?

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org