Hi,
I just found out the cause of the problem. It was my mistake.
In the XML binding I have one definition like this:
<value name="location" field="location_"
deserializer="com.waveman.campaign.entity.Unit$Level.valueOf" />
From the document, I didn't realized that when using a custom
deserializer, the method will be called with null value when the
corresponding value is not present.
Therefore, the method get a null value and the object get created with a
wrong value, make it in an illegal state (this is another bug). And it
cause the error when trying to marshalling to the document.
Regards,
Vairoj
Vairoj A. wrote:
Hi,
I have been using JiBX with my application to persist application
document as XML for a while and everything is working fine. Lately I
found that on "some" document, there is a problem when marshalling,
the following are stacktrace when try to save the document to XML:
Error writing marshalled document
java.io.IOException: Illegal character code 0x0 in content text
at org.jibx.runtime.impl.UTF8StreamWriter.writeTextContent(Unknown
Source)
at org.jibx.runtime.impl.MarshallingContext.element(Unknown Source)
at
com.waveman.campaign.entity.Unit.JiBX_unit_binding_marshal_1_0(Unit.java)
at com.waveman.campaign.entity.JiBX_unit_bindingUnit_access.marshal()
at com.waveman.campaign.entity.Unit.marshal(Unit.java)
at
com.waveman.campaign.jibx.JibxXmlConverter.convertUnitToXml(JibxXmlConverter.java:87)
The document is create withing the application and persist to XML
using JiBX. And then loading the document back to the application
using JiBX again is also correct. But the save (marshalling) process
could no longer be done.
This problem happens to only *some* document. I've attached a very
simple one that cause this problem.
Does anyone have some idea why the problem happens?
Regards,
Vairoj
------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<unit>
<callsign>AAA</callsign>
<side>Blue</side>
<type>Infantry</type>
<level>Division</level>
<chainofcommandsubordinate>
</chainofcommandsubordinate>
</unit>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users