<html>
<head>
<title>Test XMLHttpRequest and document.xmlEncoding interaction.</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<body>
<p>Test XMLHttpRequest and document.xmlEncoding interaction.</p>
<p>The request body should contain the word "Проверка".</p>
<script>

    if (window.testRunner)
        testRunner.dumpAsText();

    var console_messages = document.createElement("ul");
    document.body.appendChild(console_messages);
    
    function log(message)
    {
        var item = document.createElement("li");
        item.appendChild(document.createTextNode(message));
        console_messages.appendChild(item);
    }
    
    req = new XMLHttpRequest();
    req.open('GET', 'resources/xml-encoding.xml', false);
    req.send(null);

    var responseXML = req.responseXML;
    log("responseXML.xmlEncoding: " + responseXML.xmlEncoding);
    log("responseXML.xmlVersion: " + responseXML.xmlVersion);
    log("responseXML.xmlStandalone: " + responseXML.xmlStandalone);

    req.open('POST', 'resources/post-echo-as-utf-8.cgi', false);
    req.send(responseXML);
    log("Request body: " + req.responseText);

</script>
</body>
</html>
