Post here questions and problems related to oXygen frameworks/document types.
- Posts: 168
- Joined: Wed Apr 29, 2009 4:55 pm
When document is opened in Author mode, until it is modified no XML formatting takes place. Can I somehow force this via code and reformat several files in bulk?
I am able to open files via my plugin class implementing AuthorOperation:
As I couldn't find any formatting trigger, I am trying inserting and removing XML fragment to zero position. But this approach fails (Premature end of file).
Code: Select all
Reader reader = new InputStreamReader(new FileInputStream(processedFile), "UTF-8");
// inserting and removing content
authorAccess.getDocumentController().insertXMLFragment("<?pi?>", 0); --> Error: Premature end of file.
- Posts: 7591
- Joined: Fri Jul 09, 2004 5:18 pm
If you want to make bulk format and indent changes, in the Oxygen Project view you can right click on a folder linked there and then choose "Format and Indent Files".
In addition, the Oxygen Preferences->"Editor / Edit Modes / Author" page has a "Format and indent->The entire document" radio button which should always format and indent the entire document when the contents are saved.
About what you are trying to do right now, you should try to insert the processing instruction at offset "1", we consider offset "0" to be the "document" node (which contains all comments, PIs and the root element) and you cannot insert anything before the "document" node.
<oXygen/> XML Editor