[jdom-interest] Namespace problems in Attributes...

John Pearcey johnp at mmconsultants.demon.co.uk
Fri Jul 28 02:17:21 PDT 2000


Thanks for your help - yes I'm using the latest CVS code.

The problem is that I don't know enough about namespaces to understand what
the code should be doing but here are the details that may mean more to you
than me:

The method startElement() in SAXBuilder.SAXHandler is called and an attept
is made at creating an attribute inside the 'if' clause:
    if (!attName.startsWith("xmlns")) {

obviously in response to finding xml:lang="en".

The four Attribute constuctor values are:
name = 'lang'
prefix = 'xml'
uri = [empty string]
val = 'en'

the uri has been retrieved from a call to getNamespaceURI( prefix )

The Attribute constructor then tries to create a Namespace object by calling
Namespace.getNamespace( prefix, uri ) which is the method that throws the
exception.


-----Original Message-----
From: Jason Hunter <jhunter at acm.org>
To: John Pearcey <johnp at mmconsultants.demon.co.uk>
Cc: JDOM <jdom-interest at jdom.org>
Date: 27 July 2000 19:40
Subject: Re: [jdom-interest] Namespace problems in Attributes...


>You are using the CVS code, right?
>
>I suggest you use a debugger or add an out.println() to the Namespace
>code to see exactly what it's doing.  Find out what prefix/uri pair it
>is choking on.  Figure out if it's getting confused somewhere.
>
>-jh-
>
>John Pearcey wrote:
>>
>> I used the SAXBuilder with the Apache parser and get the following error:
>>
>> org.jdom.IllegalNameException: The name "" is not legal for JDOM/XML
>> namespaces: Namespace URIs must be non-null and non-empty Strings..
>>
>> whilst parsing a document that includes the following line:
>>
>> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
>>
>> It seems to be the xml:lang="en" that gives the builder a problem. Any
ideas
>> ?
>>
>> _______________________________________________
>> To control your jdom-interest membership:
>>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>_______________________________________________
>To control your jdom-interest membership:
>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho
st.com




More information about the jdom-interest mailing list