Created json formatter and validator. #82
@@ -102,6 +102,11 @@ function performRequest(endpoint, checkXML, checkTransform){
 | 
				
			|||||||
    var xmlData = document.getElementById(sourceId).value.trim();
 | 
					    var xmlData = document.getElementById(sourceId).value.trim();
 | 
				
			||||||
    var transformData = document.getElementById(targetId).value.trim();
 | 
					    var transformData = document.getElementById(targetId).value.trim();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    var port = 8081
 | 
				
			||||||
 | 
					    if (getProcessor() == "libxml") {
 | 
				
			||||||
 | 
					        port = 8082
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    var empty = false;
 | 
					    var empty = false;
 | 
				
			||||||
    if (defaultStrings.includes(xmlData) && checkXML) {
 | 
					    if (defaultStrings.includes(xmlData) && checkXML) {
 | 
				
			||||||
            document.getElementById(sourceId).style.backgroundColor = color_red;
 | 
					            document.getElementById(sourceId).style.backgroundColor = color_red;
 | 
				
			||||||
@@ -113,7 +118,7 @@ function performRequest(endpoint, checkXML, checkTransform){
 | 
				
			|||||||
        empty = true;
 | 
					        empty = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (!empty) {
 | 
					    if (!empty) {
 | 
				
			||||||
        restRequest(endpoint, xmlData, transformData).then(function(result) {
 | 
					        restRequest(port, endpoint, xmlData, transformData).then(function(result) {
 | 
				
			||||||
            document.getElementById("resultArea").value = result.result;
 | 
					            document.getElementById("resultArea").value = result.result;
 | 
				
			||||||
            document.getElementById("procinfo").innerText = ' Computed using '.concat(" ", result.processor);
 | 
					            document.getElementById("procinfo").innerText = ' Computed using '.concat(" ", result.processor);
 | 
				
			||||||
            if (result.status = "OK") {
 | 
					            if (result.status = "OK") {
 | 
				
			||||||
@@ -131,6 +136,7 @@ function performRequest(endpoint, checkXML, checkTransform){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
					function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
				
			||||||
 | 
					    const port = 8082;
 | 
				
			||||||
    var xmlData = document.getElementById(sourceId).value.trim();
 | 
					    var xmlData = document.getElementById(sourceId).value.trim();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    var empty = false;
 | 
					    var empty = false;
 | 
				
			||||||
@@ -141,7 +147,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!empty) {
 | 
					    if (!empty) {
 | 
				
			||||||
        restRequest(endpoint, xmlData, "").then(function(result) {
 | 
					        restRequest(port, endpoint, xmlData, "").then(function(result) {
 | 
				
			||||||
            document.getElementById(targetId).value = result.result;
 | 
					            document.getElementById(targetId).value = result.result;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
@@ -154,13 +160,10 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//Form REST request, send and return received data
 | 
					//Form REST request, send and return received data
 | 
				
			||||||
async function restRequest(endpoint, xmlData, transformData) {
 | 
					async function restRequest(port, endpoint, xmlData, transformData) {
 | 
				
			||||||
    const escapeChar = "specialEscapeChar";
 | 
					    const escapeChar = "specialEscapeChar";
 | 
				
			||||||
    var port = ":8081/"
 | 
					    
 | 
				
			||||||
    if (getProcessor() == "libxml") {
 | 
					    const addr = window.location.protocol + "//" + window.location.hostname + ":" + port + "/" + endpoint;
 | 
				
			||||||
        port = ":8082/"
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    const addr = window.location.protocol + "//" + window.location.hostname + port + endpoint;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(defaultStrings.includes(xmlData)){
 | 
					    if(defaultStrings.includes(xmlData)){
 | 
				
			||||||
        xmlData = "<empty/>";
 | 
					        xmlData = "<empty/>";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user