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]> 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].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.

Reply via email to