diff --git a/lib/RdfXmlParser.ts b/lib/RdfXmlParser.ts
index c480a47..4430c4f 100644
--- a/lib/RdfXmlParser.ts
+++ b/lib/RdfXmlParser.ts
@@ -306,7 +306,9 @@ while ${attribute.value} and ${activeSubjectValue} where found.`);
// Interpret attributes at this point as properties on this node,
// but we ignore attributes that have no prefix or known expanded URI
- if (attribute.prefix !== 'xml' && attribute.uri) {
+ if (attribute.prefix !== 'xml' && attribute.prefix !== 'xmlns'
+ && (attribute.prefix !== '' || attribute.local !== 'xmlns')
+ && attribute.uri) {
predicates.push(this.uriToNamedNode(attribute.uri + attribute.local));
objects.push(attribute.value);
}
diff --git a/test/RdfXmlParser-test.ts b/test/RdfXmlParser-test.ts
index 995f8e5..1b753e6 100644
--- a/test/RdfXmlParser-test.ts
+++ b/test/RdfXmlParser-test.ts
@@ -930,20 +930,71 @@ abc`)).rejects.toBeTruthy();
]);
});
-
- it('declaration of the namespace on the element', async () => {
+ it('declaration of the default namespace on the property element', async () => {
return expect(await parse(parser, `
-
+
RDF1.1 XML Syntax
`))
.toBeRdfIsomorphic([
- quad('http://www.w3.org/TR/rdf-syntax-grammar',
+ quad('http://example.com',
'http://purl.org/dc/terms/title', '"RDF1.1 XML Syntax"@en'),
]);
});
+ it('declaration of the namespace on the property element', async () => {
+ return expect(await parse(parser, `
+
+
+ RDF1.1 XML Syntax
+
+`))
+ .toBeRdfIsomorphic([
+ quad('http://example.com',
+ 'http://purl.org/dc/terms/title', '"RDF1.1 XML Syntax"@en'),
+ ]);
+ });
+
+ it('declaration of the namespace on the resource element', async () => {
+ return expect(await parse(parser, `
+
+
+ RDF1.1 XML Syntax
+
+`))
+ .toBeRdfIsomorphic([
+ quad('http://example.com',
+ 'http://purl.org/dc/terms/title', '"RDF1.1 XML Syntax"@en'),
+ ]);
+ });
+
+ it('declaration of the default namespace on the resource element', async () => {
+ return expect(await parse(parser, `
+
+
+ RDF1.1 XML Syntax
+
+`))
+ .toBeRdfIsomorphic([
+ quad('http://example.com',
+ 'http://purl.org/dc/terms/title', '"RDF1.1 XML Syntax"@en'),
+ ]);
+ });
+
+
+ it('declaration of the namespace on a typed resource element', async () => {
+ return expect(await parse(parser, `
+
+
+
+`))
+ .toBeRdfIsomorphic([
+ quad('http://example.com',
+ 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', 'http://purl.org/dc/terms/Standard'),
+ ]);
+ });
+
it('cdata support', async () => {
return expect(await parse(parser, `
@@ -957,7 +1008,6 @@ abc`)).rejects.toBeTruthy();
]);
});
-
it('DOCTYPE and ENTITY\'s', async () => {
return expect(await parse(parser, `