Reputation: 12571
I have a RelaxNG schema that's broken into several .rnc
files. I would like to be able to convert them into a DTD, but trang
complains about my use of the external
directive:
$ trang schema/text.rnc schema/text.dtd
[...]/schema/text.rnc:3:6: error: sorry, "externalRef" is not supported
[...]/schema/text.rnc:4:9: error: sorry, "externalRef" is not supported
[...]/grcxml/schema/text.rnc:6:15: error: sorry, "externalRef" is not supported
[...]/schema/text.rnc:3:6: error: sorry, "externalRef" is not supported
Exception in thread "main" java.lang.NullPointerException
at com.thaiopensource.relaxng.output.dtd.ContentType.ref(ContentType.java:138)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitRef(Analysis.java:232)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitRef(Analysis.java:78)
at com.thaiopensource.relaxng.edit.RefPattern.accept(RefPattern.java:9)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.analyzeContentType(Analysis.java:336)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitGroup(Analysis.java:216)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitGroup(Analysis.java:78)
at com.thaiopensource.relaxng.edit.GroupPattern.accept(GroupPattern.java:5)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.analyzeContentType(Analysis.java:336)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitElement(Analysis.java:118)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitElement(Analysis.java:78)
at com.thaiopensource.relaxng.edit.ElementPattern.accept(ElementPattern.java:9)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.analyzeContentType(Analysis.java:336)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitRef(Analysis.java:232)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitRef(Analysis.java:78)
at com.thaiopensource.relaxng.edit.RefPattern.accept(RefPattern.java:9)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.analyzeContentType(Analysis.java:336)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitDefine(Analysis.java:288)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitDefine(Analysis.java:78)
at com.thaiopensource.relaxng.edit.DefineComponent.accept(DefineComponent.java:39)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitContainer(Analysis.java:278)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitGrammar(Analysis.java:258)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.visitGrammar(Analysis.java:78)
at com.thaiopensource.relaxng.edit.GrammarPattern.accept(GrammarPattern.java:14)
at com.thaiopensource.relaxng.output.dtd.Analysis$Analyzer.analyzeContentType(Analysis.java:336)
at com.thaiopensource.relaxng.output.dtd.Analysis.<init>(Analysis.java:534)
at com.thaiopensource.relaxng.output.dtd.DtdOutputFormat.output(DtdOutputFormat.java:22)
at com.thaiopensource.relaxng.translate.Driver.run(Driver.java:144)
at com.thaiopensource.relaxng.translate.Driver.main(Driver.java:44)
Trang's ability to stuff an expressive schema like RelaxNG into a dim-bulb DTD seems miraculous enough that this roadblock surprises me. external
includes are so nice for sharing definitions across schemata, I would hate to lose them. What would be the best way then to make this possible?
Upvotes: 1
Views: 359
Reputation: 151491
If you don't care that the DTD won't replicate the division into files of the source, you could use jing
first:
$ jing -s source.rng > intermediate.rng
$ trang intermediate.rng final.dtd
The first step will combine everything into one file. The second will convert.
Upvotes: 3
Reputation: 1744
I think you can use Trang to convert the .rnc compact schema to .rng, which should incorporate the external schemas into the main schema. Once you have a single .rng file, you might be able to convert that to a DTD.
See also https://code.google.com/p/jing-trang/issues/detail?id=51 and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=264706 .
Upvotes: 1