It may be possible to provide a "skip unbound elements" feature in the future, but I'm going to need to think it through carefully to make sure I don't end up with something that only works part of the time. The basic approach would be to have the methods in the UnmarshallingContext that match an element name be smart enough to skip over things that don't match. This would need to include both the start tag and end tag matching code. Since I'd suspect most users want the existing behavior (throw an exception on anything unexpected), I'll also need to make this pluggable. Perhaps I'll combine it with a pluggable parser implementation, so that StAX parsers can be used in place of XMLPull parsers. In any cases, it's not a trivial change.
In the meantime, John, you can use an optional empty <structure/> to recognize and discard a particular element name when unmarshalling without generating anything when marshalling. See the table at the top of http://jibx.sourceforge.net/details/structure-element.html for details.
- Dennis
Falk Langhammer wrote:
I have reported this as a feature request in the bug tool.
There is no reason why a "Java-centric" XML-binding framework which is not comitted to the Schema-Hype (i.e., with JiBX's unique selling points) requires every element to be mapped.
There is an escape that subnodes of unmapped elements are indeed ignored. For instance, You may have a declared but unmapped element "description" and put whatever structure You want into it.
However, this is not enough and the requested feature is trivial to implement. Dennis should just do it. I am sure that he does not want to arbitrarily restrict the usefulness of his great work.
Falk
John Crossman wrote:
I'm reading in an XML doc that contains:
<story> <content_type>Previews</content_type>
<description>A really cool game.</description> <download_id/> <editor_name>Andrew Park</editor_name> ....etc....
</story>
Am I required to specify all XML elements in my binding.xml or can I just ignore the elements I don't want. E.g., I don't want 'description' element. Can I just leave it out of my binding.xml altogether? Initial tests seem to imply the answer is No.
John
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
jibx-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jibx-users
