xinclude/relaxNG validation

<oXygen/> general issues.
derBunte
Posts: 11
Joined: Fri Sep 14, 2007 11:27 am
Location: Germany

xinclude/relaxNG validation

Post by derBunte » Thu Jul 08, 2010 9:53 pm

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

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Re: xinclude/relaxNG validation

Post by george » Fri Jul 09, 2010 12:28 am

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

derBunte
Posts: 11
Joined: Fri Sep 14, 2007 11:27 am
Location: Germany

Re: xinclude/relaxNG validation

Post by derBunte » Fri Jul 09, 2010 8:22 am

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

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Re: xinclude/relaxNG validation

Post by george » Fri Jul 09, 2010 10:17 pm

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

Post Reply