I would like to canonicalize XML that has a prefix but no namespace defining what the prefix stands for.
Is there a way to programmatically tell a canonicalizer that a prefix "wsu" stands for "xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
Here's the XML:
<wsu:Timestamp wsu:Id="TS-9850525DA06CE28ED91448475206407141"> <wsu:Created>2015-11-25T18:13:26.407Z</wsu:Created> <wsu:Expires>2015-11-25T18:23:26.407Z</wsu:Expires> </wsu:Timestamp> And I tried using org.apache.xml.security.c14n.Canonicalizer, where above XML is stringToCanonicalize
canon = Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_EXCL_WITH_COMMENTS); canonXmlBytes = canon.canonicalize(stringToCanonicalize.getBytes()); But this gives a
org.xml.sax.SAXParseException: The prefix "wsu" for element "wsu:Timestamp" is not bound.
No comments:
Post a Comment