[EMAIL PROTECTED] wrote:
Hello,
I have the following problem: I have to deal with XML messages that are pretty much complient. However some messages contain a "dynamic" part - Let me explain.
The following message is standard and well defined by a XSD - so I have my JiBX mapping that works just well :-)
<message> <user name="cedric"> <age>12</age> <sport>football</sport> <extrainfo> </extrainfo> </user> </message>
However, some messages can look like this:
<message> <user name="cedric"> <age>12</age> <sport>football</sport> <extrainfo> <CITY>paris</CITY> <NBRBROTHERS>2</NBRBROTHERS> <NBRSISTERS>2</NBRSISTERS> </extrainfo> </user> </message>
As you can see, the nested tag '<extrainfo>' may contain any unpredicted tag, in this example "CITY", "NBRBROTHERS" and "NBRSISTERS" are not defined in the XSD and can be anything really - depending on customer's requirements.
I would like to be able to get anything within the tag <extrainfo> and put it as is (the fragment of XML message) into a String object of my mapped bean - later I would use standard DOM to analyse this dynamic part in my code - independently from JiBX.
Now is it possible to put the content of a tag (all its nested tags) into a simple String object in JiBX? If not it really is a pain as I would not be able to use JiBX unless someone has a workaround (?)
May thanks for your support in this great software that JiBX is.
I've come across this requirement as well, except my "extra info" was an HTML formatted document. Doing this requires a custom (un)marshaller.
If you look in the jibx/extra source directory there is a DiscardElementMapper.java and a DomElementMapper.java which should provide a starting point for you.
This isn't difficult, it just requires a little extra code.
-- Thomas Jones-Low Softstart Services Inc. [EMAIL PROTECTED] JobScheduler for Oracle Ph: 802-398-1012 http://www.softstart.com
------------------------------------------------------- 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
