From 7ce9133487582bec6fcfe5bc6e8f6d69515351a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20W=C4=85sik?=
<32049761+Eghizio@users.noreply.github.com>
Date: Mon, 24 Jan 2022 18:20:55 +0100
Subject: [PATCH] Syntax highlighting in README.md
Added JavaScript syntax highlighting for README.md for better readability of the docs.
---
README.md | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 3fe3253..ad30b76 100644
--- a/README.md
+++ b/README.md
@@ -41,7 +41,7 @@ JSFiddle at http://jsfiddle.net/abdmob/gkxucxrj/1/
## XML to JSON
-```
+```js
// Create x2js instance with default config
var x2js = new X2JS();
var xmlText = "Success- val1
- val2
";
@@ -50,7 +50,7 @@ var jsonObj = x2js.xml_str2json( xmlText );
## JSON to XML
-```
+```js
// Create x2js instance with default config
var x2js = new X2JS();
var jsonObj = {
@@ -68,7 +68,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Configure XML structure knowledge beforehand
-```
+```js
var x2js = new X2JS({
arrayAccessFormPaths : [
"MyArrays.test.item"
@@ -86,7 +86,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Or using the utility function
-```
+```js
var x2js = new X2JS();
var xmlText = ""+
"- success
- second
"+
@@ -99,7 +99,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Accessing to XML attributes
-```
+```js
// Create x2js instance with default config
var x2js = new X2JS();
@@ -117,7 +117,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Configuring a custom prefix to attributes
-```
+```js
var x2js = new X2JS({
attributePrefix : "$"
});
@@ -134,7 +134,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Parsing XML with namespaces
-```
+```js
var xmlText = ""+
"Success"+
"- ddsfg
- dsdgfdgfd
testArrSize";
@@ -145,7 +145,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Creating JSON (for XML) with namespaces (Option 1)
-```
+```js
var testObjC = {
'm:TestAttrRoot' : {
'_tns:m' : 'http://www.example.org',
@@ -162,7 +162,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Creating JSON (for XML) with namespaces (Option 2)
-```
+```js
// Parse JSON object constructed with another NS-style
var testObjNew = {
TestAttrRoot : {
@@ -186,7 +186,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Configuring it beforehand
-```
+```js
var x2js = new X2JS({
datetimeAccessFormPaths : [
"MyDts.testds" /* Configure it beforehand */
@@ -201,7 +201,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Or using the utility function
-```
+```js
var x2js = new X2JS();
var xmlText = ""+
@@ -216,7 +216,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Parsing AJAX XML response (JQuery sample)
-```
+```js
$.ajax({
type: "GET",
url: "/test",
@@ -231,7 +231,7 @@ var xmlAsStr = x2js.json2xml_str( jsonObj );
## Loading XML and converting to JSON
-```
+```js
function loadXMLDoc(dname) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();