Security News
Supply Chain Attack Detected in @solana/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.
rexml
is a Node.JS package for simple XML parsing with a regular expression. It's been tested to work for simple use cases (does work on nested tags).
yarn add rexml
The package is available by importing its default and named functions:
import rexml, { extractProps, extractTagsSpec, extractPropSpec } from 'rexml'
rexml(
tag: string,
string: string,
): {content, props}[]
Extract tags from the XML string. The tags are returned as an array with objects containing content
and props
properties. The content is the inner content of the tag, and props
is the attributes specified inside the tag.
/* yarn example/ */
import extractTags from 'rexml'
const xml = `
<html>
<div id="d1"
class="example"
contenteditable />
<div id="d2" class="example">Hello World</div>
</html>
`
const res = extractTags('div', xml)
console.log(JSON.stringify(res, null, 2))
[
{
"content": "",
"props": {
"id": "d1",
"class": "example",
"contenteditable": true
}
},
{
"content": "Hello World",
"props": {
"id": "d2",
"class": "example"
}
}
]
extractProps(
string: string,
parseValue?: boolean,
): Object<string,(boolean|string|number)>
Extracts the properties from the attributes part of the tag and returns them as an object. It will parse values if not specified otherwise.
Source | Output |
---|---|
|
|
extractTagsSpec(
tag: string,
string: string,
): {content, props}[]
Same as the default method, but confirms to the XML specification in defining attributes.
import { extractTagsSpec } from 'rexml'
const xml = `
<html>
<div id="d1" class="example" contenteditable />
<div 5-non-spec>Attributes cannot start with a number.</div>
</html>`
const res = extractTagsSpec('div', xml)
console.log(JSON.stringify(res, null, 2))
[
{
"props": {
"id": "d1",
"class": "example",
"contenteditable": true
},
"content": ""
}
]
© Art Deco 2019 | Tech Nation Visa Sucks |
---|
FAQs
Simple XML parsing with a regular expression.
The npm package rexml receives a total of 70 weekly downloads. As such, rexml popularity was classified as not popular.
We found that rexml 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
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.