We have an attribute like that in one of our elements. Just include something like the following:
 
        <value name="Type" constant="ADT" usage="optional"/>
 
In our case it is optional - in yours it might not be. Our binding has a value-style="attribute", which is why we didn't have to specify that it was an attribute. As you can see there is no field mentioned, so it has no association with the underlying POJO.
 
-------------------------------------------------------------------
Dan Cooperstock, Senior Software Developer, Quest Software
260 King St. E., Toronto ON Canada  M5A 4L5
[EMAIL PROTECTED]    416-933-5165
 

With Quest Software, you get more ... more performance, more productivity, more value from your IT investments.

Visit www.quest.com to learn more.

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Pradeepta Bhattacharya
Sent: Thursday, August 03, 2006 6:21 AM
To: [email protected]
Subject: [jibx-users] Some clarifications
Importance: High

Hello All,

 

            I have a question please clarify how to do this. I need to create an element with a constant attribute and a value. Example can be

<TravelerInfo Type="ADT">1</TravelerInfo>

            Now “ADT” will remain constant so could it be specified in the JiBX mapping file without having an equivalent attribute in the POJO class? Please explain how to do this kind of structure through JiBX. Thank.

 

Pradeepta

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to