Hi Joe,

Thanks for the response and the suggestion to re-read the Namespaces
spec (which I have).

> -----Original Message-----
> From: Joseph Kesselman [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 15, 2003 9:15 AM
> To: [EMAIL PROTECTED]
> Subject: Re: empty xmlns attribute
> 
> You've specified several attributes with no prefix and no
> namespace. If there was a default namespace inherited at this point,
> the serializer must generate xmlns="" to clear that default. See the
> Namespaces In XML spec.

I'm a bit confused when you refer to a serializer.  This is not a
document which I've parsed, rather I've created it "from scratch" with
the supplied code.  So, I'm a bit puzzled about where this serializer
(unless there is some "implied" one which I don't know about).

I discovered the extra attribute (xmlns="") because my test code was
trying to nit-pick about ensuring there weren't any additional
attributes beyond those which are expected.  I wrote code to dump the
newly created element.

However, I took your suggestion and changed the attribute namespace
from null to the namespace of the samlp:Request.

...
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(SAMLP_NS, "samlp:Request");
r.setAttributeNS(XMLNS_NS, "xmlns:samlp", SAMLP_NS);
r.setAttributeNS(XMLNS_NS, "xmlns:saml", SAML_NS);
r.setAttributeNS(XMLNS_NS, "xmlns:ds", XMLSIG_NS);
r.setAttributeNS(SAMLP_NS, "MajorVersion", "1");     // changed namespace
r.setAttributeNS(SAMLP_NS, "MinorVersion", "0");     // changed namespace
r.setAttributeNS(SAMLP_NS, "RequestID", requestId);  // changed namespace
SimpleDateFormat formatter = new
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");

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

Thanks,
David
--
Obligatory .signatory
David Warren
RSA Security Inc., 174 Middlesex Turnpike, Bedford, MA 01730

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to