The other issue, generating empty tags, is something that would require a change to the marshalling API. I'm planning changes to this anyway, though, in order to simplify the generated code (mainly by eliminating the return value for all the marshalling methods, but I'm also considering adding special methods for the common case of no-namespace elements and attributes). I also find the use of a start tag followed immediately by an end tag annoying - this shows up with the binding generation tools, where a <structure> will always come out as the pair of tags, even when there are no child elements. Even though XML considers the two cases to be identical it just doesn't look nice.
- Dennis
Thomas Jones-Low wrote:
Poole, Paul wrote:
I apologize if this is discussed elsewhere; I tried finding a solution to my problem, but to no avail.
When marshalling to produce xml from my objects, if a String is null, then a NullPointerException is thrown. I found that if I set usage="optional", then the exception went away, but an empty tag was not output to the xml. I thought that if I then provided a default value, then that default would be used when a null String was encountered.
My mapping xml looks like this:
<value name="IssueAge" field="issueAge" usage="optional" default="" />
I've ended up with this same problem at one time. We needed to use a custom unmarshaller method to support this. It wasn't difficult, but by default JiBX refuses to output empty elements.
There is no way to get JiBX to issue a consolidated empty element. This is due to the method which JiBX generates the unmarshalled text.
I believe I've added the first to the old bug requests, but have not looked to see if it's in the new bug request system.
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ jibx-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
