Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » create IDOMElement
create IDOMElement [message #481518] Fri, 21 August 2009 07:09 Go to next message
Siarhei Navatski is currently offline Siarhei Navatski
Messages: 14
Registered: July 2009
Junior Member
Hi, I have next question

There are two Editors in MultipageEditor. First editor is SSE xml
editor. Second editor is visual editor which use structured model
(IDOMModel) common for both editors.
In the visual editor I want to create a new element which correspond
with IDOMElement. I do so:

IDOMElement newElement =
((IDOMDocument)getDocument()).createElement("elementName");
((IDOMElement)getParent()).appendChild(newElement);

It's ok - document contains new element, BUT STRUCTURED DOCUMENT REGIONS
of new element ISN'T INITIALIZED. How I can set them right?

thanks
Re: create IDOMElement [message #481601 is a reply to message #481518] Fri, 21 August 2009 13:35 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2253
Registered: July 2009
Senior Member
Navatski Siarhei wrote:
> There are two Editors in MultipageEditor. First editor is SSE xml
> editor. Second editor is visual editor which use structured model
> (IDOMModel) common for both editors.
> In the visual editor I want to create a new element which correspond
> with IDOMElement. I do so:
>
> IDOMElement newElement =
> ((IDOMDocument)getDocument()).createElement("elementName");
> ((IDOMElement)getParent()).appendChild(newElement);
>
> It's ok - document contains new element, BUT STRUCTURED DOCUMENT REGIONS
> of new element ISN'T INITIALIZED. How I can set them right?
>
> thanks

Is getParent() already part of the DOM Document in your example?

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: create IDOMElement [message #482549 is a reply to message #481518] Wed, 26 August 2009 21:21 Go to previous message
David Williams is currently offline David Williams
Messages: 176
Registered: July 2009
Senior Member
Navatski Siarhei wrote:
> ...
> It's ok - document contains new element, BUT STRUCTURED DOCUMENT
> REGIONS of new element ISN'T INITIALIZED. How I can set them right?
> ...
Just a guess ... I wonder if you _really_ have a common model? A single
instance that a single instance of a common, shared IDocument? You can
have two editors with different instances of IDocument that "stay in
sync" based on the way file buffers work ... but that's not the same as
a common DOM Model. You might put in some printlns to get the objects'
hashcodes to confirm they are the same instance. And/or, you might write
a tiny test, independent of editors, to see if the DOM code works as you
expect.
Previous Topic:How To Open Bundle Entry In Browser
Next Topic:Glassfish Publishing Issue
Goto Forum:
  


Current Time: Mon Sep 01 19:50:46 EDT 2014

Powered by FUDForum. Page generated in 0.09985 seconds