public static void circumventBug2650(Document doc){
  Element documentElement=doc.getDocumentElement();
  Attr xmlnsAttr=documentElement.getAttributeNodeNS(Constants.NamespaceSpecNS,"xmlns");
  if (xmlnsAttr == null) {
    documentElement.setAttributeNS(Constants.NamespaceSpecNS,"xmlns","");
  }
  XMLUtils.circumventBug2650internal(doc);
}

public static void circumventBug2650 ( Document doc ) { Element documentElement = doc . getDocumentElement ( ) ; Attr xmlnsAttr = documentElement . getAttributeNodeNS ( Constants . NamespaceSpecNS , "xmlns" ) ; if ( xmlnsAttr == null ) { documentElement . setAttributeNS ( Constants . NamespaceSpecNS , "xmlns" , "" ) ; } XMLUtils . circumventBug2650internal ( doc ) ; }
this method spreads all namespace attributes in a dom document to their children . this is needed because the xml signature xpath transform must evaluate the xpath against all nodes in the input , even against xpath namespace nodes . through a bug in xalanj2 , the namespace nodes are not fully visible in the xalan xpath model , so we have to do this by hand in dom spaces so that the nodes become visible in xpath space .
