Hello , with CDATA i mean this adding this <![CDATA[ textvalue ]]> to a xml value like this
<message><![CDATA[ some embedded & xml</data>]]></message> currently i was able to the <![CDATA[ ]]> but the problem is the still jersey jaxb in dropwizard is still escaping it so it ends up like this: <message>\<![CDATA[Welcom some embedded & xml</data]]>></message> and to answer you why i need that: its because when an xml has this section it can use characters '&' without the need to be converted to & for example so its not the same, also this end xml is going to be consumed by other system which we had no way to modify. thanks for your answer :D On Friday, March 16, 2018 at 1:17:36 PM UTC-5, Tatu Saloranta wrote: > > It would help if you explained in bit more detail what you try to achieve > here. > Term "cdata", for example, has at least 2 meanings with XML (generally, > "character data" for text contained; as well as CDATA sections > for manual escaping -- rarely produced by generators, and having no > semantic difference from 'regular' textual content). > > And if you are trying to force use of CDATA sections, follow-up question > would be ... why? Given that it is not different, semantically, > from other text segments. It's just a convenience feature if manually > modifying xml content, and processing systems are not allowed to > treat it any differently. > > -+ Tatu +- > > On Fri, Mar 16, 2018 at 8:57 AM, David Aranda <[email protected] > <javascript:>> wrote: > >> Hello everyone , in the project i am working on, i need to add cdata to >> end result xml, since DropWizard uses jersey and it uses JAXB i was reading >> some articles about how to read , i successfully added the CDATA part by >> using a custom XmlAdapter but then end result was still being escaped , i >> was looking for a way to do that and i found this code but i don't know how >> to configure that on Dropwizard >> >> writer = new BufferedWriter(new FileWriter(selectedFile)); >> context = JAXBContext.newInstance(Book.class); >> Marshaller m = context.createMarshaller(); >> m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); >> >> m.setProperty("com.sun.xml.internal.bind.characterEscapeHandler", >> new CharacterEscapeHandler() { >> @Override >> public void escape(char[] ch, int >> start, int length, >> boolean isAttVal, >> Writer writer) >> throws IOException { >> writer.write(ch, start, length); >> } >> }); >> >> >> also i've tried add a custom JAXBContext like is explained here: >> >> https://automationrhapsody.com/rest-performance-problems-with-dropwizard-and-jersey-jaxb-provider/ >> >> and in the run method of my application i have this code >> >> >> final Client client = new JerseyClientBuilder(environment) >> >> .using(configuration.getJerseyClientConfiguration()) >> >> .withProvider(CustomJAXBContextConfiguration.class) >> >> .using(environment) .build(getName()); >> >> client.property(CharacterEscapeHandler.class.getName(),new >> CDataCharacterEscapeHandler()) ; >> >> environment.jersey().property(CharacterEscapeHandler.class.getName(),new >> CDataCharacterEscapeHandler()) ; >> >> environment.jersey().register(client); >> environment.jersey().register(CustomJAXBContextConfiguration.class); >> >> >> but it doesn't work either, >> >> >> >> is there a way to add a property to the marshaller jersey in Dropwizard is >> using ? or how i can achieve that >> >> thank you to all of you >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "dropwizard-user" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- The information contained in this e-mail may be confidential. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution or copying of this communication, or any of its contents, is strictly prohibited. If you have received it by mistake please let us know by e-mail immediately and delete it from your system. Many thanks. La información contenida en este mensaje puede ser confidencial. Ha sido enviada para el uso exclusivo del destinatario(s) previsto. Si el lector de este mensaje no fuera el destinatario previsto, por el presente queda Ud. notificado que cualquier lectura, uso, publicación, diseminación, distribución o copiado de esta comunicación o su contenido está estrictamente prohibido. En caso de que Ud. hubiera recibido este mensaje por error le agradeceremos notificarnos por e-mail inmediatamente y eliminarlo de su sistema. Muchas gracias. -- You received this message because you are subscribed to the Google Groups "dropwizard-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
