This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Problem saving XML doc due to NoSuchMethodError... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Problem saving XML doc due to NoSuchMethodError..." Watch "Problem saving XML doc due to NoSuchMethodError..." New topic
Author

Problem saving XML doc due to NoSuchMethodError...

Lee Wallen
Greenhorn

Joined: Jul 14, 2001
Posts: 10
I have some code that runs on one machine, but not on another. The JDK versions are nearly identical (one minor revision difference).

Version of JDK on machine where the code works:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_07-b02)

Version of JDK on machine where the code does not work:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_06-b01)

My assumption is that there is a classpath issue which causes the wrong version of a class to be loaded.

Does anyone know which JAR file I should be looking for, and/or does anyone recognize this error and know how to troubleshoot it?

I'm getting the following exception:

Exception in thread "main" java.lang.NoSuchMethodError: org.w3c.dom.Document.getXmlStandalone()Z
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127)
at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:663)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:709)
at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
at com.gettyimages.util.tools.ConfigUtil.convertXmlDocToString(ConfigUtil.java:186)


This is the method where the error is occuring:

/**
* Converts an XML Document to a String.
*
* @param doc An XML Document.
* @return The content of the XML Document as a String.
*/
public String convertXmlDocToString(Document doc) throws Exception {

TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty("omit-xml-declaration", "no");
StringWriter sw = new StringWriter();
StreamResult result = new StreamResult(sw);
DOMSource source = new DOMSource(doc);
transformer.transform(source, result);
return sw.getBuffer().toString();
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem saving XML doc due to NoSuchMethodError...