
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
saxxmlparser
Advanced tools
A small package to transverse xml into javascript
import { readFileSync } from "fs";
import parse from "saxxmlparser";
var xml = readFileSync("xml.xml");
parse(xml).then((node) => {
var price = node.resolveNSPath(
"A:envelope/A:body/B:getstockPriceResponsE/B:price",
{
A: "http://www.w3.org/2001/12/soap-envelope",
B: "http://www.example.org/stock",
}
);
console.log(price.value); // Prints 34.5
});
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>
</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>
import { readFileSync } from "fs";
import parse from "saxxmlparser";
var xml = readFileSync("xml.xml");
parse(xml).then((node) => {
var price = node.resolveNSPath(
"A:envelope/A:body/B:getstockPriceResponsE/B:price", // Put the absolute path to the child in here
{
A: "http://www.w3.org/2001/12/soap-envelope",
B: "http://www.example.org/stock",
}
);
console.log(price.value); // Prints 34.5
});
Sometimes when you only want a specific child but the parents or the path does not matter
import { readFileSync } from "fs";
import parse from "saxxmlparser";
var xml = readFileSync("xml.xml");
parse(xml).then((node) => {
// A double slash (//) in front of the search triggers a child search
var price = node.resolveNSPath(
"//B:price", // Put the absolute path to the child in here
{
A: "http://www.w3.org/2001/12/soap-envelope",
B: "http://www.example.org/stock",
}
);
console.log(price.value); // Prints 34.5
});
Sometimes when you only want a specific child but the parents or the path does not matter
import { readFileSync } from "fs";
import parse from "saxxmlparser";
var xml = readFileSync("xml.xml");
parse(xml).then((node) => {
// A double slash (//) in front of the search triggers a child search
var price = node.resolveNSPath(
"//B:GetStockPriceResponse/B:price", // Put the absolute path to the child in here
{
A: "http://www.w3.org/2001/12/soap-envelope",
B: "http://www.example.org/stock",
}
);
console.log(price.value); // Prints 34.5
});
Parses the supplied xml and returns the root node If strict is set to true, the sax parser will be instructed to use strict mode (defaults to true)
parse(xml, strict = true): Promise<XmlNode>
FAQs
An xml parsing utility using the sax engine
We found that saxxmlparser demonstrated a not healthy version release cadence and project activity because the last version was released 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.