## Chapter 9. The `<xxe-client>` custom HTML element

`<xxe-client>`, a custom HTML element, is the frontend of XMLmind XML Editor Web Edition. It's a client of backend `xxeserver`.

    <xxe-client
      autoconnect = "false" | "true" : "true"
      autorecover = "false" | "true" : "true"
      button2pastestext = "false" | "true" : "false"
      clientproperties = Property_list
      serverurl = WebSocket_URL
    >

### Attributes

`@autoconnect`
  Default: true. If true, automatically connect to `xxeserver` when creating a new document, opening a document, etc.
`@autorecover`
  Default: true. If true, automatically recover opened document when the user moves away from the XML editor without closing the document being edited. This automatic document recovery happens for example when:
  - the user clicks the "Go back" button of the browser and then clicks "Go forward";
  - the user clicks the "Reload current page" button of the browser;
  - the user closes and then reopens the browser tab/window containing the XML editor.
`@button2pastestext`
  Default: false. If true, selecting text by dragging the mouse automatically copies this text to a dedicated private clipboard. Then clicking button #2 (middle button) elsewhere pastes copied text at the clicked location. This allows to emulate the X Window Primary Selection on all platforms.
  Note that the X Window Primary Selection is not natively supported on platforms where it should be (e.g. Linux) because it seems there is no way to update the Primary Selection without updating the System Clipboard at the same time.
`@clientproperties`
  Default: no client properties. Specifies a number of property name/property value pairs which are typically used to associate the user of `<xxe-client>` with the `xxeserver` connection (`<xxe-client>` peer; see Part I, Chapter 2. How it works). On the server side, these client properties are seen by the `<xxe-client>` peer as Java™ system properties, which makes them usable in different contexts (macros, access to remote file systems, etc).
  Note that client properties may be used only to add new system properties and not to override existing system properties. For example, specifying client property user.name=john will not cause standard system property user.name to be modified on the server side.
  This attribute is almost always set by some third-party JavaScript code used to integrate XXEW with the information system of this third-party (e.g. a CMS). Example:

      user=john;group=reviewers\u003Bauthors;DAV.password=changeit

  The syntax of this attribute is:

      properties = property [ ';' property ]*
      property = name '=' value

  If value contains ';', this character may be escaped as '\u003B'. See above example: group value is "reviewers;authors".
`@serverurl`
  Specifies the "ws://" (WebSocket) or "wss://" (WebSocket Secure) URL of `xxeserver`. Default: "${protocol}://${hostname}:${port}/xxe/ws", where ${protocol}, ${hostname} and ${port} represent variable values computed using the URL of the HTML page containing `<xxe-client>`.
  Supported variables are:

  Variable reference | Substituted value
  ${protocol} | "wss" if `<xxe-client>` loaded from an "https://" URL; "ws" otherwise.
  ${hostname} | Same host name or IP address as in the URL of the HTML page containing `<xxe-client>`.
  ${port} | Same port as in the URL of the HTML page containing `<xxe-client>`, knowing that implicit HTTPS port is 443 and implicit HTTP port is 80.
  ${defaultPort} | 18079 if `<xxe-client>` loaded from an "https://" URL; 18078 otherwise.

  Simple examples demonstrating how the default value of `@serverurl` is computed:
  - `<xxe-client>` found in http://localhost:18078/xxe/index.html, `@serverurl` is ws://localhost:18078/xxe/ws.
  - `<xxe-client>` found in https://www.xmlmind.com/xmleditor/_web/demo/index.html (implicit HTTPS port is 443), `@serverurl` is wss://www.xmlmind.com:443/xxe/ws.

### JavaScript API

The `<xxe-client>` custom HTML element is defined as follows:

    window.customElements.define("xxe-client", XMLEditor);

The JavaScript API of class `XMLEditor` is found here .