Page 1 of 1

XInclude and Relax NG: How to use?

Posted: Wed Sep 22, 2010 12:40 pm
by m0ps
Hello,
i'm new to xml and especially rng. Now i have the following problem:
My xml file contains a construction like:

Code: Select all


<testgroup>
<test name="t1">
...
<test name="t2">
...
</testgroup>
<testgroup>
<xi:include href="other.xml" parse="xml"/> <!-- xml contains another <test name="t3"> and <test name="t4"> -->
</testgroup>
So how do i solve this with rng? The first testgroup is no problem. But what do i have to do with the include? rng can't read it/the referencing file.

Do i have to write something like this???:

Code: Select all


<rng:define name="testgroup">
<rng:zeroOrMore>
<rng:choice>
<rng:element name="test">
...
</rng:element>
<rng:include/>
</rng:choice>
</rng:zeroOrMore>
</rng:define>
I really don't have a plan to work with that...

Greetz
m0ps

Re: XInclude and Relax NG: How to use?

Posted: Fri Sep 24, 2010 7:53 am
by george
There are two possibilities, depending on the XInclude processing.

If XInclude processing is enabled then the parser will replace the XInclude elements with the actual included content before the Relax NG validation so your Relax NG schema does not need to declare the XInclude elements.

If XInclude processing is disabled then your Relax NG schema needs to specify the XInclude elements that you use. They are defined as any other element from your schema. See DocBook 5 schemas for an example.

For enabling/disabling XInclude processing in oXygen you can use Options->Preferences -- XML -- XML Parser -- Enable XInclude processing. By default the XInclude processing is enabled.

Best Regards,
George