[jdom-interest] xml:lang Attribute problem
Brett McLaughlin
brett.mclaughlin at lutris.com
Thu Sep 28 07:30:40 PDT 2000
Are you sure? The latest version from CVS:
public Attribute(String name, String value, Namespace namespace) {
String reason;
if ((reason = Verifier.checkAttributeName(name)) != null) {
throw new IllegalNameException(name, "attribute", reason);
}
if (namespace == null) {
namespace = Namespace.NO_NAMESPACE;
}
this.name = name;
setValue(value);
this.namespace = namespace;
}
which is called from the otehr constructors. And checkAttributeName:
public static final String checkAttributeName(String name) {
// Check basic XML name rules first
String reason;
if ((reason = checkXMLName(name)) != null) {
return reason;
}
// Allow xml:space and xml:lang as special cases
if (name.equals("xml:space") ||
name.equals("xml:lang")) {
return null;
}
// Otherwise, no colons are allowed,
// since attributes handle this internally
if (name.indexOf(":") != -1) {
return "Attribute names cannot contain colons";
}
// If we got here, everything is OK
return null;
}
Which would seem to do the right thing. Is this the latest CVS?
Trying to track this down...
-Brett
philip.nelson at omniresources.com wrote:
>
> You are right, there is a bug. I have tracked it down as far as the
> Attribute constructor which doesn't use the bug fix Jason put in. I am at
> work so I can't fix it now but it shouldn't be to difficult. I will also
> add tests for all the constructors at Attribute for xml:lang since that is
> allowable.
>
> public Attribute(String name, String prefix, String uri, String value) {
> this(name, value, Namespace.getNamespace(prefix, uri));
> }
> called from ...
>
> SAXHandler.startElement
> <snip>
>
> } else {
> element.addAttribute(
> new Attribute(name,
> prefix,
> getNamespaceURI(prefix),
> atts.getValue(i)));
> }
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
--
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc.
1200 Pacific Avenue, Suite 300
Santa Cruz, CA 95060 USA
http://www.lutris.com
http://www.enhydra.org
More information about the jdom-interest
mailing list