angerhang / mockDoc

0 stars 0 forks source link

RelaxNG schema for doc.cls #4

Closed kohlhase closed 9 years ago

kohlhase commented 9 years ago

Make a RelaxNG schema for doc.cls. Read over http://www.relaxng.org/compact-tutorial-20030326.html and come up with a schema (called doc.rnc). It would probably be good to write an XML file (e.g. mockDoc.xml) by hand that has the form you want to generate with LaTeXML and then use that to test your schema. I always use emacs with nxml-mode to develop RelaxNG schemata (I can show you).

kohlhase commented 9 years ago

how did you write the XML file? It looks like LaTeXML had created it, but I do not see a LaTeXML binding.

angerhang commented 9 years ago

I thought I need to mimic what the the output of LaTeXML. I just changed it into a customized version.

jinbozz commented 9 years ago

I checked LaTeXML.rnc & LaTeXML-structure.rnc, which are in totally different form. Is this schema written by Hang OK?

kohlhase commented 9 years ago

I am impressed by your learning curve.

The schema is completelly OK, but not very maintainable (meaning people like Deyan, Bruce, and me are not used to reading them). It would be good if you could transform it into a form which introduces a macro for every element.

angerhang commented 9 years ago

mockDoc.rng and mockDoc.rnc are completed. Namespace has also been added. Is it time to close this issue and move on to the next one now?

kohlhase commented 9 years ago

looks good except for a few things:

the namespace handling is wrong, the way you had it, you only had the top-level in the md namespace, you want

default namespace = "http:..."

in the schema and

<document xmlns="https:kwarc.info/projects/mockDoc">

in the XML file. That gives you all elements in in the right namespace (which is what you want).

Furthermore,

... foo ... 
foo = element foo {...}*

is non-standard (and bad for reuse) , you want

... foo* ... 
foo = element foo {...}

in the schema,

I have made the changes, so we can close now.