[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] an xml schema for (single|multiple)_cell_document file XML for
From: |
Greg Chicares |
Subject: |
Re: [lmi] an xml schema for (single|multiple)_cell_document file XML format |
Date: |
Thu, 15 Mar 2012 16:43:44 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 5.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
On 2012-03-12 14:46Z, Václav Slavík wrote:
[...]
> I am also attaching an example census.xsd file with XML Schema converted
> from census.rnc. It's rather large (126kB compared to <19kB of .rnc files),
> although not as large as its corresponding RELAX NG XML file (409kB). It's
> much less human-readable than the .rnc files, though. For one thing, it's
> heavily structured, verbose XML, that is inhuman in itself. But to make
> matters worse, Trang doesn't support RELAX NG external references that I
> rely on.
"error: sorry, externalRef is not yet supported"
http://code.google.com/p/jing-trang/issues/detail?id=51
> So I had to run the .rnc files through jing -s to produce simplified
> versions without them (this is how I ended up with 409kB of .rng file)
> and convert that to .xsd. This simplification step removed (by expanding
> them) custom data types and duplicated the schema parts corresponding to
> <cell>, making it a poor choice for human reading.
>
> The results aren't that bad if the simplification step is omitted — see
> attached illustration.xsd. I had to modify illustration.rnc to produce it,
> by removing the external reference and inlining cell.rnc. That wouldn't be
> a good idea for maintenance, cell.rnc is shared by both .cns and .ill files.
> If you think you'll need nice XML Schema files, then we can either write
> some custom script to merge cell.rnc into the other two files before passing
> them to trang, or to implemented externalRefs support directly in Trang.
Vadim persuaded me that it's prudent to maintain our ability to create
an .xsd from our .rnc files, so our options are:
(a) 'jing -s' --> 'trang', but the 400 KB .rng and 125 KB .xsd contain
duplicated parts, which we'd rather avoid (if anyone wants the .xsd,
they might want to read it, but it's too ugly)
(b) modify .rnc (e.g., with a script), then use 'trang', yielding a
45 KB .xsd; but this is cumbersome
Is this a viable third option?
(c) the obstacle is a 'trang' defect
http://code.google.com/p/jing-trang/issues/detail?id=51
affecting "external", so use "include" instead, giving
a 1 KB census.xsd and a 45 KB cell.xsd (shared with illustration.xsd)
It appears to work with the following diffs; am I overlooking
some problem this would cause?
--- cell.rnc 2012-03-14 12:44:19.506496100 +0000
+++ cell.i.rnc 2012-03-15 15:52:36.000000000 +0000
@@ -2,7 +2,7 @@
# This is not meant for standalone use, but rather for inclusion from other
# grammars.
-start =
+CELL =
element cell {
attribute version {"6"},
--- census.rnc 2012-03-14 12:44:20.000000000 +0000
+++ census.i.rnc 2012-03-15 15:57:20.000000000 +0000
@@ -1,15 +1,19 @@
# RELAX NG schema for Census documents (.cns files).
+start =
element multiple_cell_document {
attribute version {"1"},
element case_default {
- external "cell.rnc"
+ CELL
},
element class_defaults {
- external "cell.rnc" +
+ CELL +
},
element particular_cells {
- external "cell.rnc" +
+ CELL +
}
}
+
+include "cell.i.rnc"
+