
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@styleshit/xml-parser
Advanced tools
Simple XML to AST parser in TypeScript.
This parser has a custom grammar and exists for learning purposes.
The parser supports elements (''), attributes (''), and text nodes ('text').
It does not support comments, self-closing tags, or other XML features.
npm install @styleshit/xml-parser
To use it, import the parse function and pass an XML string to it.
For example, this code:
import { parse } from '@styleshit/xml-parser';
const ast = parse(`
<root>
<element attribute="value">first text</element>
</root>
<sibling>another text</sibling>
`);
console.log(ast);
Will output:
const ast = {
kind: 'document',
children: [
{
kind: 'element',
name: 'root',
children: [
{
kind: 'element',
name: 'element',
children: [
{
kind: 'text',
text: 'first text',
},
],
attributes: {
attribute: 'value',
},
},
],
attributes: {},
},
{
kind: 'element',
name: 'sibling',
children: [
{
kind: 'text',
text: 'another text',
},
],
attributes: {},
},
],
};
While this code will throw an error:
import { parse } from '@styleshit/xml-parser';
const ast = parse('<element>text</another-element>');
// SyntaxError: Expected closing tag for 'element' at index 13. Got 'another-element' instead.
FAQs
Simple XML to AST parser in TypeScript
We found that @styleshit/xml-parser 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.