XInclude and Relax NG: How to use?

This should cover W3C XML Schema, Relax NG and DTD related problems.
m0ps
Posts: 3
Joined: Wed Sep 22, 2010 12:27 pm

XInclude and Relax NG: How to use?

Post 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
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: XInclude and Relax NG: How to use?

Post 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
George Cristian Bina
Post Reply