[jdom-interest] xml:lang Attribute problem

philip.nelson at omniresources.com philip.nelson at omniresources.com
Thu Sep 28 07:28:50 PDT 2000


I have the version i got on 9/25. The 4 parameter constructor doesn't call
checkAttribute name.  The problem seems to be that in this scenario, the
prefix and name have already be separated.

> -----Original Message-----
> From: Brett McLaughlin [mailto:brett.mclaughlin at lutris.com]
> Sent: Thursday, September 28, 2000 9:31 AM
> To: philip.nelson at omniresources.com
> Cc: dutchman at uswest.net; jdom-interest at jdom.org
> Subject: Re: [jdom-interest] xml:lang Attribute problem
> 
> 
> 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@yourhos
t.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