Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Use WTP XML model for programatically modifying a file
Use WTP XML model for programatically modifying a file [message #213487] Fri, 09 May 2008 07:09 Go to next message
Abel Mui is currently offline Abel MuiFriend
Messages: 247
Registered: July 2009
Senior Member
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?


[1] IAM newsgroup:
http://www.eclipse.org/newsportal/thread.php?group=eclipse.t echnology.iam

--
Abel Muiño Vizcaino - http://ramblingabout.wordpress.com
Re: Use WTP XML model for programatically modifying a file [message #213495 is a reply to message #213487] Fri, 09 May 2008 14:36 Go to previous messageGo to next message
Eclipse UserFriend
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 #213610 is a reply to message #213495] Mon, 12 May 2008 07:49 Go to previous messageGo to next message
Abel Mui is currently offline Abel MuiFriend
Messages: 247
Registered: July 2009
Senior Member
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?

Thanks!
Re: Use WTP XML model for programatically modifying a file [message #213626 is a reply to message #213610] Mon, 12 May 2008 15:42 Go to previous message
Eclipse UserFriend
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
Previous Topic:connect websphere 6.1 from Eclipse SDK 3.4.0
Next Topic:Missing Wizard - Create Dynamic Web Project
Goto Forum:
  


Current Time: Fri Nov 21 08:42:48 GMT 2014

Powered by FUDForum. Page generated in 0.14101 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software