Getting DOM from StructuredTextEditor [message #213305] |
Tue, 06 May 2008 09:32  |
Eclipse User |
|
|
|
Is there an easy way to get a org.w3c.dom document out of a
StructuredTextEditor using eclipse's built in xml classes. The selection
providers do use some XML/Dom organization, but what if I want to get the
whole document as an DOM object? I was using dom4j and just getting the
content of the editor as a string and parsing it, but it seems dumb to use
that and have to go back and forth from dom4j to w3c.dom stuff, while
eclipse already does some XML interaction. Any solution for this?
Thanks,
Philippe
|
|
|
|
|
|
|
|
|
Re: Getting DOM from StructuredTextEditor [message #213763 is a reply to message #213747] |
Tue, 13 May 2008 22:26  |
Eclipse User |
|
|
|
Originally posted by: dcarver.starstandard.org
Nitin Dahyabhai wrote:
> Philippe Sabourin wrote:
>
>> getNodeValue doesnt seem to be implemented either, unless it's in some
>> subclass of NodeImpl.java.
>
> That's how it should be. The documentation for getNodeValue() specifies
> a null result for certain Node types.
>
Correct. The following link gives a list of when something can return a
non-null value getNodeValue();
http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID- 1950641247
If it's an element node, you are working with, then you must check to
see if there are descendants, the textual value if there is any will be
available in the returned Text node.
For the most part the way the DOM is implemented in WTP, is valid and
correct. However, out of 500 unit tests, there are about 150 of them
that the current DOM Level 1 doesn't pass.
See bug 214439 (http://bugs.eclipse.org/214439) for more information.
Most of these are probably edge cases, and in one particular case a
wrong assumption on whether Attributes can contain nodes. They can
according the spec, and the nodes are Text or entity nodes.
dave
|
|
|
Powered by
FUDForum. Page generated in 0.05111 seconds