[jdom-interest] Attribute namespaces

Kevin Stadlmayer kstadlmayer at mpowertech.com
Thu Oct 5 11:10:05 PDT 2000


I have tried the latest code in CVS.  All that I got was a slightly
different error message:

"The name "b:dt" is not legal for JDOM/XML attributes: Attribute names
cannot contain colons."

instead of

"The name "b:dt" is not legal for JDOM/XML attributes: : is not allowed in
XML names.."

I have also tried this with Sun's Project X stuff
(com.sun.xml.tree.XmlDocument, etc.), and I received the same error as when
using Xerces.  Whether I try it this way (again, assuming that we have a
proper XML document in the form of a String, xml):


         StringReader reader = new StringReader(xml);
         InputSource input = new InputSource(reader);
         XmlDocument firstDoc = XmlDocument.createXmlDocument(input, false);

         // convert XmlDocument to JDOM Document to allow for easier
manipulation
         DOMBuilder dom = new
DOMBuilder("org.jdom.apapters.ProjectXAdapter");
         org.jdom.Document finalDoc = dom.build(
(org.w3c.dom.Document)firstDoc );

or

         StringReader reader = new StringReader(xml);
         InputSource input = new InputSource(reader);
         org.apache.xerces.parsers.DOMParser parser = new
org.apache.xerces.parsers.DOMParser();
         parser.setFeature("http://xml.org/sax/features/validation", true);
         parser.setFeature("http://xml.org/sax/features/namespaces", true);
         parser.parse(input);
         org.w3c.dom.Document firstDoc = parser.getDocument();

         // convert XmlDocument to JDOM Document to allow for easier
manipulation
         DOMBuilder dom = new
DOMBuilder("org.jdom.adapters.XercesDOMAdapter");
         org.jdom.Document finalDoc = dom.build(
(org.w3c.dom.Document)firstDoc );

it all ends up the same.  Am I enabling namespace support properly?  The
SAXParseException is always getting thrown at dom.build().

I will try to investigate this further, and let you know what develops.


Kevin Stadlmayer

-----Original Message-----
From: Jason Hunter [mailto:jhunter at collab.net]
Sent: Thursday, October 05, 2000 9:09 AM
To: Kevin Stadlmayer
Cc: 'jdom-interest at jdom.org'
Subject: Re: [jdom-interest] Attribute namespaces


> Has anyone seen this before?  Is this something that may have 
> been fixed for
> Beta 5?  Or am I just using it plain wrong?



More information about the jdom-interest mailing list