[jdom-interest] getAttribute(String nameOfAttribute)
Brett McLaughlin
brett.mclaughlin at lutris.com
Thu Aug 31 15:35:05 PDT 2000
Jaap.Botman at nl.abnamro.com wrote:
>
> I have downloaded the sources from Brett McLaughlins article 'Make classes
> from XML data'
> (http://www-4.ibm.com/software/developer/library/data-binding2/index.html?dwzone=xml)
>
> I can properly compile it using JDK1.2 and the Build 4 of JDOM on Windows NT.
> However, if I run it with the example Schema document I get
> NoSuchAttributeException's on 'getAttribute(nameOfAttribute)' statements
> although the attribute is there.
> For example:
>
> type = complexType.getAttribute("name").getValue();
>
> results in a NoSuchAttributeException
>
> But if I replace this code by the following, 'type' will be assigned the proper
> value:
>
> String type = null;
> List l = complexType.getAttributes();
> for (Iterator i = l.iterator(); i.hasNext(); )
> {
> Attribute attr = (Attribute)i.next();
> if (attr.getName().equals("name"))
> type = attr.getValue();
> }
>
> After I made similar adjustments to all the occurences of 'getAttribute(
> nameOfAttribute)' the resulting Java app works
> fine and produces the expected result.
>
> Is this problem known by anyone?
Jaap-
That article was written about two months ago, and as you found out,
some things have changed in JDOM since then. The new article, Part 3,
should be out any day now, and it includes an updated code base that
works with the latest JDOM from CVS. Sorry about the confusion ;-)
-Brett
>
> regards, Jaap Botman
>
> _______________________________________________
> 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