0

Due to some classpath issues, I'm removing the Maven dependency to Xerces from my application. As I understand it, that is no longer needed as it is in the JRE. However, when compiling a junit that uses org.apache.xml.serialize.OutputFormat and org.apache.xml.serialize.XMLSerializer, those imports are no longer found.

Should I add Xerces as "provided" scope or are these classes not provided in the JRE? Are Xerces and other libraries packaged into other JARs in the JRE? I couldn't find it on the file system so I'm not sure which version to use in Maven provided dependency.

user994165
  • 9,146
  • 30
  • 98
  • 165

1 Answers1

0

The preferred solution seems to be to only use the Java APIs, so I removed org.apache.xml.serialize.OutputFormat and used the following for formatting:

final TransformerFactory tf = TransformerFactory.newInstance();
final Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

Now I no longer need the Xerces dependency at all.

user994165
  • 9,146
  • 30
  • 98
  • 165