Hi,
it's a bit vague to make a guess an the information provided.
However, what I did see is that in your code, you try to unmarshal to
the class "Envelope", while your XML's root element is directly "Error_Msg".
Steven
castor-dev schrieb:
Hi,
Please help me on this, struck for a long time.
I am getting the following error....
ERROR
======
Exception in thread "main" org.exolab.castor.xml.MarshalException: Illegal
Text data found as child of: Error_Msg
value: "<ns0:ErrorReport
xmlns:ns0="http://www.tibco.com/pe/EngineTypes"><StackTrace>error generated
by Generate Error
at
com.tibco.pe.core.GenerateErrorActivity.eval(GenerateErrorActivity.java:150)
at com.tibco.pe.plugin.Activity.eval(Activity.java:209)
at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:541)
at com.tibco.pe.core.Job.a(Job.java:709)
at com.tibco.pe.core.Job.l(Job.java:499)
at
com.tibco.pe.core.JobDispatcher$JobCourier.a(JobDispatcher.java:249)
at
com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)
</StackTrace><Msg>error generated by Generate
Error</Msg><FullClass>com.tibco.pe.plugin.ActivityException</FullClass><Class>ActivityException</Class><ProcessStack>HISTemplate-WithoutResolution/Starter
Process/Order Books.process/Inventory
Check>HISTemplate-WithoutResolution/SubProces/Check
Inventory.process/Generate
Error</ProcessStack><MsgCode>-</MsgCode><Data><ns1:Error_Prop
xmlns:ns1="http://xmlns.example.com/unique/default/namespace/1099955715563"><ns1:ActivityName>INV</ns1:ActivityName><ns1:ErrorFlag>true</ns1:ErrorFlag></ns1:Error_Prop></Data></ns0:ErrorReport>"{File:
; line: 39; column: 713}
at
org.exolab.castor.xml.Unmarshaller.convertSAXExceptionToMarshalException(Unmarshaller.java:755)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:721)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:610)
at Test3.main(Test3.java:25)
Caused by: org.xml.sax.SAXException: Illegal Text data found as child of:
Error_Msg
value: "<ns0:ErrorReport
xmlns:ns0="http://www.tibco.com/pe/EngineTypes"><StackTrace>error generated
by Generate Error
at
com.tibco.pe.core.GenerateErrorActivity.eval(GenerateErrorActivity.java:150)
at com.tibco.pe.plugin.Activity.eval(Activity.java:209)
at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:541)
at com.tibco.pe.core.Job.a(Job.java:709)
at com.tibco.pe.core.Job.l(Job.java:499)
at
com.tibco.pe.core.JobDispatcher$JobCourier.a(JobDispatcher.java:249)
at
com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)
</StackTrace><Msg>error generated by Generate
Error</Msg><FullClass>com.tibco.pe.plugin.ActivityException</FullClass><Class>ActivityException</Class><ProcessStack>HISTemplate-WithoutResolution/Starter
Process/Order Books.process/Inventory
Check>HISTemplate-WithoutResolution/SubProces/Check
Inventory.process/Generate
Error</ProcessStack><MsgCode>-</MsgCode><Data><ns1:Error_Prop
xmlns:ns1="http://xmlns.example.com/unique/default/namespace/1099955715563"><ns1:ActivityName>INV</ns1:ActivityName><ns1:ErrorFlag>true</ns1:ErrorFlag></ns1:Error_Prop></Data></ns0:ErrorReport>"
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:860)
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1099)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:709)
... 2 more
Caused by: org.xml.sax.SAXException: Illegal Text data found as child of:
Error_Msg
value: "<ns0:ErrorReport
xmlns:ns0="http://www.tibco.com/pe/EngineTypes"><StackTrace>error generated
by Generate Error
at
com.tibco.pe.core.GenerateErrorActivity.eval(GenerateErrorActivity.java:150)
at com.tibco.pe.plugin.Activity.eval(Activity.java:209)
at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:541)
at com.tibco.pe.core.Job.a(Job.java:709)
at com.tibco.pe.core.Job.l(Job.java:499)
at
com.tibco.pe.core.JobDispatcher$JobCourier.a(JobDispatcher.java:249)
at
com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)
</StackTrace><Msg>error generated by Generate
Error</Msg><FullClass>com.tibco.pe.plugin.ActivityException</FullClass><Class>ActivityException</Class><ProcessStack>HISTemplate-WithoutResolution/Starter
Process/Order Books.process/Inventory
Check>HISTemplate-WithoutResolution/SubProces/Check
Inventory.process/Generate
Error</ProcessStack><MsgCode>-</MsgCode><Data><ns1:Error_Prop
xmlns:ns1="http://xmlns.example.com/unique/default/namespace/1099955715563"><ns1:ActivityName>INV</ns1:ActivityName><ns1:ErrorFlag>true</ns1:ErrorFlag></ns1:Error_Prop></Data></ns0:ErrorReport>"
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:860)
at
org.exolab.castor.xml.UnmarshalHandler.endElement(UnmarshalHandler.java:1099)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at
org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1149)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:709)
at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:610)
at Test3.main(Test3.java:25)
My Java Code is as follows
public class Test3 {
public static void main(String args[]) throws MappingException,
XMLException, ValidationException, XmlException {
try{
Log log =LogFactory.getLog(Test3.class);
FileReader reader = new FileReader("GenXML.xml");
Unmarshaller unmarshaller = new Unmarshaller(Envelope.class);
unmarshaller.setIgnoreExtraAttributes(true);
unmarshaller.setIgnoreExtraElements(true);
Envelope envelope;
envelope = (Envelope)unmarshaller.unmarshal(reader);
System.out.print( envelope.getBody() .getExceptionInfo()
.getError_Msg() + ":" +
envelope.getBody() .getExceptionInfo() .getEventData() );
} catch (IOException e) {
System.out.println(e.toString() );
}
And my XML is..
==============
<?xml version="1.0" encoding="UTF-8"?>
<Error_Msg><ns0:ErrorReport
xmlns:ns0="http://www.tibco.com/pe/EngineTypes"><StackTrace>error
generated by Generate Error&#xD;
at
com.tibco.pe.core.GenerateErrorActivity.eval(GenerateErrorActivity.java:150)&#xD;
at com.tibco.pe.plugin.Activity.eval(Activity.java:209)&#xD;
at com.tibco.pe.core.TaskImpl.eval(TaskImpl.java:541)&#xD;
at com.tibco.pe.core.Job.a(Job.java:709)&#xD;
at com.tibco.pe.core.Job.l(Job.java:499)&#xD;
at
com.tibco.pe.core.JobDispatcher$JobCourier.a(JobDispatcher.java:249)&#xD;
at
com.tibco.pe.core.JobDispatcher$JobCourier.run(JobDispatcher.java:200)&#xD;
</StackTrace><Msg>error generated by Generate
Error</Msg><FullClass>com.tibco.pe.plugin.ActivityException</FullClass><Class>ActivityException</Class><ProcessStack>HISTemplate-WithoutResolution/Starter
Process/Order Books.process/Inventory
Check&gt;HISTemplate-WithoutResolution/SubProces/Check
Inventory.process/Generate
Error</ProcessStack><MsgCode>-</MsgCode><Data><ns1:Error_Prop
xmlns:ns1="http://xmlns.example.com/unique/default/namespace/1099955715563"><ns1:ActivityName>INV</ns1:ActivityName><ns1:ErrorFlag>true</ns1:ErrorFlag></ns1:Error_Prop></Data></ns0:ErrorReport></Error_Msg>
<EventData><Order
xmlns="http://www.hydus.com/HIS/Order"><OrderID>2-1</OrderID><OrderDate>2007-10-15T10:29:09.125-05:00</OrderDate><ISBN_Number>123-111-1112-1</ISBN_Number><BookName>Java
Programming</BookName><Quantity>1</Quantity><CreditCardNum>4444
4444 4444
4444</CreditCardNum><ExpirationDate>07/07</ExpirationDate></Order></EventData>
Where Error_Msg and EventData are defined as
<xs:element name = "Error_Msg" type = "xs:anyType"/>
<xs:element name = "EventData" type = "xs:anyType"/>
Please help me on this. For EventData it was working fine but not able to
get exact value for Error_Msg. None of the posts have appropriate solution.
-Kiran
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email