|
Re: Use WTP XML model for programatically modifying a file [message #213495 is a reply to message #213487] |
Fri, 09 May 2008 14:36 |
Eclipse User |
|
|
|
Originally posted by: dcarver.starstandard.org
Abel Muiño Vizcaino wrote:
> Hello!
>
> In the IAM project proposal [1], we provide actions that modify an XML
> file in behalf of the user. This file can also be edited through the XML
> editor or a Forms-based editor.
>
> I was wondering if we could use a single model (I think the easiest will
> be the XML editor model) for manipulating the file.
>
> Is that possible? Can we use the WTP model even when the file is not
> open? Would additions through this model keep the original formatting of
> the document? How tolerant is it to syntax errors?
>
> If it is not possible, any recommendations regarding how to synchronize
> changes through the multiple models?
>
Yes, you can use the WTP's StructuredDocument programmaticly to create
and edit the documents. It supports both it's own API as well as an
enhanced but compatible DOM Level 1 and partial Level 2 API interface.
I would recommend checking out the SourceEditing Unit Tests for seeing
how to create a StructuredDocument without loading a file.
|
|
|
|
Re: Use WTP XML model for programatically modifying a file [message #213626 is a reply to message #213610] |
Mon, 12 May 2008 15:42 |
Eclipse User |
|
|
|
Originally posted by: dcarver.starstandard.org
Abel Muiño wrote:
> David Carver wrote:
>> I would recommend checking out the SourceEditing Unit Tests for seeing
>> how to create a StructuredDocument without loading a file.
>
> I'm not familiar with WTP project structure (yet). Could you point me to
> the specific project so I can checkout and review it.
>
> Another question... is this also available in WTP 2.x or only in the
> upcoming 3.x versions?
2.x and 3.x have the ability to get the DOM from the StructuredDocument.
Actually all versions of WTP have this ability.
The source for the unit tests can be found in the Web Tools CVS
repository under
/cvsroot/webtools/sourceediting/tests
For there you can check out the
org.eclipse.wst.xml.ui.tests
org.eclipse.wst.xml.core.tests
org.eclipse.wst.sse.core.tests
org.eclipse.wst.sse.ui.tests
These should give you enough to get you going.
Dave
|
|
|
Powered by
FUDForum. Page generated in 0.04296 seconds