XML Formatter now shows exact error

This commit is contained in:
2023-03-01 09:38:12 +01:00
parent 8a863b7650
commit c6ee630018
2 changed files with 8 additions and 3 deletions

View File

@@ -148,6 +148,7 @@ function performRequest(endpoint, checkXML, checkTransform){
}
function performFormatRequest(endpoint, checkXML, sourceId, targetId){
const infoElementId = "formatinfo";
const port = 8082;
var xmlData = document.getElementById(sourceId).value.trim();
@@ -160,12 +161,17 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId){
if (!empty) {
restRequest(port, endpoint, xmlData, "").then(function(result) {
console.log(result);
if (result.status == "OK") {
document.getElementById(targetId).value = result.result;
document.getElementById(targetId).style.backgroundColor = null;
document.getElementById(infoElementId).innerText = ' Computed'.concat(" in ", result.time, "ms.");
document.getElementById(infoElementId).style.color = "#30aa58";
}
else {
document.getElementById(targetId).style.backgroundColor = color_red;
document.getElementById(infoElementId).innerText = result.result;
document.getElementById(infoElementId).style.color = "#aa3030";
}
});

View File

@@ -14,14 +14,13 @@
<div id="tool" class="tool rwd-expandable">
<div class="tool-context">
<div class="headline">
<h1>Online XML Formatter <span class="versionInfo"><span class="version-span">v0.21.37 BETA</span></span>
</h1>
<h1>Online XML Formatter</h1>
</div>
<select name="processors" id="processors" class="hidden">
<option value="libxml">libXML</option>
</select>
<b><span id="formatinfo"></span></b><br>
<label for="xmlArea"><b>Insert your XML:</b></label>
<textarea id="xmlArea" name="xmlArea" rows="15"
class="textarea-800 bordered-field vertically-resizeable max-width"