XML API results do not validate against the schema

doi: 10.46936/10.25585/60000611
request results as unixsd, i.e. using the schema crossref_query_output3.0.xsd

validate results against xsd using the online validator at utilities-online.info gives the errors:

  • Element ‘{http www crossref org/qrschema/3.0}doi’, attribute ‘type’: [facet ‘enumeration’] The value ‘grant’ is not an element of the set {‘journal_title’, ‘journal_issue’, ‘journal_volume’, ‘journal_article’, ‘conference_title’, ‘conference_series’, ‘conference_paper’, ‘book_title’, ‘book_series’, ‘book_content’, ‘component’, ‘dissertation’, ‘report-paper_title’, ‘report-paper_series’, ‘report-paper_content’, ‘standard_title’, ‘standard_series’, ‘standard_content’, ‘prepublication’}.

  • Element ‘{http www crossref org/xschema/1.1}crossref’: No matching global element declaration available, but demanded by the strict wildcard.

Validating the results of the same DOI but with output format unixref (I had to fix the links in the schemaLocations of the xsd:import tags), I get the error:

  • Element ‘doi_records’: No matching global declaration available for the validation root.

I’ve also tried using the python xmlschema library to parse the output, but I get the same validation errors (grant is not valid, no doi_records).

Re: the unixsd format query: if I fix the missing grant in the type field, validation fails due to numerous references to URLs containing www.crossref.org/xschema/ which return 404s.

Some background info on my use case may be helpful here.

I want to build a robust parser for CrossRef data and remap CrossRef fields to the schema that we use locally. For DataCite, I can autogenerate a set of models for their citation using the XSD and a python library. I can’t do that for CrossRef because there are circular references in the MathML XSD files that break the python library. Another option is to use the XSDs to parse the XML output from the CrossRef API. However, if the XML output does not match the XSDs, this method won’t work as the library will throw validation errors.

I asked about the schema for the JSON endpoints in another request. If there is somewhere in one of the crossref codebases where I can look to deduce the schema of the JSON output, I am happy to do that. I’m not particularly tied to JSON or XML, I just want to be able to build a parser and translator that can reliably convert the output from the CrossRef API to fit the local schema. Any suggestions?


Hi @ialarmedalien ,

You’ll need to add the Grant ID Schema 0.1.1 as well. It is available here: https://0-www-crossref-org.pugwash.lib.warwick.ac.uk/schemas/grant_id0.1.1.xsd. This might also prove to be helpful: XSD schema quick reference - Crossref.

We’ve moved our documentation to swagger, but this might also be helpful: https://github.com/CrossRef/rest-api-doc.

My best,

Hi @ifarley ,

I’ve been consulting the documentation heavily, which is why I’m finding it frustrating that results from the various APIs don’t match with what the documentation and published schemas say that they should be.

Thanks – that was useful, and I was able to put together a skeletal JSONschema version of the REST API output.

Unfortunately, the schema described in that documentation is not correct if the work being retrieved describes a grant, which is what I asked about in this other post: