Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
MergeXML merges the XML sources (files, strings, objects) into single DOM XML object. The merging is performed recursively on the node level adding new elements and replacing existing ones. The nodes with the same path/name are replaced/added sequentially and the modification can be controlled by the options.
MergeXML could be useful in cases where it is necessary to gather XML data from multiple sources. For example, to combine configuration files of different subsystems depending on the application logic.
Main browsers (Chrome, Edge, IE, Firefox, Safari, Opera) and NodeJS (see below) are supported. The MergeXML is realized also in PHP (see php-merge-xml).
MergeXML class can be included:
const MergeXML = require('./mergexml');
<script src="mergexml.js"></script>
The class instantiation:
var oMX = new MergeXML([opts]);
or loading and instantiating at once:
const oMX = new (require('./mergexml.js'))([opts]);
opts - the options object:
oMX.AddSource(source);
source - XML string or DOM object
oMX.AddFile(elem);
elem - FileList element of the XML file (browsers only)
The methods merge a sequent source and return the final object or false if failed (see error property below).
oMX.Init([opts]);
Clear existing result to restart.
opts - the options object as above (except path)
You can search in the result object:
oMX.Query(expr);
expr - XPath query expression
You can get the XML result tree:
oMX.Get([0|1|2]);
The result object can be accessed also via oMX.dom property. The properties available:
The sources must have the same default namespace (if have at all). Prefix '_' is reserved to handle the default namespace. IE doesn't allow replacement of the root node attributes.
Run from the appropriate directory:
npm install mergexml
Or manually download the js-merge-xml package from Github and unzip the files into installation directory.
Run the sample in your browser (HTML5 compatible):
To run the browsers' tests from the CLI:
npm install --dev
npm test
npm prune --prod
The browser window objects' (DOMParser, XPathEvaluator, XMLSerializer) functionality is implemented by the xpath, xmldom modules as node global objects. The sample requires also the formidable module.
Install the dependent modules:
npm install --prod
Start NodeJS with the sample script:
node examplen.js
Run the sample in your browser:
The following files are included:
June/July 2015 (Martijn van de Rijdt)
October 2016 (Martijn van de Rijdt)
August 2019 (Vallo Reima)
FAQs
Merge multiple XML sources
The npm package mergexml receives a total of 51,150 weekly downloads. As such, mergexml popularity was classified as popular.
We found that mergexml demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.