119. XXE.edit

Parameter syntax:

[ '[master=' [ master_document_URL ]? ']' ]?
[ '[confirm]' ]? [ '[readOnly]'|'[readWrite]' ]? [ file_name | URL ]+

Opens a document in XXE, unless it is already opened, in which case this command just brings all its views to front and makes this document the “active” document.

Note that it's possible to specify several documents to be opened. In this case, it's first specified document which is made the “active” one.

Parameters:

[master=master_document_URL]

Advanced, rarely needed, option. No effect if the document is already opened in XXE. Informs XXE that the document is possibly a module which is being opened from master document master_document_URL. URL master_document_URL defaults to the URL of the document from which the XXE.edit command has been invoked.

[confirm]

When the document is not already opened in XXE, this option may be used to display a dialog box asking the user to confirm that she/he really wants to open this document in XXE. This dialog box also allows the user to specify whether the document is to be opened in read-only mode[5].

[readOnly]

Allows to open in read-only mode the document specified by the other parameters.

[readWrite]

Allows to open in normal read-write mode the document specified by the other parameters.

file_name or URL

Opens or activates specified document.

An URL may have a fragment. Example: file:/home/john/docs/report122211/report.xml#conclusion. If the element specified by fragment exists, XXE will automatically scroll to show this element and then it will select it.

Returns CommandResult.DONE having newly opened or newly activated com.xmlmind.xml.doc.Document as its value (for use by higher-level commands) or CommandResult.FAILED if specified document is not already opened in the editor and fails to be opened.

DocBook example: edit other DocBook document referenced in the url attribute of implicitly or explicitly selected ulink element.

<command name="docb.editDocument">
  <macro>
    <sequence>
      <get context="$implicitElement/@url" expression="resolve-uri(.)" />
      <command name="XXE.edit" parameter="%_" />
    </sequence>
  </macro>
</command>


[5] The initial state of the read-only check box found in this dialog box is of course taken from parameter [readOnly].