Page 1 of 1

Xinclude and XSD

Posted: Thu Mar 08, 2018 12:34 am
by ProfessorK
Hey, I am trying to build a document using XInclude that should match an xsd.

It seems however that the include is not getting replaced before validation, and thus the xi:include is causing an xsd error.

Is there a setting or declaration I can use to fix this?

Thanks, code below

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<World xmlns="https://profk.github.io/websites/xsd/MuttRules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2003/XInclude"
xsi:schemaLocation="https://profk.github.io/websites/xsd/MuttRules file:/C:/Users/jeffp/Downloads/MuttMaster-20180226T014238Z-001/MuttMaster/MuttRules.xsd">

<xi:include href="DefaultRules.xml" parse="text" xpointer="xpointer(RULES)" />

<Powers></Powers>
</World>

Re: Xinclude and XSD

Posted: Thu Mar 08, 2018 10:14 am
by Radu
Hi,

You should look in the Oxygen Preferences->"XML / XML Parser" page if the XInclude processing checkbox is enabled.
If it is and you still have problems with this, maybe you could give us more details, ideally post a small sample XML + XSD and the error message that you get on your side. You can also send samples directly to "support@oxygenxml.com".

Regards,
Radu

Re: Xinclude and XSD

Posted: Thu Mar 08, 2018 9:53 pm
by ProfessorK
okay I stripped my xsd down to a minmal example, here it is..

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:local="https://profk.github.io/websites/xsd/MuttRules"
targetNamespace="https://profk.github.io/websites/xsd/MuttRules">

<xs:import namespace="http://www.w3.org/1999/xhtml" schemaLocation="xhtml5.xsd"/>

<xs:element name="World">
<xs:complexType>
<xs:sequence minOccurs="0">
<xs:element name="Rules" minOccurs="0"/>

<xs:element name="Powers"/>

</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

ANd here is the including file

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<World xmlns="https://profk.github.io/websites/xsd/MuttRules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2003/XInclude"
xsi:schemaLocation="https://profk.github.io/websites/xsd/MuttRules file:/C:/Users/jeffp/Downloads/MuttMaster-20180226T014238Z-001/MuttMaster/MuttRules1.xsd">

<xi:include href="DefaultRules.xml" parse="text" xpointer="xpointer(RULES)" />

<Powers></Powers>
</World><?xml version="1.0" encoding="UTF-8"?>
<World xmlns="https://profk.github.io/websites/xsd/MuttRules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2003/XInclude"
xsi:schemaLocation="https://profk.github.io/websites/xsd/MuttRules file:/C:/Users/jeffp/Downloads/MuttMaster-20180226T014238Z-001/MuttMaster/MuttRules1.xsd">

<xi:include href="DefaultRules.xml" parse="text" xpointer="xpointer(RULES)" />

<Powers></Powers>
</World>

Re: Xinclude and XSD

Posted: Thu Mar 08, 2018 9:59 pm
by ProfessorK
Here are my settings....
Image

Image

Re: Xinclude and XSD

Posted: Fri Mar 09, 2018 1:24 am
by ProfessorK
I think I figured it out...

"http://www.w3.org/2003/XInclude" doesn't seem to exist but fails silently

"http://www.w3.org/2001/XInclude" works

Re: Xinclude and XSD

Posted: Fri Mar 09, 2018 10:33 am
by Radu
Hi,

Indeed the namespace https://www.w3.org/2003/XInclude is deprecated:

https://www.w3.org/2003/XInclude

and not supported, so if you have an element in that namespace, it is not considered an xinclude element, it is just an unknown element called "include" having the namespace https://www.w3.org/2003/XInclude.

Regards,
Radu