-1

「&」文字を含む xmlString をアンマーシャリングしたいと考えています。

    XMLInputFactory xif = XmlUtils.newXMLInputFactory();
    String test = "<Res>Abc & Def</Res>";
    StringReader sr = new StringReader(test);
    try {
      XMLStreamReader reader = xif.createXMLStreamReader(sr);
      JAXBContext jaxbContext = JAXBContext.newInstance(BluelineReprintInvoiceResponseData.class);
      Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
      Object o = unmarshaller.unmarshal(reader);
    } catch(Exception ex) {
      ex.printStackTrace();
    }

replace/replaceAll を使用して文字列の「&」文字を置換せずに、文字列をアンマーシャリングする方法はありますか?

4

1 に答える 1