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 2004/08/18 18:14:09 UTC

Validating or not in Unmarshall operation

I've not understood if, when i make an unmarshall operation, the Validating
of the XML is made or not.

I've a code like this:

JAXBContext jaxbContext = JAXBContext.newInstance("wgs.cq.xml"); 
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
unmarshaller.setValidating(false);
return unmarshaller.unmarshal(new InputSource(new StringReader(sXML)));

so i setted the Validating to false because i don't want my XML to be
validated, but i had an exception like this:

javax.xml.bind.UnmarshalException
	at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.jav
a:103)
	at wgs.cq.system.XMLManager.executeUnMarshall(XMLManager.java:59)
	at
wgs.cq.model.implServicesLHA.ServiceSAIA.execute(ServiceSAIA.java:37)
	at wgs.cq.system.test.main(test.java:36)
Caused by:
org.xml.sax.SAXParseException: Unexpected element: 'HD.2'
	at
org.apache.ws.jaxme.impl.JMHandlerBase.validationEvent(JMHandlerBase.java:11
9)
	at
org.apache.ws.jaxme.impl.JMHandlerImpl.startElement(JMHandlerImpl.java:57)
	at wgs.cq.xml.impl.MSH3Handler.startElement(MSH3Handler.java:74)
	at wgs.cq.xml.impl.MSHHandler.startElement(MSHHandler.java:341)
	at
wgs.cq.xml.impl.QRYA19TypeHandler.startElement(QRYA19TypeHandler.java:106)
	at
org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl.startElement(JMUnmarshall
erHandlerImpl.java:136)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
Source)
	at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(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 wgs.cq.system.XMLManager.executeUnMarshall(XMLManager.java:59)
	at
wgs.cq.model.implServicesLHA.ServiceSAIA.execute(ServiceSAIA.java:37)
	at wgs.cq.system.test.main(test.java:36)

The XML that i try to unmarshall is generated by JaxMe and i validate it
with an external program on the base of the xsd from wich i made the JaxMe
classes .

What's worng???

---
Cordiali Saluti / Best Regards

Stefano Stracuzzi

Siemens S.p.A.
via Giardini 454/B
41100 Modena Italy
Tel. +39 059 354124
Fax: +39 059 343527

:: Web Developer | Java & IBM ::

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


Re: Validating or not in Unmarshall operation

Posted by Jochen Wiedmann <jo...@freenet.de>.
Stracuzzi Stefano wrote:

>unmarshaller.setValidating(false);
>  
>

I must admit, that this option is so far completely ignored by JaxMe. 
Even more, I have difficulties to imagine that it can be handled 
properly in the future,  now that we start changing the framework to use 
a parser generator internally.


Sorry,

Jochen
 

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