Title: Unmarshalling gives no error, but Java object is invalid

I have two programs, one of which marshalls data into XML files, and the other takes the same XML files and Unmarshalls them.

Both programs use the same set of Java classes, generated from an XML schema.

The marshalling program works fine, and when I call RootObject.isValid() before marshalling it returns true.

However the unmarshalling program does not work.

The call to unmarshall seems to work (throws nothing), but when I call RootObject.isValid() it returns false. My RootObject also contains an ArrayList of another object type (ActionRequest), which appears to contain no objects after unmarshalling (should contain a single ActionRequest object).

I added logging to the RootObjects unmarshall and got the following output:

#startElement: root
#startElement: actionRequest
#startElement: requestReference
#startElement: requestSource
#characters: Directory Scanning Application
#endElement: requestSource
#startElement: requestDateTime
#characters: 2003-10-06T13:50:04.138+01:00
#endElement: requestDateTime
#endElement: requestReference
#startElement: application
#characters: Import
#endElement: application
#startElement: actionType
#characters: Update
#endElement: actionType
#startElement: importAction
#container: _actionRequestTypeChoice
#characters: Update
#endElement: importAction
#startElement: existingCase
#endElement: _actionRequestTypeChoice
#startElement: caseTypeName
#characters: PropertyHistory
#endElement: caseTypeName
#startElement: businessVariableList
#startElement: businessVariable
#startElement: name
#characters: UPRN
#endElement: name
#startElement: value
#characters: S99999999
#endElement: value
#endElement: businessVariable
#endElement: businessVariableList
#endElement: existingCase
#startElement: newCase
#startElement: caseTypeName
#characters: PropertyHistory
#endElement: caseTypeName
#startElement: businessVariableList
#startElement: businessVariable
#startElement: name
#characters: File
#endElement: name
#startElement: value
#characters: E:\DataFiles\BackScanned\S9999999\HISTORY\S99999999.tif
#endElement: value
#startElement: blob
#characters: true
#endElement: blob
#endElement: businessVariable
#endElement: businessVariableList
#endElement: newCase
#endElement: actionRequest
#endElement: root

So the unmarshalling process does seem to be reading my XML file.
The only thing that looks odd is the '#endElement: _actionRequestTypeChoice' which does not match with a #startElement

_actionRequestTypeChoice is to do with the <importAction> tags, as there are a limited number of valid choices for the data held by this element.

The XML file being processed is:

<?xml version="1.0" encoding="UTF-8"?>
<root>
<actionRequest>
<requestReference>
<requestSource>Directory Scanning Application</requestSource>
<requestDateTime>2003-10-06T13:50:04.138+01:00</requestDateTime>
</requestReference>
<application>Import</application>
<actionType>Update</actionType>
<importAction>Update</importAction>
<existingCase>
<caseTypeName>PropertyHistory</caseTypeName>
<businessVariableList>
<businessVariable>
<name>UPRN</name>
<value>S99999999</value>
</businessVariable>
</businessVariableList>
</existingCase>
<newCase>
<caseTypeName>PropertyHistory</caseTypeName>
<businessVariableList><businessVariable>
<name>File</name>
<value>E:\DataFiles\BackScanned\S9999999\HISTORY\S99999999.tif</value>
<blob>true</blob>
</businessVariable>
</businessVariableList>
</newCase>
</actionRequest>
</root>

Can you give me any idea what might be causing this problem?

(scheme attached in zip file as it is large)

Thanks,

Alison <<actionRequestSchema.zip>>

Attachment: actionRequestSchema.zip
Description: Binary data

Reply via email to