resource.discard();
if (result.getParent() != null) {
result.detach();
}
OMDocumentImpl parent = new OMDocumentImpl(OMAbstractFactory.getOMFactory());
parent.addChild(result);
inputStream.close();
} catch (IOException e) {
log.error("Error while closing the input stream", e);
}
}