0
votes

I have 2 xsd files, one is main and other is child which includes main.xsd, now I have child.xml which I need to validate against child.xml and it should give me error in ide but it being validated against main.xsd only.

main.xsd

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:simpleType name="numeric_0-3">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="0" />
            <xs:maxInclusive value="3" />
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="numeric_0-60">
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="0" />
            <xs:maxInclusive value="60" />
        </xs:restriction>
    </xs:simpleType>

<xs:element name="paymentSwitch_nii" default="001" type="numeric_0-3">
        <xs:annotation>
            <xs:documentation>Acquirer Network Identifier (NII)</xs:documentation>
        </xs:annotation>
    </xs:element>
<xs:element name="bin_eftpos" type="numeric_0-60">
        <xs:annotation>
            <xs:documentation>Efpos bin number</xs:documentation>
        </xs:annotation>
    </xs:element>

<xs:element name="parameter" type="main_override" />
    <xs:complexType name="main_override">
     <xs:all>
        <xs:element minOccurs='0' ref="paymentSwitch_nii" />
        <xs:element minOccurs='0' ref="bin_eftpos" />
     </xs:all>
     </xs:complexType>
</xs:schema>

child.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:include schemaLocation="../../../payment/src/main/assets/overrideparams.xsd" />

    <xs:element name="parameter">
        <xs:complexType>
            <xs:all>
                <xs:element minOccurs="1" name="main_override" type="main_override"/>
                <xs:element minOccurs='1' ref="offlineTransactionCeilingLimitCentsContact" />
                ......
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="offlineTransactionCeilingLimitCentsContact" type="numeric_0-999999999">
        <xs:annotation>
            <xs:documentation>Maximum allowed transaction value in offline mode for Contact/Insert
                transactions
            </xs:documentation>
        </xs:annotation>
.....
</xs:schema>

child.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<parameter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:nonamespaceSchemaLocation="overrideparams.xsd">
.......
</parameter>

Is there something wrong with schema location or include xsd?

Welcome. You should take a look at How to Ask and take the tour, if you have not done so already. Also take a look at minimal reproducible example. This is general information that you should keep in mind, when asking questions. - cliff2310