Thanks for the code. This is helpful but would of been the next problem.
What I really need though is a way use that String with the Apache libs. So
that instead of having the Apache libs build the XML. I could pass the XML
stored in a String ,which the below method built, to the Apache libraries.
Does anyone know how to do this?
Thanks.
Peter Roth
Telemetry Technologies Inc.
p: 404.231.0021 ext. 1290
e: [EMAIL PROTECTED]
[EMAIL PROTECTED] Wrote:----
List: soap-dev
Subject: Re: using XML as a string in Java client
From: [EMAIL PROTECTED]
Date: 2001-07-26 13:31:30
Peter,
We're doing exactly what you're trying to do...I would recommend not
building a string and converting to xml...here is a test method that uses
the apache utils package for writing out a dom document to a string....
protected static String getSourceDocument(String aURL) throws Exception {
//Read in an XML file that is hardcoded for testing purposes
DOMParser myparser = new DOMParser();
//myparser.parse(new
InputSource("file:///d:/somedirectory/Version1.0/receiveinventory.XML"));
myparser.parse(new InputSource(aURL));
Document doc = myparser.getDocument();
Element root = doc.getDocumentElement();
//Strip out the carriage reutrns and line feeds (SOAP does NOT like
them)
String lsdoc = DOMWriter.nodeToString(root);
char lsfind = '\r';
char lsreplace = '\u0020';
String lsdoc2 = lsdoc.replace(lsfind,lsreplace);
lsfind = '\n';
lsdoc2 = lsdoc2.replace(lsfind,lsreplace);
//WRAP the string in a CDATA section since SOAP does NOT like strings
with tags...
String ls_read = new String("<![CDATA["+lsdoc2+"]]>");
return ls_read;
}