You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by "Warren, David" <dw...@rsasecurity.com> on 2003/04/16 21:54:14 UTC

Why is there an extra attribute which isn't displayed?

Hi,

When I run the following Element through the canonicalizer my test code
finds
an additional attribute is added (xmlns="").  However, the output text
doesn't
contain this additional attribute.  Can some kind soul explain why this is
happening?

...
public final static String XML_NS = "http://www.w3.org/XML/1998/namespace";
public final static String XMLNS_NS = "http://www.w3.org/2000/xmlns/";
public final static String SAMLP_NS =
"urn:oasis:names:tc:SAML:1.0:protocol";
public final static String SAML_NS =
"urn:oasis:names:tc:SAML:1.0:assertion";
public final static String XMLSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
...
Element r = doc.createElementNS(XML.SAMLP_NS, "samlp:Request");
r.setAttributeNS(XMLNS_NS, "xmlns:samlp", XML.SAMLP_NS);
r.setAttributeNS(XMLNS_NS, "xmlns:saml", XML.SAML_NS);
r.setAttributeNS(XMLNS_NS, "xmlns:ds", XML.XMLSIG_NS);
r.setAttributeNS(null, "MajorVersion", "1");
r.setAttributeNS(null, "MinorVersion", "0");
r.setAttributeNS(null, "RequestID", requestId);
SimpleDateFormat formatter = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
r.setAttributeNS(null, "IssueInstant", formatter.format(issueInstant));
...

TIA,
David
--
Obligatory .signatory
David Warren       phone: 781-515-7152
RSA Security Inc., 174 Middlesex Turnpike, Bedford, MA 01730
dwarren@rsasecurity.com




Re: Why is there an extra attribute which isn't displayed?

Posted by Christian Geuer-Pollmann <ge...@nue.et-inf.uni-siegen.de>.
Hi,

that's a 'trick' to get Xalan handle all XPathes for namespace nodes 
correctly. In XMLUtils.circumventBug2650(Document), I do replicate all 
namespace 'attributes', even those which are do undefine the default 
namespace. This namespace explosion is necessary in order to circumvent the 
Xalan bug which is documented under 
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2650>.

Christian

--On Mittwoch, 16. April 2003 15:54 -0400 "Warren, David" 
<dw...@rsasecurity.com> wrote:

> Hi,
>
> When I run the following Element through the canonicalizer my test code
> finds
> an additional attribute is added (xmlns="").  However, the output text
> doesn't
> contain this additional attribute.  Can some kind soul explain why this is
> happening?
>
> ...
> public final static String XML_NS =
> "http://www.w3.org/XML/1998/namespace"; public final static String
> XMLNS_NS = "http://www.w3.org/2000/xmlns/"; public final static String
> SAMLP_NS =
> "urn:oasis:names:tc:SAML:1.0:protocol";
> public final static String SAML_NS =
> "urn:oasis:names:tc:SAML:1.0:assertion";
> public final static String XMLSIG_NS =
> "http://www.w3.org/2000/09/xmldsig#"; ...
> Element r = doc.createElementNS(XML.SAMLP_NS, "samlp:Request");
> r.setAttributeNS(XMLNS_NS, "xmlns:samlp", XML.SAMLP_NS);
> r.setAttributeNS(XMLNS_NS, "xmlns:saml", XML.SAML_NS);
> r.setAttributeNS(XMLNS_NS, "xmlns:ds", XML.XMLSIG_NS);
> r.setAttributeNS(null, "MajorVersion", "1");
> r.setAttributeNS(null, "MinorVersion", "0");
> r.setAttributeNS(null, "RequestID", requestId);
> SimpleDateFormat formatter = new
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
>
> formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
> r.setAttributeNS(null, "IssueInstant", formatter.format(issueInstant));
> ...
>
> TIA,
> David
> --
> Obligatory .signatory
> David Warren       phone: 781-515-7152
> RSA Security Inc., 174 Middlesex Turnpike, Bedford, MA 01730
> dwarren@rsasecurity.com
>
>
>