Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
rdfxml-streaming-parser
Advanced tools
A fast, streaming RDF/XML parser that outputs RDFJS-compliant quads.
$ yarn install rdfxml-streaming-parser
This package also works out-of-the-box in browsers via tools such as webpack and browserify.
import {RdfXmlParser} from "rdfxml-streaming-parser";
or
const RdfXmlParser = require("rdfxml-streaming-parser").RdfXmlParser;
RdfXmlParser
is a Node Transform stream
that takes in chunks of RDF/XML data,
and outputs RDFJS-compliant quads.
It can be used to pipe
streams to,
or you can write strings into the parser directly.
const myParser = new RdfXmlParser();
fs.createReadStream('myfile.rdf')
.pipe(myParser)
.on('data', console.log)
.on('error', console.error)
.on('end', () => console.log('All triples were parsed!'));
const myParser = new RdfXmlParser();
myParser
.on('data', console.log)
.on('error', console.error)
.on('end', () => console.log('All triples were parsed!'));
myParser.write('<?xml version="1.0"?>');
myParser.write(`<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:ex="http://example.org/stuff/1.0/"
xml:base="http://example.org/triples/">`);
myParser.write(`<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">`);
myParser.write(`<rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar">`);
myParser.write(`<ex:prop />`);
myParser.write(`</rdf:Description>`);
myParser.write(`</rdf:RDF>`);
myParser.end();
Optionally, the following parameters can be set in the RdfXmlParser
constructor:
dataFactory
: A custom RDFJS DataFactory to construct terms and triples. (Default: require('@rdfjs/data-model')
)baseIRI
: An initital default base IRI. (Default: ''
)defaultGraph
: The default graph for constructing quads. (Default: defaultGraph()
)strict
: If the internal SAX parser should parse XML in strict mode, and error if it is invalid. (Default: false
)new RdfXmlParser({
dataFactory: require('@rdfjs/data-model'),
baseIRI: 'http://example.org/',
defaultGraph: namedNode('http://example.org/graph'),
strict: true,
});
This software is written by Ruben Taelman.
This code is released under the MIT license.
[1.0.0] - 2018-09-04
FAQs
Streaming RDF/XML parser
The npm package rdfxml-streaming-parser receives a total of 20,371 weekly downloads. As such, rdfxml-streaming-parser popularity was classified as popular.
We found that rdfxml-streaming-parser 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
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.