Froze Release11.2 (#177)

Co-authored-by: Adam Bem <adam.bem@zoho.eu>
Co-authored-by: Dariusz Augustyniak <augustyd@noreply.example.com>
Co-authored-by: Mikolaj Widla <widlam@noreply.example.com>
Reviewed-on: #177
This commit is contained in:
2023-05-09 15:02:44 +02:00
parent 59ffeb9363
commit 72d69f2967
31 changed files with 18292 additions and 3029 deletions

View File

@@ -54,12 +54,12 @@ def xpath(source: str, xpath: str) -> str:
# root.xpath can return 4 types: float, string, bool and list.
# List is the only one that can't be simply converted to str
if type(result) is not list:
return str(result)
return str(result), type(result).__name__
else:
result_string = ""
for e in result:
result_string += etree.tostring(e, pretty_print=True).decode() + "\n"
return result_string
return result_string, "node"

View File

@@ -35,7 +35,7 @@ def process_xml(request: request, type: str) -> str:
elif (type == "xslt"):
response_json['result'] = Parser.xslt(data, process)
elif (type == "xpath"):
response_json['result'] = Parser.xpath(data, process)
response_json['result'], response_json['type'] = Parser.xpath(data, process)
elif (type == "prettify"):
response_json['result'] = Parser.formatXML(data, True)
elif (type == "minimize"):

View File

@@ -194,6 +194,7 @@ public class MockController {
MockedMessageDto mockedMessageDto = klausService.getMockedResponse(clientUUID, mockedResponseId);
HttpHeaders httpHeaders = new HttpHeaders();
if (mockedMessageDto.getHttpHeaders() != null) mockedMessageDto.getHttpHeaders().forEach(httpHeaders::set);
httpHeaders.add("Content-Type", mockedMessageDto.getMediaType());
return new ResponseEntity<>(mockedMessageDto.getMessageBody(), httpHeaders,
Objects.requireNonNull(HttpStatus.valueOf(mockedMessageDto.getHttpStatus())));
}

View File

@@ -15,7 +15,7 @@
<div class="tool extended">
<div class="tool-context">
<div>
<h1>MockedServices <span class="version-span">v1.0.0</span></h1>
<h1>MockedServices</h1>
</div>
<div>
<label for="uuid-input" class="block-display">UUID</label>
@@ -309,9 +309,11 @@
<div>Unsaved data<i class="r-exclamation"></i></div>
<button>&times;</button>
</div>
<div class="body">You haven't saved your message! Any changes will be lost.<br>Do you want to continue?</div>
<div class="body">You haven't saved your message!<br> Do you want to save it?</div>
<div class="function">
<button>Yes</button>
<button type = "button" onclick = "updateData()" value = "Display">Save</button>
<button>No</button>
</div>
</div>

View File

@@ -155,6 +155,7 @@ function callMethodByName(methodObject){
}
}
function updateData(){
var updatedJson = generateJson();
const dataSaved = function () {

View File

@@ -32,12 +32,16 @@ public class SparkApplication {
.setPrettyPrinting()
.create();
Gson jsongson = new GsonBuilder()
.disableHtmlEscaping()
.create();
RestControllerRegistry registry = new RestControllerRegistry();
registry.registerController(new ProcessorInfoController(logger));
registry.registerController(new XsdController(gson, logger));
registry.registerController(new XPathController(gson, logger));
registry.registerController(new XsltController(gson, logger));
registry.registerController(new JsonController());
registry.registerController(new JsonController(gson, jsongson, logger));
registry.register();

View File

@@ -1,7 +1,7 @@
package com.r11.tools.controller;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
//import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.r11.tools.controller.internal.GlobalControllerManifest;
import com.r11.tools.controller.internal.HandlerType;
@@ -9,18 +9,22 @@ import com.r11.tools.controller.internal.RestController;
import com.r11.tools.controller.internal.ScopedControllerManifest;
import spark.Request;
import spark.Response;
import org.apache.logging.log4j.Logger;
@GlobalControllerManifest(path = "/json")
public class JsonController implements RestController {
private final Gson prettyGson = new GsonBuilder()
.disableHtmlEscaping()
.setPrettyPrinting()
.create();
private final Logger logger;
private final Gson gson = new GsonBuilder()
.disableHtmlEscaping()
.create();
private final Gson prettyGson;
private final Gson gson;
public JsonController(Gson prettyGson, Gson jsongson,Logger logger) {
this.logger = logger;
this.prettyGson = prettyGson;
this.gson = jsongson;
}
@ScopedControllerManifest(method = HandlerType.POST, path = "/formatting")
public void formatting(Request request, Response response) {
@@ -35,17 +39,20 @@ public class JsonController implements RestController {
responseJson.addProperty("data", this.prettyGson.toJson(requestJson));
responseJson.addProperty("time", System.currentTimeMillis() - startProcess);
response.body(this.prettyGson.toJson(responseJson));
} catch (Exception e) {
this.logger.error("Error on formatting Json " + e);
Throwable cause = e.getCause();
response.status(500);
response.status(400);
responseJson.addProperty("data", cause == null ? e.getMessage() : cause.getMessage());
responseJson.addProperty("time", System.currentTimeMillis() - startProcess);
response.body(this.prettyGson.toJson(responseJson));
}
this.logger.info("Json processed in " + responseJson.get("time").toString() + " ms.");
response.body(this.prettyGson.toJson(responseJson));
}
@ScopedControllerManifest(method = HandlerType.POST, path = "/minimize")
@@ -63,14 +70,16 @@ public class JsonController implements RestController {
response.body(this.gson.toJson(responseJson));
} catch (Exception e) {
this.logger.error("Error on minimizeing Json " + e);
Throwable cause = e.getCause();
response.status(500);
response.status(400);
responseJson.addProperty("data", cause == null ? e.getMessage() : cause.getMessage());
responseJson.addProperty("time", System.currentTimeMillis() - startProcess);
response.body(this.prettyGson.toJson(responseJson));
}
this.logger.info("Json processed in " + responseJson.get("time").toString() + " ms.");
}
}

View File

@@ -2,10 +2,7 @@ package com.r11.tools.controller;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.r11.tools.controller.internal.GlobalControllerManifest;
import com.r11.tools.controller.internal.HandlerType;
import com.r11.tools.controller.internal.RestController;
import com.r11.tools.controller.internal.ScopedControllerManifest;
import com.r11.tools.controller.internal.*;
import com.r11.tools.xml.Saxon;
import com.r11.tools.xml.Xalan;
import org.apache.logging.log4j.Logger;
@@ -63,7 +60,7 @@ public class XPathController implements RestController {
timeStart = System.currentTimeMillis();
try {
tmp = Saxon.processXPath(data, query, version).trim();
tmp = Saxon.processXPath(data, query, version).getData().trim();
response.status(200);
@@ -92,12 +89,13 @@ public class XPathController implements RestController {
timeStart = System.currentTimeMillis();
try {
tmp = Xalan.processXPath(data, query).trim();
XPathQueryResult xPathQueryResult = Xalan.processXPath(data, query);
response.status(200);
responseJson.addProperty("result", tmp);
responseJson.addProperty("result", xPathQueryResult.getData().trim());
responseJson.addProperty("status", "OK");
responseJson.addProperty("type", xPathQueryResult.getType());
} catch (Exception ex) {
this.logger.error("Error on processing XPath using Xalan. " + ex);

View File

@@ -0,0 +1,22 @@
package com.r11.tools.controller.internal;
/**
* Class used to store data received from parser and type of that data (node, string, etc.)
*/
public class XPathQueryResult {
private String data;
private String type;
public XPathQueryResult(String data, String type) {
this.data = data;
this.type = type;
}
public String getData() {
return data;
}
public String getType() {
return type;
}
}

View File

@@ -1,5 +1,6 @@
package com.r11.tools.xml;
import com.r11.tools.controller.internal.XPathQueryResult;
import net.sf.saxon.s9api.*;
import javax.xml.transform.stream.StreamSource;
@@ -41,7 +42,7 @@ public class Saxon {
* @return string xml representation of the node
* @throws Exception thrown on node building errors or invalid xpath
*/
public static String processXPath(String data, String query, String version) throws Exception {
public static XPathQueryResult processXPath(String data, String query, String version) throws Exception {
Processor p = new Processor(false);
XPathCompiler compiler = p.newXPathCompiler();
DocumentBuilder builder = p.newDocumentBuilder();
@@ -61,7 +62,7 @@ public class Saxon {
sb.append(xdmItem);
sb.append('\n');
}
return sb.toString();
return new XPathQueryResult(sb.toString(), "N/A");
}

View File

@@ -1,5 +1,6 @@
package com.r11.tools.xml;
import com.r11.tools.controller.internal.XPathQueryResult;
import org.apache.xpath.XPathAPI;
import org.apache.xpath.objects.XObject;
import org.w3c.dom.Document;
@@ -64,7 +65,7 @@ public class Xalan {
* @return xml processed using given xpath
* @throws Exception thrown on node building errors or invalid xpath
*/
public static String processXPath(String data, String transform) throws Exception {
public static XPathQueryResult processXPath(String data, String transform) throws Exception {
// Set up a DOM tree to query.
InputSource in = new InputSource(new StringReader(data));
@@ -81,7 +82,7 @@ public class Xalan {
NodeIterator nl = XPathAPI.selectNodeIterator(doc, transform);
// Serialize the found nodes to result object.
StringBuilder result = new StringBuilder();
StringBuilder resultString = new StringBuilder();
Node n;
while ((n = nl.nextNode())!= null) {
StringBuilder sb;
@@ -90,18 +91,19 @@ public class Xalan {
// single XPath text node. Coalesce all contiguous text nodes
// at this level
for (Node nn = n.getNextSibling(); isTextNode(nn); nn = nn.getNextSibling()) {
result.append(nn.getNodeValue());
resultString.append(nn.getNodeValue());
}
} else {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
serializer.transform(new DOMSource(n), new StreamResult(new OutputStreamWriter(outputStream)));
result.append(outputStream);
resultString.append(outputStream);
}
result.append("\n");
resultString.append("\n");
}
return result.toString();
return new XPathQueryResult(resultString.toString(), "node");
} catch (TransformerException e) {
return XPathAPI.eval(doc, transform).toString();
String returnData = XPathAPI.eval(doc, transform).toString();
return new XPathQueryResult(data, "string");
}
}

View File

@@ -4,6 +4,7 @@ COPY ./tools/ /usr/share/nginx/html/tools/
COPY ./lawful/ /usr/share/nginx/html/lawful/
COPY ./assets/ /usr/share/nginx/html/assets/
COPY ./index.html /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
RUN mkdir -p /scripts
COPY insert_version.sh /scripts/

View File

@@ -143,3 +143,8 @@ div#copyright a, a:visited, a:active {
transform: scale(1.25, 1.25);
transition-duration: .3s;
}
.separator{
width: 100%;
padding:6px;
}

View File

@@ -440,12 +440,11 @@ body {
.content {
padding: 0px 15px 0px 15px ;
text-align: justify;
text-align: left;
overflow: hidden;
transition: max-height .2s ease-out;
max-height: 0px;
border-left: #c0c2c3 2px solid;
}
.collapsibleMini::before{
@@ -506,6 +505,10 @@ h2 {
font-weight: 300;
}
pre {
margin: 0px;
}
@media only screen and (max-width: 1024px) {
.rwd-hideable {
display: none;

View File

@@ -0,0 +1,14 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:b="http://www.release11.com/book" xmlns:p="http://www.release11.com/person"
xmlns:l="http://www.release11.com/library">
<xsl:template match="/">
<Library>
<ReaderCount>
<xsl:value-of select="count(//p:person)" />
</ReaderCount>
<BookCount>
<xsl:value-of select="count(/l:library/l:bookList/b:book)" />
</BookCount>
</Library>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<library>
<libraryName>City library</libraryName>
<libraryID>345123</libraryID>
<readerList>
<person>
<readerID>7321</readerID>
<name>Adam</name>
<surname>Choke</surname>
</person>
<person>
<readerID>5123</readerID>
<name>Lauren</name>
<surname>Wong</surname>
</person>
</readerList>
<bookList>
<book>
<bookID>6422</bookID>
<title>Harry Potter</title>
<readerID>7542</readerID>
</book>
<book>
<bookID>1234</bookID>
<title>Macbeth</title>
<readerID>5123</readerID>
</book>
<book>
<bookID>9556</bookID>
<title>Romeo and Juliet</title>
</book>
</bookList>
</library>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="">
<xsd:element name="library">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element minOccurs="0" name="libraryName" type="xsd:string" />
<xsd:element minOccurs="0" name="libraryID" type="xsd:int" />
<xsd:element minOccurs="0" name="readerList">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="person">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element minOccurs="0" name="readerID" type="xsd:int" />
<xsd:element minOccurs="0" name="name" type="xsd:normalizedString" />
<xsd:element minOccurs="0" name="surname" type="xsd:normalizedString" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element minOccurs="0" name="bookList">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="book">
<xsd:complexType mixed="true">
<xsd:sequence>
<xsd:element minOccurs="0" name="bookID" type="xsd:int" />
<xsd:element minOccurs="0" name="title" type="xsd:string" />
<xsd:element minOccurs="0" name="readerID" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

1202
Frontend/assets/scripts/common/hljs.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,64 @@
/**
* This file contains scripts needed for syntax highlight to work.
*/
/**
* This functions highlight element with provided ID.
*
* @function
* @name highlightSyntax
* @kind function
* @param {any} elementId
* @returns {void}
*/
function highlightSyntax(elementId) {
const element = document.getElementById(elementId);
element.innerHTML = hljs.highlightAuto(element.innerText).value
}
/**
* Converts pasted data to plain text
*
* @function
* @name configurePastingInElement
* @kind function
* @param {any} elementId
* @returns {void}
*/
function configurePastingInElement(elementId) {
const editorEle = document.getElementById(elementId);
// Handle the `paste` event
editorEle.addEventListener('paste', function (e) {
// Prevent the default action
e.preventDefault();
// Get the copied text from the clipboard
const text = e.clipboardData
? (e.originalEvent || e).clipboardData.getData('text/plain')
: // For IE
window.clipboardData
? window.clipboardData.getData('Text')
: '';
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
// Insert text at the current position of caret
const range = document.getSelection().getRangeAt(0);
range.deleteContents();
const textNode = document.createTextNode(text);
range.insertNode(textNode);
range.selectNodeContents(textNode);
range.collapse(false);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
highlightSyntax(editorEle.id);
});
}

View File

@@ -13,8 +13,8 @@ const color_red = "#ff8f8f";
* @returns {void}
*/
function clearDefaultContent(element, text) {
if (element.value == text) {
element.value = "";
if (element.innerText == text) {
element.innerText = "";
element.style.color = "#000000";
element.style.backgroundColor = "#ffffff";
}
@@ -53,15 +53,40 @@ function getVersion() {
* @kind function
*/
function clearDataField() {
document.getElementById("xmlArea").value = "";
document.getElementById("xmlArea").innerHTML = "";
document.getElementById("xmlArea").style.color = null;
document.getElementById("xmlArea").style.backgroundColor = null;
document.getElementById("transformArea").value = "";
document.getElementById("transformArea").innerHTML = "";
document.getElementById("transformArea").style.color = null;
document.getElementById("transformArea").style.backgroundColor = null;
document.getElementById("resultArea").innerHTML = "";
}
/**
* The `escapeHTML` function is used to escape special characters in an HTML element's innerHTML property.
* This is done to prevent these characters from being interpreted as HTML tags or attributes,
* which could potentially cause security vulnerabilities or unintended behavior.
*
* @function
* @name escapeHTML
* @kind function
* @param {any} element
* @returns {void}
*/
function escapeHTML(elementID) {
document.getElementById(elementID).innerHTML = document.getElementById(elementID).innerHTML
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
/**
* It fills the XML area with a sample XML.
*
@@ -78,12 +103,50 @@ function fillDefaultXML(element) {
fetch(serverAddress + "/assets/samples/sampleXml.xml")
.then(response => response.text())
.then((exampleData) => {
document.getElementById("xmlArea").value = exampleData;
document.getElementById("xmlArea").innerText = exampleData;
highlightSyntax("xmlArea");
document.getElementById("xmlArea").style.backgroundColor = null;
})
}
}
function fillDefaultXSD(){
const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086";
fetch(serverAddress + "/assets/samples/sampleXSD.xsd")
.then( response => response.text() )
.then( (XSDSchema) => {
document.getElementById('transformArea').innerText = XSDSchema;
highlightSyntax("transformArea");
} )
fetch(serverAddress + "/assets/samples/sampleXMLForXSD.xml")
.then( response => response.text() )
.then( (XMLSample) => {
document.getElementById('xmlArea').innerText = XMLSample;
highlightSyntax("xmlArea");
} )
}
/**
* The `fillDefaultXSLT()` function fetches a default XSLT template from the server and sets the value of the element with id "transformArea" to the fetched template.
*
* @function
* @name fillDefaultXSLT
* @kind function
* @returns {void}
*/
function fillDefaultXSLT() {
const serverAddress = window.location.protocol + "//" + window.location.hostname + ":8086";
fetch(serverAddress + "/assets/samples/XSLTTemplate.xslt")
.then( response => response.text() )
.then( (XSTLTemplate) => {
document.getElementById('transformArea').innerText = XSTLTemplate;
highlightSyntax("transformArea");
} )
}
/**
* It sets default content for the element an changes it's color to grey
*
@@ -223,8 +286,8 @@ function refreshTooltip() {
function performRequest(endpoint, checkXML, checkTransform) {
const sourceId = "xmlArea";
const transformId = "transformArea";
var xmlData = document.getElementById(sourceId).value.trim();
var transformData = document.getElementById(transformId).value.trim();
var xmlData = document.getElementById(sourceId).innerText.trim();
var transformData = document.getElementById(transformId).innerText.trim();
var port = 8081;
if (getProcessor() == "libxml") {
@@ -243,17 +306,24 @@ function performRequest(endpoint, checkXML, checkTransform) {
}
if (!empty) {
restRequest(port, endpoint, xmlData, transformData).then(function (result) {
document.getElementById("resultArea").value = result.result;
document.getElementById("procinfo").innerText = ' Computed using '.concat(" ", result.processor);
if (result.status = "OK") {
document.getElementById("procinfo").innerText = document.getElementById("procinfo").innerText.concat(" in ", result.time, "ms");
document.getElementById("resultArea").innerText = result.result;
highlightSyntax("resultArea");
document.getElementById("procinfo").innerText = ' Computed using ' + result.processor;
if (result.status == "OK") {
document.getElementById("procinfo").innerText += " (" + result.time + "ms)";
if (result.type)
document.getElementById("procinfo").innerText += ". Returned: " + result.type;
else
document.getElementById("procinfo").innerText += ". Engine doesn't support return of data types.";
procinfo.style.color = "#30aa58";
} else {
procinfo.style.color = "#aa3030";
}
});
} else {
document.getElementById("resultArea").value = "No data provided!";
document.getElementById("resultArea").innerHTML = "No data provided!";
return false;
}
@@ -276,7 +346,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) {
const targetElement = document.getElementById(targetId);
const infoElement = document.getElementById("formatinfo");
const port = 8082;
var xmlData = sourceElement.value.trim();
var xmlData = sourceElement.innerText.trim();
var empty = false;
if (defaultStrings.includes(xmlData) && checkXML) {
@@ -288,10 +358,13 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) {
if (!empty) {
restRequest(port, endpoint, xmlData, "").then(function (result) {
if (result.status == "OK") {
targetElement.value = result.result;
targetElement.innerText = result.result.trim();
highlightSyntax(targetElement.id);
targetElement.style.backgroundColor = null;
infoElement.innerText = ' Computed'.concat(" in ", result.time, "ms.");
infoElement.style.color = "#30aa58";
}
else {
targetElement.style.backgroundColor = color_red;
@@ -302,6 +375,7 @@ function performFormatRequest(endpoint, checkXML, sourceId, targetId) {
});
}
}

View File

@@ -2,14 +2,19 @@
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="assets/css/frame.css">
<script src="assets/scripts/common/jquery-3.6.0.slim.min.js"></script>
<script src="assets/scripts/dyn_host.js"></script>
<script src="assets/scripts/frame.js"></script>
<!-- <link rel="stylesheet" href="common.css"> -->
<link rel="shortcut icon" href="assets/images/favicon.ico" type="image/x-icon">
<!-- Meta tags for SEO and SEM -->
<title>Release11 Web Tools</title>
<meta name=”robots” content="index, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<meta name="description"
content="Unleash the power of Release11's suite of intuitive web tools, including XPath, XSLT, XSD, XML Formatter, JSON Formatter, and REST Mocking services, designed to streamline your development experience and elevate your projects.">
</head>
<body onload="init()">
@@ -43,7 +48,9 @@
Copyright © 2023<br>
<a href="http://release11.com/">Release11 Sp. z. o. o.</a><br>
<a href="lawful/terms-of-service.html">Terms of use</a><br>
<a href="lawful/privacy-policy.html">Privacy statement</a>
<a href="lawful/privacy-policy.html">Privacy statement</a><bR>
<div class="separator"></div>
<a href="mailto:bugs@release11.com">Found a bug?</a>
</div>
</div>
<iframe id="frame" name="iframe" src="./tools/xpath.html" frameborder="0"></iframe>

24
Frontend/nginx.conf Normal file
View File

@@ -0,0 +1,24 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
expires -1;
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0";
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@@ -6,14 +6,15 @@
<meta charset="utf-8" />
<link rel="stylesheet" href="../assets/css/tools/r11form.css">
<link rel="stylesheet" href="../assets/css/json.css">
<link rel="stylesheet" href="../assets/css/highlight.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
<script src="../assets/scripts/tools/scripts.js"></script>
<script src="../assets/scripts/tools/highlight.js"></script>
<script src="../assets/scripts/tools/json.js"></script>
<script>hljs.highlightAll();</script>
</head>
<body>
<body onload="init()">
<div class="container">
<div id="tool" class="tool rwd-expandable">
<div class="tool-context">
@@ -224,38 +225,11 @@
hljs.addPlugin(mergeHTMLPlugin);
const editorEle = document.getElementById('jsonBlock');
function init() {
// Make sure that only plain text is pasted
configurePastingInElement("jsonBlock");
// Handle the `paste` event
editorEle.addEventListener('paste', function (e) {
// Prevent the default action
e.preventDefault();
// Get the copied text from the clipboard
const text = e.clipboardData
? (e.originalEvent || e).clipboardData.getData('text/plain')
: // For IE
window.clipboardData
? window.clipboardData.getData('Text')
: '';
if (document.queryCommandSupported('insertText')) {
document.execCommand('insertText', false, text);
} else {
// Insert text at the current position of caret
const range = document.getSelection().getRangeAt(0);
range.deleteContents();
const textNode = document.createTextNode(text);
range.insertNode(textNode);
range.selectNodeContents(textNode);
range.collapse(false);
const selection = window.getSelection();
selection.removeAllRanges();
selection.addRange(range);
}
});
</script>
</body>
</html>

View File

@@ -4,7 +4,12 @@
<head>
<!-- <link rel="stylesheet" href="styles.css"> -->
<link rel="stylesheet" href="../assets/css/tools/r11form.css">
<link rel="stylesheet" href="../assets/css/highlight.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
<script src="../assets/scripts/tools/scripts.js"></script>
<script src="../assets/scripts/tools/highlight.js"></script>
<script>hljs.highlightAll();</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
</head>
@@ -34,10 +39,7 @@
</div>
<textarea id="xmlArea" name="xmlArea" rows="15"
class="textarea-700 bordered-field vertically-resizeable max-width"
onblur="setDefaultContent(this, 'Insert XML here');"
onfocus="clearDefaultContent(this, 'Insert XML here');"></textarea>
<pre><code class="language-xml bordered-field textarea-700" id="xmlArea" contenteditable="True"></code></pre>
<br><br>
<button id="prettifyButton" class="max-width block-label action-button active"
onclick="performFormatRequest('prettify', true, 'xmlArea', 'xmlArea')">Prettify XML</button>
@@ -70,7 +72,7 @@
}
function init() {
setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
configurePastingInElement("xmlArea");
}
</script>

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,11 @@
<head>
<!-- <link rel="stylesheet" href="styles.css"> -->
<link rel="stylesheet" href="../assets/css/tools/r11form.css">
<link rel="stylesheet" href="../assets/css/highlight.css">
<script src="../assets/scripts/common/hljs.min.js"></script>
<script src="../assets/scripts/tools/scripts.js"></script>
<script src="../assets/scripts/tools/highlight.js"></script>
<script>hljs.highlightAll();</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
</head>
@@ -36,32 +40,25 @@
<button class="action-button active" id="prettyXMLButton" style="padding: 3px 10px;"
onclick="performFormatRequest('prettify', true, 'xmlArea', 'xmlArea')">Format XML</button>
<button class="action-button active" id="defaultXMLButton" style="padding: 3px 10px;"
onclick="fillDefaultXML(this)">Insert default XML</button>
onclick="fillDefaultXSD(this);">Insert default XML/XSD</button>
</div>
</div>
<!-- <span id="processorTooltipInfo">procInfo</span><br> -->
<label for="xmlArea"><b>Insert your XML:</b></label>
<textarea id="xmlArea" name="xmlArea" rows="15"
class="textarea-300 bordered-field vertically-resizeable max-width"
onblur="setDefaultContent(this, 'Insert XML here');"
onfocus="clearDefaultContent(this, 'Insert XML here');"></textarea>
<br><br>
<pre><code class="language-xml bordered-field textarea-300" id="xmlArea" contenteditable="True"></code></pre>
<br>
<label for="transformArea"><b>Insert your XSD:</b></label>
<textarea id="transformArea" name="transformArea" rows="15"
class="textarea-300 bordered-field vertically-resizeable max-width"
onblur="setDefaultContent(this, 'Insert XSD here');"
onfocus="clearDefaultContent(this, 'Insert XSD here');"></textarea>
<pre><code class="language-xml bordered-field textarea-300" id="transformArea" contenteditable="True"></code></pre>
<br>
<button id="requestButton" class="max-width block-label action-button active"
onclick="performRequest('xsd', true, true)">Verify XSD</button>
<br><br>
<br>
<label for="resultArea"><b>Result:<span id="procinfo"></span></b></label>
<textarea disabled id="resultArea" name="resultArea" rows="2"
class="bordered-field vert2ically-resizeable max-width" style="margin-bottom: 50px;"></textarea>
<pre><code class="language-xml bordered-field" id="resultArea"></code></pre>
</div>
</div>
@@ -84,6 +81,10 @@
<script>
function init() {
// Make sure that only plain text is pasted
configurePastingInElement("xmlArea");
configurePastingInElement("transformArea");
//Handle clicks in whole form and set info in tooltip
setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
setDefaultContent(document.getElementById("transformArea"), 'Insert XSD here');
@@ -98,7 +99,7 @@
}
processTooltip();
//
})
}

View File

@@ -4,7 +4,13 @@
<head>
<!-- <link rel="stylesheet" href="styles.css"> -->
<link rel="stylesheet" href="../assets/css/tools/r11form.css">
<link rel="stylesheet" href="../assets/css/highlight.css">
<script src="../assets/scripts/common/hljs.min.js"></script>
<script src="../assets/scripts/tools/scripts.js"></script>
<script src="../assets/scripts/tools/highlight.js"></script>
<script>hljs.highlightAll();</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8" />
</head>
@@ -45,26 +51,25 @@
<br>
<label for="xmlArea"><b>Insert your XML:</b></label>
<textarea id="xmlArea" name="xmlArea" rows="15"
class="textarea-300 bordered-field vertically-resizeable max-width"
onblur="setDefaultContent(this, 'Insert XML here');"
onfocus="clearDefaultContent(this, 'Insert XML here');"></textarea>
<br><br>
<pre><code class="language-xml bordered-field textarea-300" id="xmlArea" contenteditable="True"></code></pre>
<br>
<div class="display-space-between">
<label for="transformArea"><b>Insert your XSLT:</b></label>
<textarea id="transformArea" name="transformArea" rows="15"
class="textarea-300 bordered-field vertically-resizeable max-width"
onblur="setDefaultContent(this, 'Insert XSLT here');"
onfocus="clearDefaultContent(this, 'Insert XSLT here');"></textarea>
<div>
<button class="action-button active" id="defaultXSLTButton" style="padding: 3px 10px;"
onclick="fillDefaultXSLT()">Insert default XSLT
</button>
</div>
</div>
<pre><code class="language-xml bordered-field textarea-300" id="transformArea" contenteditable="True"></code></pre>
<br>
<button id="requestButton" class="max-width block-label action-button active"
onclick="performRequest('xslt', true, true)">Execute XSLT transform</button>
<br><br>
<br>
<label for="resultArea"><b>Transform result:<span id="procinfo"></span></b></label>
<textarea disabled id="resultArea" name="resultArea" rows="10"
class="textarea-300 bordered-field vertically-resizeable max-width"
style="margin-bottom: 50px;"></textarea>
<pre><code class="language-xml bordered-field textarea-300" id="resultArea"></code></pre>
</div>
</div>
@@ -1194,6 +1199,10 @@
}
function init() {
// Make sure that only plain text is pasted
configurePastingInElement("xmlArea");
configurePastingInElement("transformArea");
//Handle clicks in whole form and set info in tooltip
setDefaultContent(document.getElementById("xmlArea"), 'Insert XML here');
setDefaultContent(document.getElementById("transformArea"), 'Insert XSLT here');
@@ -1218,8 +1227,11 @@
}
processTooltip();
})
}
</script>
</body>

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd" targetNamespace="http://www.tibco.com/schemas/test/Test/Resources/Schema.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="values">
<xs:complexType>
<xs:sequence>
<xs:element name="value" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -1,4 +1,4 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://www.demo.com" xmlns:p="http://www.release11.com/person" xmlns:l="http://www.release11.com/library">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:b="http://www.release11.com/book" xmlns:p="http://www.release11.com/person" xmlns:l="http://www.release11.com/library">
<xsl:template match="/">
<Library>
<ReaderCount>

View File

@@ -540,7 +540,7 @@
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Response"
"$ref": "#/definitions/XPathResponse"
}
}
},
@@ -1006,6 +1006,39 @@
}
}
},
"XPathResponse": {
"type": "object",
"properties": {
"result": {
"type": "string",
"example": "4",
"description": "Result of performing transformation on provided XML"
},
"time": {
"type": "string",
"example": "320",
"description": "Computation time in milliseconds"
},
"processor": {
"type": "string",
"enum": [
"Saxon 10.3 2.0 over s9api",
"Xalan Java 2.7.2",
"libXml over lxml"
]
},
"status": {
"type": "string",
"enum": [
"OK"
]
},
"type": {
"type": "string",
"description": "Optional. Specifies type of data returned by Xalan or libXML."
}
}
},
"ResponseError": {
"type": "object",
"properties": {