<xxe-client>
,
a custom HTML element defined by JavaScript class (ECMAScript 6 ) XMLEditor
.xxeserver
, a
WebSocket server, the backend of <xxe-client>
,
must run side by side with MyBackend, though not necessarily on
the same server computer.XMLEditor
.XMLEditor
contained in its
HTML page, possibly using document.getElementById(id)
or document.getElementsByTagName("xxe-client")
. Let's
call this handle xmlEditor
.xmlEditor.openDocument(xmlSource,
documentURI)
.
NoteMethod
openDocument() must be passed a document URI
identifying the document being
edited.XMLEditor makes very few assumptions
about how documents are stored by your web application, so your are
free to use a URI of any kind, suffice for this URI to be meaningful
to your web application.Using custom URI schemes and/or custom
URI authorities is fine as long as the document URI is
hierarchical. The syntax of a document URI is thus:
scheme://authority/path, with
authority being optional. For example, the following
URIs are supported: https://cms.acme.com/docs/manual.xml,
docs:///0943_3561, and the following URIs are not:
mailto:john@acme.com,
urn:isbn:9780582035874.
|
xmlEditor.newDocumentFromTemplate(templateXMLSource,
documentURI)
. The main difference with openDocument
is
that after invoking newDocumentFromTemplate
, the saveAsNeeded
property of
XMLEditor
is set to true
.xmlEditor.saveDocument()
to save the changes made to the document. Because how documents are stored
is entirely the responsibility of MyFrontEnd/MyBackend,
this method does nothing at all except setting the saveNeeded
property of
XMLEditor
is set to
false
.xmlEditor.getDocument()
to
first obtain the XML source of the modified document and then send this
source to MyBackend.xmlEditor.saveDocumentAs(newDocumentURI)
,
which may be used to implement the "Save As" command, simplydocumentURI
property of
XMLEditor
to specified URI,saveNeeded
property is set to
false
,saveAsNeeded
property is set
to false
.saveStateChanged
" listener with
XMLEditor
as follows: xmlEditor.addEventListener("saveStateChanged",
listener)
. This listener will receive SaveStateChangedEvent
s.xmlEditor.closeDocument()
to close the document being edited, if any.
XMLEditor
, documentIsOpened
, documentUID
, documentURI
, etc, may be used to
test whether a document is currently being edited.