[jdom-interest] xmlns attributes

Kevin Regan kevinr at valicert.com
Fri Jun 30 17:58:08 PDT 2000


I noticed the following code (b4) that parses namespaces:

(DOMBuilder.buildTree)

if (att.getNodeName().startsWith("xmlns")) {
   String prefix;
   String uri = att.getNodeValue();
   int colon;
   if ((colon = att.getNodeName().indexOf(":")) != -1) {
      prefix = att.getNodeName().substring(colon + 1);
   } else {
      prefix = "";
   }
...

This brings up a question.  Is the following a legal attribute:

<FOO xmlnsbar="something">...

I'm not sure if it is.  But you might want to change the above
code to explicitly check for an equals("xmlns") when assigning
the prefix "".  If it does not equals("xmlns") and does not
have a ':' character, do not treat it as a namespace declaration.

--Kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2979 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20000630/4b39d4ae/smime.bin


More information about the jdom-interest mailing list