Document schemaDoc =
null;SAXBuilder builder =
new SAXBuilder(false);String resultingXML =
null; if(!StringUtils.isEmpty(xmlString)){ try{schemaDoc =
builder.build(
new StringReader(xmlString));}
catch(JDOMException jdomex){ throw new Exception("Document could not be built: " + jdomex);}
}
else{log.info(
"xmlString is null");}
return schemaDoc;}
********************************************************************************
It is working fine on Windows (2000) machine, but spitting "?" symbols in place of special chars on UNIX machines.
I used to use schemaDoc = builder.build(new java.io.ByteArrayInputStream(xmlString.getBytes()));
to build the document in place of StringReader, but it was changing the encoding and throwing exception saying the special
chars don't belong to UTF-8. So, i changed it to StringReader - which doesn't throw exceptions but, converts the special chars to "?".
I also tried using builder.build(new java.io.ByteArrayInputStream(xmlString.getBytes(
"UTF-8"
)));
. But that din't help too.
Again, "?" are occuring only in UNIX machines, but works fine on Windows machines.
I would appreciate any help.
Thank you,
pramodh.