Page 1 of 1

xinclude/relaxNG validation

Posted: Thu Jul 08, 2010 9:53 pm
by derBunte
Hi,

I'd like to use xinclude in a main file and get validation (with RelaxNG) in the subfiles. Is this possible? That is:

main.xml:

Code: Select all


<root>
<foo xmlns:xi="http://www.w3.org/2001/XInclude" >
<xi:include href="sub"/>
</foo>
</root>
sub.xml:

Code: Select all

<bar>
<sometag />
</bar>
When I edit sub.xml, I'd like to get validation as if I am in the main.xml at the position where the xinclude is (using RelaxNG XML syntax without schematron). I know that this can be ambiguous, but perhaps there are any strategies how to handle this situation?

Thanks
Patrick

Re: xinclude/relaxNG validation

Posted: Fri Jul 09, 2010 12:28 am
by george
Dear Patrick,

oXygen has support for this. Please look at validation scenarios:
http://www.oxygenxml.com/doc/ug-oxygen/ ... nario.html

You need to define a validation scenario for your sub.xml module and set the main.xml file as the file to be validated. Thus sub.xml will be validated indirectly, being included in the main.xml file.

Best Regards,
George

Re: xinclude/relaxNG validation

Posted: Fri Jul 09, 2010 8:22 am
by derBunte
Hello George,

thank you very much, yet another feature of oXygen I didn't know about. I have got it to work partly yet, as I get a complain that in the subfile

Code: Select all


<bar>
<sometag />
</bar>
bar is not allowed, I should use one of bar, ..., or ... . But I'll update oXygen first and play with it first before looking into this.

Thanks again!

Patrick

Re: xinclude/relaxNG validation

Posted: Fri Jul 09, 2010 10:17 pm
by george
Hi Patrick,

Please note that XInclude elements are replaced before the validation so the schema needs to refer to the elements replacing the XInclude elements, that is in your sample foo should allow bar as its child element.

Best Regards,
George