Thank you Dennis,

I grabbed the XML writer and used writeComment() like you suggested.

Cheers



2011/1/21 Dennis Sosnoski
>
> Hi Bob,
>
> You can do this in your own code, by getting the IXMLWriter and calling the 
> writeComment method. You can get the IXMLWriter from the 
> UnmarshallingContext, which is always the implementation class for the 
> IUnmarshallingContext, and you can get the IUnmarshallingContext as a 
> parameter to any user extension method or get/set method (so a method of the 
> form "String getText(IUnmarshallingContext ictx)" will be passed the context 
> when called to get the value).
>
> The only tricky part is how you time the writing of the comment. pre-get 
> methods are called after the start tag of the corresponding element has 
> already been opened, which means they're great for adding namespace 
> declarations or attributes to the element but not a time when you can write 
> comments. So that leaves a get method as pretty much the only alternative. If 
> you want the comment preceding the element you'd need to have the get method 
> check that the corresponding value is actually present, then write the 
> comment before returning the value.
>
>   - Dennis
>
> Dennis M. Sosnoski
> Java SOA and Web Services Consulting
> Axis2/CXF/Metro SOA and Web Services Training
> Web Services Jump-Start
>
> On 01/20/2011 03:10 AM, Bob Smith wrote:
>
> Hi,
>
> Strangely enough, I have not found an answer to this simple question:
> How can I include XML comments to a file when I marshall one of my objects?
>
> I know that JiBX normally ignores comments when unmarshalling documents, but 
> I would like to generate comments on marshalling in order to document 
> specific XML tags.
>
> Has anyone ever done this?
>
> Thanks!
> Bob
>
>
>
>
>
> ------------------------------------------------------------------------------
> Protect Your Site and Customers from Malware Attacks
> Learn about various malware tactics and how to avoid them. Understand
> malware threats, the impact they can have on your business, and how you
> can protect your company and customers by using code signing.
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
>
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to