HTTPTools.postXML

Send a document to your server using a HTTP POST request. This function allows you to specify the encoding explicitly.

This example shows how to save your document in UTF-8 encoding:

IO.setSaveXMLFunction(function (uri, doc) {
  HTTPTools.postXML(uri, doc, "UTF-8");
});

Note that setting the encoding will cause an XML prolog to be added to your document:

<?xml version="1.0" encoding="UTF-8"?>
<document>…</document>

HTTPTools.postXML( uri : String,  doc : XopusDocument[,  encoding : String][,  callback : Function][,  headers : Object]) : HTTPTools

Arguments

uri
String. The server URL to POST to.
doc
XopusDocument. The DOM document to POST to the server.
encoding
String. The encoding to use for the serialized DOM, e.g. UTF-8. (Optional)
callback
Function. This function is called when the server response is received. It will be called with the native XMLHttpRequest object as only argument. This callback can be used to inspect response status headers for example. (Optional)
headers
Object. A list of headers to send with the request. This can be used to construct request in more specific ways. For example {Accept: "application/json"}. (Optional)

Return Value

HTTPTools
addListener

History

version event
Xopus 4.1 Change. Added the callback and headers arguments (Case 211026)