if (ds.getNode() instanceof Document) {
rootElement = ((Document)ds.getNode()).getDocumentElement();
} else {
rootElement = (Element)ds.getNode();
}
StaxValidationManager svm = message.getExchange().getBus().getExtension(StaxValidationManager.class);
if (svm != null) {
//filter xop node
XMLStreamReader reader = StaxUtils.createXMLStreamReader(ds);
XMLStreamReader filteredReader =
StaxUtils.createFilteredReader(reader,
new StaxStreamFilter(new QName[] {XOP}));
XMLStreamWriter nullWriter = StaxUtils.createXMLStreamWriter(new NUllOutputStream());
svm.setupValidation(nullWriter, message.getExchange().getService().getServiceInfos().get(0));
StaxUtils.copy(filteredReader, nullWriter);
} else {
//MSV not available, use a slower method of cloning the data, replace the xop's, validate
LOG.fine("NO_MSV_AVAILABLE");
Element newElement = rootElement;