Posted By:
Todd_Goglia
Posted On:
Tuesday, May 8, 2001 10:52 AM
I am trying to get a String from the contents of a node using the JAXP 1.1 classes. I have successfully made the trasformation, but the transform is tacking the XML declaration ( <?xml versions=1.1>) onto the beginning of my String, which I don't want to happen. How do I stop it from doing this? Todd Here is the code: DOMSource source; TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(); StringWriter sw=new StringWrite(); StreamResult result = new StreamResult(sw); source=new DOMSource(node); transformer.transform(source, result); StringBuffer sb=sw.getBuffer()
More>>
I am trying to get a String from the contents of a node using the JAXP 1.1 classes. I have successfully made the trasformation, but the transform is tacking the XML declaration (
<?xml versions=1.1>) onto the beginning of my String, which I don't want to happen. How do I stop it from doing this?
Todd
Here is the code:
DOMSource source;
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
StringWriter sw=new StringWrite();
StreamResult result = new StreamResult(sw);
source=new DOMSource(node);
transformer.transform(source, result);
StringBuffer sb=sw.getBuffer();
return new String(sb);
<<Less