Java Mailing List Archive

http://www.junlu.com/

Home » JDOM Projects »

[jdom-interest] Content missing after conversion from W3C Element
 to JDOM2 Element

Larsen

2012-11-07

Replies: Find Java Web Hosting

Author LoginPost Reply
Hi,

I am quite a JDOM2 newbie and noticed strange/incorrect behaviour when
converting a W3C-Element to a JDOM-Element. Though, I can´t imagine that
this really is a bug as I guess that somebody else would have noticed and
probably fixed this before. Also, I couldn´t find other people having this
problem. So, at the moment I would rather think that I am doing something
wrong here.


This is the part that I want to convert from W3C to JDOM stored in the
variable "table":

<tbody>
  <tr id="0">
    <td id="0">
      <img>RTEmagicC_pdf_icon.png.png</img>
    </td>
  </tr>
</tbody>


This is my code:
  DOMBuilder domBuilder = new DOMBuilder();
  Element jdomTable = domBuilder.build(table).detach();


After this conversion, I have a JDOM element with the correct structure,
but the content from the img-tag is missing.
I fixed this problem by importing the JDOM source into my project and
changing this method:

  public org.jdom2.Text build(org.w3c.dom.Text text) {
     // BUG ???
     // return factory.text(text.getTextContent());
     return factory.text(text.getNodeValue());
  }


Could anyone please shed some light if this is a bug or a mistake on my
side?


Lars
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.