## Chapter 4. A quick demo on a single computer

### Start `xxeserver`

1. Open a command prompt (Windows) or a terminal (Mac, Linux).
2. Go to directory `XXE_INSTALL_DIR/web/bin/`, XXE_INSTALL_DIR being the directory where XMLmind XML Editor Web Edition (XXEW for short) has been installed.
3. Run `xxeserver.bat` (Windows) or `xxeserver` (Mac, Linux shell script).

       C:\...\web\bin> xxeserver.bat

   - `xxeserver` should run fine on any platform supporting Java™ 11+.

     | ##### Tip The Windows .zip distribution and the Mac .tar.gz distribution contain a private copy of the most recent version of the Java runtime. Therefore, there is generally no need to install Java on the computer running `xxeserver`.

     | ##### Note If `xxeserver` does not start, please refer to Troubleshooting: `xxeserver` does not start.

   - As explained in Part I, Chapter 2. How it works, `xxeserver` is mainly a WebSocket server. However it has also been made an HTTP server in order to be able to run the sample XML editor application described below without having to install anything other than XXEW.
   - By default, `xxeserver` does not support secure connections (https://, wss:// URLs) and listens to HTTP and WebSocket requests on port 18078. Of course, these simple settings can be changed. See Chapter 7. `xxeserver` command-line options.
4. At the end of the demo, simply type `Ctrl-C` in the command prompt or terminal to stop `xxeserver`.

### Open the page containing the sample XML editor application in your browser

1. Start a web browser on the computer running `xxeserver`(1).

   | ##### Important At the time of this writing only very recent Blink-based browsers like Google Chrome or Microsoft Edge and Gecko-based browsers like Firefox are supported. Apple Safari, which uses the WebKit engine, is currently not supported. We recommend using Google Chrome or Microsoft Edge because these browsers currently have the best support for editing local files and for integrating the system clipboard with the XML editor.

2. In the address bar of the web browser, please type "http://localhost:18078/xxe/".
3. A sample XML editor application based on `<xxe-client>` is now ready to use.
   Figure 4-1. A sample XML editor application based on `<xxe-client>`

   | ##### Note If the sample XML editor application does not load or does not work, please refer to Troubleshooting: the sample XML editor web application does not work.

### The sample XML editor application included in the XXEW distribution

The XXEW distribution includes a sample XML editor application. This application lets you create or modify XML documents found:

- On the computer running the web browser. These are called local files.
- On the computer running `xxeserver`. These are called remote files.

In the case of this quick demo, these two computers are the same.
Which remote files may be accessed by XXEW and how these files are accessed —read-write or read-only— may be configured. See Chapter 7. `xxeserver` command-line options. In the case of this quick demo, XXEW has a read-write access to any file found in the home directory of the user who started `xxeserver`.
While opening or saving remote files is seamless and works like in any desktop application, the same cannot be said for local files. For security reasons, the browsers give web applications like the sample XML editor very limited access to the local file system. On most browsers, the access to the local file system is even minimal. For example, on browsers other than Google Chrome (or Microsoft Edge), Save is equivalent to Save As.

### Opening a DocBook document as a remote file

1. Click Open and select "Open Remote Document". The Remote File Chooser is displayed.
2. Select a remote XML file then click OK. The corresponding document is opened in the XML editor.

### Opening a DocBook document as a local file

1. Click Open and select "Open Local Document". The Local File Chooser is displayed.
2. Choosing a local file involves two steps.
   1. Click the "Open file" button. This displays the "Open File" dialog box of the web browser.
   2. Select an XML file and also use the facility of this dialog box to copy the path of the directory containing selected file, then click OK. The Local File Chooser now suggests to proceed to step #2.
   3. Type(2)(or paste) the file path of the directory containing selected file ("`/home/…/demo/docbook`" in this example). On some web browsers, notably when saving a document, you'll also have to type the name of selected file ("`docbook-image.xml`" in this example). The corresponding document is opened in the XML editor.
      Notice that all the images found in the document are displayed as green "Picture" icons.

      | ##### Remember When you insert an image into a document opened as a local file, you'll be able to see the inserted image. However, because the web browser gives web applications very limited access to the local file system, if you close the document and then reopen it, the newly inserted image is now represented by , a green image placeholder icon. This is normal. Nothing to worry about. A possible workaround is to embed the image in the document rather than simply reference its file. (XXEW lets you do this quite easily.) However, you must keep in mind that embedding images may create huge XML files and also may cause XML interchange problems.

(1) | Please remember that this is nothing more than just a quick, 5 minutes demo. It's by no means a real world use case.

(2) | The file paths and file names you type in this dialog box are remembered across editing sessions. This means that you can pick file paths and file names from the text field autocompletion lists rather than type the same values over and over.