Xinclude and XSD

This should cover W3C XML Schema, Relax NG and DTD related problems.
ProfessorK
Posts: 6

Xinclude and XSD

Thu Mar 08, 2018 12:34 am

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>
Radu
Posts: 5688

Re: Xinclude and XSD

Thu Mar 08, 2018 10:14 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ProfessorK
Posts: 6

Re: Xinclude and XSD

Thu Mar 08, 2018 9:53 pm

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>
ProfessorK
Posts: 6

Re: Xinclude and XSD

Thu Mar 08, 2018 9:59 pm

Here are my settings....
Image

Image
ProfessorK
Posts: 6

Re: Xinclude and XSD

Fri Mar 09, 2018 1:24 am

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
Radu
Posts: 5688

Re: Xinclude and XSD

Fri Mar 09, 2018 10:33 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests