A JAXP problem


XML & Web services: A JAXP problem

  1. A JAXP problem (1 messages)

    I wrote code to convert a xml document to its string equivalent. Now the problem is that JAXP converts all my & to & I don't want this conversion. Any suggestions? The code is as follows: private byte[] xmlToString(byte[] metadataXMLData) { byte[] updatedMetaDataXMLData = null; try { ByteArrayInputStream bais = new ByteArrayInputStream(metadataXMLData); DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = builderFactory.newDocumentBuilder(); org.w3c.dom.Document metadataXMLDoc = docBuilder.parse(bais); StringWriter sw = new StringWriter(); TransformerFactory xformFactory = TransformerFactory.newInstance(); Transformer idTransform = xformFactory.newTransformer(); Source input = new DOMSource(metadataXMLDoc); Result output = new StreamResult(sw); idTransform.transform(input, output); updatedMetaDataXMLData = sw.toString().getBytes(); } catch (Exception e) { e.printStackTrace(); } return updatedMetaDataXMLData; }

    Threaded Messages (1)

  2. RE: A JAXP problem[ Go to top ]

    Nevermind Guys.. looks like it is not possible to tell JAXP to somehow generate invalid XML. I took care of my problem some other way