rdfxml-streaming-parser
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -22,2 +22,3 @@ /// <reference types="node" /> | ||
private readonly saxParser; | ||
private readonly validateUri; | ||
private readonly activeTagStack; | ||
@@ -32,2 +33,3 @@ private readonly nodeIds; | ||
static isValidIri(iri: string): boolean; | ||
get uriValidationEnabled(): boolean; | ||
/** | ||
@@ -146,2 +148,7 @@ * Parses the given text stream into a quad stream. | ||
allowDuplicateRdfIds?: boolean; | ||
/** | ||
* Enables validation of all URIs. Will throw an Error in case of an invalid URI. | ||
* By default, it is equal to true. | ||
*/ | ||
validateUri?: boolean; | ||
} | ||
@@ -148,0 +155,0 @@ export interface IActiveTag { |
@@ -27,2 +27,5 @@ "use strict"; | ||
} | ||
if (this.validateUri !== false) { | ||
this.validateUri = true; | ||
} | ||
this.saxParser = new saxes_1.SaxesParser({ xmlns: true, position: this.trackPosition }); | ||
@@ -39,2 +42,5 @@ this.attachSaxListeners(); | ||
} | ||
get uriValidationEnabled() { | ||
return this.validateUri; | ||
} | ||
/** | ||
@@ -92,3 +98,3 @@ * Parses the given text stream into a quad stream. | ||
// Validate URI | ||
if (!RdfXmlParser.isValidIri(uri)) { | ||
if (this.uriValidationEnabled && !RdfXmlParser.isValidIri(uri)) { | ||
throw this.newParseError(`Invalid URI: ${uri}`); | ||
@@ -95,0 +101,0 @@ } |
{ | ||
"name": "rdfxml-streaming-parser", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Streaming RDF/XML parser", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -98,2 +98,3 @@ # RDF/XML Streaming Parser | ||
* `allowDuplicateRdfIds`: By default [multiple occurrences of the same `rdf:ID` value are not allowed](https://www.w3.org/TR/rdf-syntax-grammar/#section-Syntax-ID-xml-base). By setting this option to `true`, this uniqueness check can be disabled. _(Default: `false`)_ | ||
* `validateUri`: By default, the parser validates each URI. _(Default: `true`)_ | ||
@@ -108,2 +109,3 @@ ```javascript | ||
allowDuplicateRdfIds: true, | ||
validateUri: true, | ||
}); | ||
@@ -110,0 +112,0 @@ ``` |
816
116
46273
9