Skip to content

Instantly share code, notes, and snippets.

View teswar's full-sized avatar

Thirueswaran Rajagopalan teswar

View GitHub Profile
@teswar
teswar / clone.and.append.element.into.XmlDocument.js
Last active April 11, 2018 12:06
Deserializing and Serializing with XMLDocument | Parsing and XMLDocument from its string representation, cloning its inner element and appending to its parent ..
class XMLHelper {
static isValid(xmlDocument) {
return (xmlDocument && !xmlDocument.getElementsByTagName('parsererror').length);
}
static deserialize(xmlString) {
return (new DOMParser()).parseFromString(xmlString, "application/xml");
}
static serialize(xmlDocument) {
return (new XMLSerializer()).serializeToString(xmlDocument);
@teswar
teswar / fetch.all.pages.of.jsonmock.searchresult.js
Last active April 11, 2018 12:05
Node JS Tryouts | Fetching all search result page result, sorting by ascending and dumping to console. Node JS
/****
* fetching all pages of search result ...
* Node JS tryouts....
* https://repl.it/@teswar/fetchallpagesofjsonmocksearchresult
************/
const https = require('https');
/*
* compose url with query params appended...