You have two things to check. First, the variable XMLSignature.XMLNS should contain the correct namespace URI for the node you're looking for. That should be "http://www.w3.org/2000/09/xmldsig#".
And second,
you should be creating a parser which is namespace-aware. By default the DocumentBuilderFactory produces parsers which aren't namespace-aware (a puzzling decision by the implementers but now that they documented the decision it's very hard to change) so you should be calling its setNamespaceAware() method.