2

I am going to convert relaxng compact file to xsd. So the command to user here would be:

java -jar tang.jar test.rng newtest.xsd 

My question here is as follow: I have several rnc file in which some of them have the reference to another rnc file. For example I have test1.rnc as follow:

start= test
test = 
  element test {
  (element ref {xsd:anyURL}?,
   element links {
     element link {
         attribute handle {text},
         attribute id {text}
      }*
   }?,
   element name { text }?,
   external "util/phone.rnc"?
}

and in the util folder I have phone.rnc which is like this:

start = phone
phone = 
   element phone {
     element number {
       element phonenumber {text }' 
       element type { text }?
    },
  }

So my question is that how can I convert them to xsd in a correct way? I tried trang but got test.rnc:29:6: error: sorry, externalRef is not yet supported

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
kiarash
  • 23
  • 4

1 Answers1

0

First run jing on the schema with the -s option to generate a “simplified“ version:

java -jar jing.jar -s -c test.rnc > test-simplified.rnc

Then give that simplified schema as input to trang:

java -jar trang.jar test-simplified.rnc newtest.xsd

If the version of jing you have doesn’t provide the -s option, then you need to either find and install a new version, or else just build a new version from the sources:

git clone https://github.com/relaxng/jing-trang.git
cd jing-trang
./ant
java -jar build/jing.jar

The last command should emit something like this:

Jing version 20151127
usage: java com.thaiopensource.relaxng.util.Driver [-i] [-c] [-s] [-t] [-C catalogFile] [-e encoding] RNGFile XMLFile...
RELAX NG is a schema language for XML
See http://relaxng.org/ for more information.  
sideshowbarker
  • 81,827
  • 26
  • 193
  • 197