Re: [jats-list] how to identify a XML file as JATS

Subject: Re: [jats-list] how to identify a XML file as JATS
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Tue, 24 Sep 2013 19:11:09 +0200
Hi Matteo,

if youbre using emacs nxml mode, you need to convert the .rng files to .rnc (Relax NG compact syntax). You may use https://github.com/oleg-pavliv/emacs/tree/master/xsl/RngToRnc-1_4 to convert it. Or I can send you the converted files b I just tested whether it works on the JATS .rng files.

Then you have to set up schema association rules for nxml.

You can put a file schemas.xml in your working directory, like this:
<locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0";>
<uri pattern="*.jats.xml" uri="file:/home/gerrit/XML/JATS/schema/JATS_Archiving_1.0/rnc/JATS-archivearticle1.rnc"/>
</locatingRules>


It should be possible to store these rules centrally for emacs, but they are somewhat limited in the criteria upon which you can make nxml select a certain schema. http://infohost.nmt.edu/tcc/help/pubs/nxml/schema-locating.html

Otherwise, you may use the xml-model processing instruction after the XML declaration in order to associate a Relax NG schema with the XML file, like this:

<?xml-model href="file:/c:/cygwin/home/gerrit/XML/JATS/schema/JATS_Archiving_1.0/rng/JATS-archivearticle1.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0";?>

But few applications honor this PI. oXygen XML editor is a notable exception.

You donbt have to include a schema declaration at all in the file. You just invoke jing with the schema and the file location.

If the DOCTYPE declaration is present, most XML parsers will look for the DTD in order to resolve named entity references. You may not supply a schema of another type than DTD in the DOCTYPE declaration. But you may well drop the DOCTYPE declaration altogether.

If you use xlink:href attributes in the document, you may need to declare xmlns:xlink="http://www.w3.org/1999/xlink"; in your document which didnbt seem to be necessary with the DTD (to my surprise).

Hope this helps.

Gerrit


On 24.09.2013 17:34, Matteo Gamboz wrote:
Hi all,
   I'm a bit new to XML and was wandering how to best identify a
certain XML file as implementing JATS.

At the moment I'm using this document type declaration:

<!DOCTYPE article PUBLIC
  "Journal Archiving and Interchange Tag Library NISO JATS version 1.0"
  "http://jats.nlm.nih.gov/archiving/1.0/JATS-archivearticle1.dtd";>

Since I prefer to validate against RNG schema, I tried to substitute
the link above with:
http://jats.nlm.nih.gov/archiving/1.0/rng/JATS-archivearticle1.rng

But then I end up with validation errors on the linked rng file (using
"jing" and "xmllint", but not with "emacs" (which doesnt seem to test
it anyway)).

I'm not even sure wheter DOCTYPE is the best option here.

Could anyone point me in the right direction?

Thanks
m


-- Gerrit Imsieke GeschC$ftsfC<hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

GeschC$ftsfC<hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard VC6ckler

Current Thread