Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

How to insert CDATA in an XmlBean tag!

Thread view: 
Francesco - 04 Apr 2007 16:20 GMT
Hello,

I have a problem using XmlBean with special characters. I don't want
to convert special characters, but leave it using CDATAelement.

If I try in my code to use :
//the object Description is an object of my xsd sxhema given by
XmlBean.
...
Descriptions.Description tagDescription =
tagHotelInfo.addNewDescriptions().addNewDescription();
tagDescription.setLanguage("it");
tagDescription.addNewText().setStringValue("<![CDATA[" +(String)
resulSet[13]+ "]]>");
...

My output xml like this:
<Descriptions>
         <Description Language="it">
           <Text>&lt;![CDATA[L?Hotel Novotel Vienna Ovest è ubicato
nell?ovest di Vienna, vicino all?autostrada A1. Questo bell?albergo si
trova a soli 10 minuti dal castello.È possibile ottenere il servizio
di baby sitter su richiesta di quei genitori che vogliano andare in
gita turistica e passare il tempo insieme. Per chi viaggia per lavoro
ci sono: connessioni internet, fax, copiatrice e stampatrice. Le
attività ricreative dei dintorni includono una pista per jogging,
tennis da tavolo ed un campo da pallavolo.    ]]&gt;</Text>
         </Description>
</Descriptions>

As you can see "<![CDATA[" is convert in "&lt;![CDATA[". Why?
How can I do?

Thanks for all help,
Francesco
Daniel Pitts - 05 Apr 2007 01:29 GMT
> Hello,
>
[quoted text clipped - 31 lines]
> Thanks for all help,
> Francesco

Why do you want to add CDATA? The text is escaped automatically for
you, so you don't need/want <![CDATA[ escaping.
Francesco - 06 Apr 2007 11:16 GMT
> > Hello,
>
[quoted text clipped - 36 lines]
>
> - Mostra testo tra virgolette -

Yes, but..
the character "'"  is converted with "?" !!

How can I reconvert these characters?
Is there any java escape functions?
Daniel Pitts - 06 Apr 2007 16:51 GMT
> > > Hello,
>
[quoted text clipped - 42 lines]
> How can I reconvert these characters?
> Is there any java escape functions?

Hmm... Are you sure that the "'" is converted to "?"?  Can you post an
sscce so that we can better help you?

<http://www.physci.org/codes/sscce/>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.