[24061] | 1 | /*
|
---|
[10695] | 2 | function loadAsync(sUri, SOAPMessage) {
|
---|
[24061] | 3 | var xmlHttp = XmlHttp.create();
|
---|
| 4 | xmlHttp.open("POST", sUri, true);
|
---|
| 5 | xmlHttp.onreadystatechange = function () {
|
---|
| 6 | if (xmlHttp.readyState == 4){
|
---|
[10695] | 7 | getTitle2(xmlHttp.responseXML, xmlHttp.responseText);
|
---|
[24061] | 8 | }
|
---|
| 9 | }
|
---|
| 10 | xmlHttp.setRequestHeader("SOAPAction", " ");
|
---|
| 11 | xmlHttp.setRequestHeader("Content-Type", "Content-Type: text/xml; charset=utf-8");
|
---|
| 12 |
|
---|
| 13 | xmlHttp.send(SOAPMessage);
|
---|
[10695] | 14 | }
|
---|
[24061] | 15 | */
|
---|
[10695] | 16 |
|
---|
| 17 | function messageToSOAP(message) {
|
---|
[24061] | 18 | return ['<?xml version="1.0" encoding="UTF-8"?>',
|
---|
| 19 | '<soapenv:Envelope ',
|
---|
| 20 | 'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"',
|
---|
| 21 | 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"',
|
---|
| 22 | 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">',
|
---|
| 23 | '<soapenv:Body>',
|
---|
| 24 | message,
|
---|
| 25 | '</soapenv:Body>',
|
---|
| 26 | '</soapenv:Envelope>'].join("");
|
---|
[10695] | 27 | }
|
---|
| 28 |
|
---|
| 29 | function getText(element) { //get the text from possibly multiple text nodes
|
---|
[24061] | 30 | if (element.hasChildNodes()) {
|
---|
| 31 | var tempString = [];
|
---|
| 32 | for (var j = 0; j < element.childNodes.length; j++) {
|
---|
| 33 | if (element.childNodes[j].nodeType == Node.TEXT_NODE ) { // =2
|
---|
| 34 | tempString.push(element.childNodes[j].nodeValue);
|
---|
| 35 | }
|
---|
| 36 | else {
|
---|
| 37 | tempString.push('non text node: ');
|
---|
| 38 | }
|
---|
| 39 | }
|
---|
| 40 | return tempString.join("");
|
---|
| 41 | }
|
---|
| 42 | else {
|
---|
| 43 | return 'getText: element has no ChildNodes from which to extract Text';
|
---|
| 44 | }
|
---|
[10695] | 45 | }
|
---|
| 46 |
|
---|
| 47 | function newOpenTag(name) {
|
---|
[24061] | 48 | return ['<', name, '>'].join("");
|
---|
[10695] | 49 | }
|
---|
| 50 |
|
---|
| 51 | function newCloseTag(name) {
|
---|
[24061] | 52 | return ['</', name, '>'].join("");
|
---|
[10695] | 53 | }
|
---|
| 54 |
|
---|
| 55 | function newEmptyTag(name) {
|
---|
[24061] | 56 | return ['<', name, '/>'].join("");
|
---|
[10695] | 57 | }
|
---|
| 58 |
|
---|
| 59 | function newElement(name, content) {
|
---|
[24061] | 60 | return ['<', name, '>', content, '</', name, '>'].join("");
|
---|
[10695] | 61 | }
|
---|
| 62 |
|
---|
| 63 | function newElementAtt1(name, content, attName, attValue) {
|
---|
[24061] | 64 | return ['<', name, ' ', attName, '="', attValue, '">', content, '</', name, '>'].join("");
|
---|
[10695] | 65 | }
|
---|
| 66 |
|
---|
| 67 | function newElementAtt(name, content, nameArray, valueArray) {
|
---|
[24061] | 68 | var e = ['<', name, ' '];
|
---|
| 69 | for (i=0; i < nameArray.length; i++) {
|
---|
| 70 | e.push(newAttribute(nameArray[i], valueArray[i]));
|
---|
| 71 | }
|
---|
| 72 | e.push(['>', content, '</', name, '>']);
|
---|
| 73 | return e.join("");
|
---|
[10695] | 74 | }
|
---|
| 75 |
|
---|
| 76 | function newAttribute(name, value) {
|
---|
[24061] | 77 | return [' ', name, '="', value, '"'].join("");
|
---|
[10695] | 78 | }
|
---|
| 79 |
|
---|
| 80 | function countElementChildren(node) {
|
---|
[24061] | 81 | var count = 0;
|
---|
| 82 | var childList = node.childNodes;
|
---|
[10695] | 83 | for(var i=0; i < (childList.length); i++) {
|
---|
[24061] | 84 | var childNode = childList.item(i);
|
---|
[10695] | 85 | if ((childNode.nodeType == 1)) { // only count elements
|
---|
[24061] | 86 | count++;
|
---|
[10695] | 87 | }
|
---|
| 88 | }
|
---|
| 89 | return count;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | function removeAllChildren(node) {
|
---|
| 93 | while (node.hasChildNodes()) {
|
---|
| 94 | node.removeChild(node.firstChild);
|
---|
| 95 | }
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | function isElement(node) {
|
---|
[24061] | 99 | if (node.nodeType == 1) {
|
---|
| 100 | return true; }
|
---|
| 101 | else {
|
---|
| 102 | return false;
|
---|
| 103 | }
|
---|
[10695] | 104 | } |
---|