[jdom-interest] Possible bug in org.jdom.Element in Beta 7 detected
Stein Erik Berget
seberget at a.sol.no
Thu Sep 20 15:15:05 PDT 2001
Hello fellow jdom users and jdom developers.
Please disregard this mail if this subject have been covered before. If
you please then could point me to where I can find the previous
discussion regarding this I would be really happy!
I have trouble with the following method in org.jdom.Element: public
String getAttributeValue(String name, Namespace ns)
I have a xml document that have a element that looks like this:
<content:format
rdf:resource="http://www.isi.edu/in-notes/iana/assignments/media-types/text/plain"
/>
When I try to access rdf:resource with the method mentioned I always get
a null value returned from the function. If i remove rdf: and only try
to access the resource part this works beautifully.
This error only appears when I use beta 7 code. When I use beta 6 code
this works like a charm. I have checked both CVS at www.jdom.org to see
if there have been checked in updates of this in later updates, but I
have not been able to spot these. I also tried to search the mails to
this list to see if other persons have had trouble with it. I have also
tried to get the value from the Attribute object as well, but the result
is the same.
Here is some sample code:
//some initializing code cut away
Namespace contentNS =
pParent.getDocument().getRootElement().getNamespace("content");
Namespace rdfNS =
pParent.getDocument().getRootElement().getNamespace("rdf");
Element encoding = parentElement.getChild("encoding",
contentNS);
//Method 1
Attribute attribute = encoding.getAttribute("resource",
rdfNS);
String test1 = attribute.getValue();
//Method 2
String test2 = encoding.getAttributeValue("resource", rdfNS);
//print to see the value, gives null on all ocations with beta
7 code
System.out.println("Method 1: " + test1);
System.out.println("Method 2: " + test2);
...another piece
Hope you can help me with this. At the moment I have "downgraded" to
have my components work, but I really would like to have Beta 7 running!
Have a really great day/night, and thanks for any help!
--
Stein Erik Berget + 47 22 58 38 29 (direct)
Center of Excellence, Site Technology + 47 40 21 38 29 (mobile)
Scandinavia Online (SOL) + 47 22 58 38 00 (switchboard)
Postboks 1178 Sentrum + 47 22 02 09 77 (fax)
N-0107 OSLO http://www.sol.no/
More information about the jdom-interest
mailing list