Are you sure you want to go to an external site to donate a monetary value?
WARNING: Some countries laws may supersede the payment processors policy such as the GDPR and PayPal. While it is highly appreciated to donate, please check with your countries privacy and identity laws regarding privacy of information first. Use at your utmost discretion.
Greetings.
I Have created two methods to facilitate the use of XPath Queries.
Functions
Node.prototype.queryPathAll = function (xmlns, expression) { let data = this.ownerDocument || this; let nodes = data.evaluate( expression, this, () => xmlns, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); let results = []; let node = nodes.iterateNext(); while (node) { // Add the link to the array results.push(node); // Get the next node node = nodes.iterateNext(); } return results; }; Node.prototype.queryPath = function (xmlns, expression) { let data = this.ownerDocument || this; return data.evaluate( expression, this, () => xmlns, XPathResult.FIRST_ORDERED_NODE_TYPE, null) .singleNodeValue; };Usage
Set "xmlns" to "null" for OPML, RSS, HTML, and other documents without "xmlns".
let nodeFeed = xmlFile.queryPath(xmlns.atom, "atom:feed") let nodeNext = nodeFeed.queryPath(xmlns.atom, "atom:link[@rel='next']"); let nodePrevious = nodeFeed.queryPath(xmlns.atom, "atom:link[@rel='previous']"); let nodesEntry = nodeFeed.queryPathAll(xmlns.atom, "atom:entry"); for (const nodeEntry of nodesEntry) { // Your code here. }Namespace
xmlns = { "atom" : "http://www.w3.org/2005/Atom", "content" : "http://purl.org/rss/1.0/modules/content/", "dc" : "http://purl.org/dc/elements/1.1/", "foaf" : "http://xmlns.com/foaf/0.1/", "geo" : "http://www.w3.org/2003/01/geo/wgs84_pos#", "metalink4" : "urn:ietf:params:xml:ns:metalink", "metalink" : "http://www.metalinker.org/", "owl" : "http://www.w3.org/2002/07/owl#", "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "rdfs" : "http://www.w3.org/2000/01/rdf-schema#", "rss" : "http://purl.org/rss/1.0/", "smf" : "http://www.simplemachines.org/xml/recent", "syn" : "http://purl.org/rss/1.0/modules/syndication/", "xhtml" : "http://www.w3.org/1999/xhtml", "xlink" : "http://www.w3.org/1999/xlink", "xsl" : "http://www.w3.org/1999/XSL/Transform" }For examples, please refer to the source code of Greasemonkey StremBurner (Newspaper).
https://openuserjs.org/scripts/sjehuda/Newspaper
Kindly,
Schimon