Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error for tags using namespaces declared within same tag #40

Open
ekulno opened this issue Jul 23, 2020 · 6 comments
Open

Error for tags using namespaces declared within same tag #40

ekulno opened this issue Jul 23, 2020 · 6 comments
Labels
bug Something isn't working

Comments

@ekulno
Copy link

ekulno commented Jul 23, 2020

The RDF/XML parser emits an error for tags whose namespace is declared within that same tag. For example, endDate in the following snippet uses the namespace that appears inside the endDate tag:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <rdf:Description rdf:about="http://eurovoc.europa.eu/1">
    <endDate xmlns="http://publications.europa.eu/ontology/euvoc#" rdf:datatype="http://www.w3.org/2001/XMLSchema#date">1995-10-01</endDate>
  </rdf:Description>
</rdf:RDF>

The error message reads as follows:

ParseError: Found both non-rdf:* property attributes and rdf:datatype (http://www.w3.org/2001/XMLSchema#date).

The W3C RDF/XML validation service is able parse the data and resolves it to this triple:

<http://eurovoc.europa.eu/1> <http://publications.europa.eu/ontology/euvoc#endDate> "1995-10-01"^^<http://www.w3.org/2001/XMLSchema#date>.
@rubensworks
Copy link
Member

I recently fixed a similar problem. Can you check if you're running the latest version of the parser?

@ekulno
Copy link
Author

ekulno commented Jul 23, 2020

Version 1.3.6.

index.js:

const fs = require('fs');
const RdfXmlParser = require("rdfxml-streaming-parser").RdfXmlParser;
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!'));

myfile.rdf as in the issue description. package.json:

{
  "dependencies": {
    "rdfxml-streaming-parser": "^1.3.6"
  }
}

@rubensworks
Copy link
Member

Thanks for checking, that's the latest indeed.

@rubensworks rubensworks added the bug Something isn't working label Jul 23, 2020
@rubensworks
Copy link
Member

This may be resolved in release 2.x with our recent migration to a different underlying XML parser.

@LaurensRietveld
Copy link

Sorry to say it's still an issue!

@rubensworks
Copy link
Member

Thanks for checking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants