[jdom-interest] Forcing a CDATA section

Jason Hunter jhunter at servlets.com
Wed Mar 31 11:50:29 PDT 2010


There's an org.jdom.CDATA class which you can use in the object model to dictate you want a CDATA section output in that area.  I believe (by reading the JDOM source) that CDATA instances are created for you via SAXBuilder also, if your source XML has CDATA sections.

-jh-

On Mar 31, 2010, at 8:22 AM, Richard Gaywood wrote:

> Hi there.
> 
> I am using JDOM to integrate with an API provided to me by a big travel firm. My integration was working fine for my test cases, but failed QA when the tester tried something different. I've now been told by the travel firm that instead of sending
> 
> <Key>N GBTM00423004Z</Key> 
> I need to send
> <Key><![CDATA[N GBTM00423004Z]]></Key> 
> 
> Googling has only turned up flamewars on this mailing list about this issue, and I cannot see anything about it in the JDOM API docs. So I ask: is there currently a way to force JDOM to use a CDATA section for a given tag, even where it shouldn't really be necessary?
> 
> And before anyone starts another flamewar, I know this is dumb, I know this isn't clean XML, but the travel firm is a big multinational with a hojillion employees that makes zillions of dollars a year. My employer is a small ecommerce outfit. I cannot make them change this, as much as I would like to. It could be worse; one of their competitors we wrote a connector to only supports socket connections that take EDIFACT encoded strings, and they ship us a closed-source binary C library to enable us to talk to the service. Integrating Java into that was a barrel of laughs.
> 
> Cheers!
> 
> Richard
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20100331/bee2038d/attachment.htm


More information about the jdom-interest mailing list