[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools] Re: Use WTP XML model for programatically modifying a file

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.