Java JAXB escape special characters in hexadecimal

1

I'm trying to escape special characters for a request in XML using Marshaller from JAXB and I need the values to arrive at destination with the escape in hexadecimal.

The problem is that it does in decimal, I already tried several charset and all Unicode do it in decimal. The idea is to do the direct escape from jaxb without manipulating strings, that is, I can not use StringUtils.escape() or StringEscapeUtils.escapeXml()

jaxbContext = JAXBContext.newInstance(new Class[] 
{solicitud.getClass()});
        Marshaller jaxbMarshaller = jaxbContext.createMarshaller();

        jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        jaxbMarshaller.setProperty("com.sun.xml.bind.xmlDeclaration", true);
        jaxbMarshaller.setProperty(Marshaller.JAXB_ENCODING, "US-ASCII");

        StringWriter writer = new StringWriter();
        jaxbMarshaller.marshal(solicitud, writer);
        String salida = writer.toString();
        Log.info(getClass(), salida);

Greetings

    
asked by Darius 24.10.2018 в 18:35
source

0 answers