schemaNode.appendChild(copyElement);
}
}
}
DOMImplementationRegistry registry;
try {
registry = DOMImplementationRegistry.newInstance();
} catch (ClassCastException e) {
String msg = e.getMessage();
logger.error(msg, e);
throw new LDPathException(msg, e);
} catch (ClassNotFoundException e) {
String msg = e.getMessage();
logger.error(msg, e);
throw new LDPathException(msg, e);
} catch (InstantiationException e) {
String msg = e.getMessage();
logger.error(msg, e);
throw new LDPathException(msg, e);
} catch (IllegalAccessException e) {
String msg = e.getMessage();
logger.error(msg, e);
throw new LDPathException(msg, e);
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DOMImplementationLS lsImpl = (DOMImplementationLS) registry.getDOMImplementation("LS");
LSSerializer lsSerializer = lsImpl.createLSSerializer();
LSOutput lsOutput = lsImpl.createLSOutput();
lsOutput.setEncoding("UTF-8");
lsOutput.setByteStream(baos);
lsSerializer.write(document, lsOutput);