@SuppressWarnings("unchecked")
public static Element toDOM(OMElement element, Document doc, boolean deepNS) throws AxisFault {
final Element domElement = doc.createElementNS(element.getQName().getNamespaceURI(), element.getQName().getLocalPart());
if (deepNS) {
NSContext nscontext = new NSContext();
buildNScontext(nscontext, element);
DOMUtils.injectNamespaces(domElement,nscontext);
} else {
if (element.getAllDeclaredNamespaces() != null) {
for (Iterator<OMNamespace> i = element.getAllDeclaredNamespaces(); i.hasNext(); ) {