[jdom-interest] Converting from DOM to JDOM

John Muhlestein jmuhlestein at i-link.net
Tue May 15 07:35:53 PDT 2001

I encountered the same problem when I went from beta-5 to beta-6.  Though
I'm not sure I believe it had something to do with the order that Xerces and
JDOM were appearing in my classpath.  Another problem could have been the
version of Xerces that was in the classpath, which was actually an older
version than the one that came with JDOM.


-----Original Message-----
From: Antony Corfield [mailto:Antony.Corfield at las.ox.ac.uk]
Sent: Tuesday, May 15, 2001 5:37 AM
To: 'jdom-interest at jdom.org'
Subject: [jdom-interest] Converting from DOM to JDOM


I'm converting between JDOM and DOM using DOMOutputter to produce
org.w3c.dom.Element for input to Xalan processor which works fine.

    DOMOutputter domOut = new DOMOutputter();
    org.w3c.dom.Element domElement = null;

    try {
      domElement = domOut.output(jdomElement);
    catch (JDOMException e) {

    return domElement;

However, when I try converting the DOM Node, Element or Document back to
JDOM using DOMBuilder:

    DOMBuilder domBuilder = new DOMBuilder();
    org.jdom.Element jdomElement = domBuilder.build(domElement);

I get the following error: org.jdom.IllegalNameException: The name "null" is
not legal for JDOM/XML elements: XML names cannot be null or empty.

I have checked that the DOM Node (getNodeName()) or Element (getTagName())
does indeed have a name! Is this a name space problem, or has anyone found
similar problems?



Antony Corfield                           Java Developer JAFER Project

email: Antony.Corfield at las.ox.ac.uk       Libraries Automation Service
  tel: +44 (01865) 284454                 99 Banbury Rd
  fax: +44 (01865) 278275                 Oxford OX2 6JX

To control your jdom-interest membership:

More information about the jdom-interest mailing list