Menu

Validate heterogeneous namespase design

pmaier
2006-11-27
2013-04-02
  • pmaier

    pmaier - 2006-11-27

    Hei,

    I have any problems with NMatrix to validate schematron embedded into W3C schema. I have different schema files (childs), these files are included into a main schema file (parent). The schematron rules are in the child files.  If I validate a wrong xml file against the parent schema with the Schematron Validator tool from topolgi the error will reported, but the validation with the NMatrix library doesn't report any errors.

    wrong.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <CardProcess xmlns="http://www.gi-de.com" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.gi-de.com D:\UPP_Cconfig\PPGDJAVATCISCE\Production_schemas\Sample_ProductionSchema.xsd">
        <PutDataTask name="IIN" tag="00 42">12</PutDataTask>
    </CardProcess>

    Parent.xsd (Sample_ProductionSchema.xsd)
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="http://www.gi-de.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns="http://www.gi-de.com" elementFormDefault="qualified">
        <xs:include schemaLocation="D:\UPP_Cconfig\PPGDJAVATCISCE\Production_schemas\PutDataTask.xsd"/>
        <xs:element name="CardProcess" type="CardProcessType">
            <xs:annotation>
                <xs:documentation>Root node with man tasks</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:complexType name="CardProcessType">
            <xs:choice maxOccurs="unbounded">
                <xs:element name="PutDataTask" type="PutDataTaskType"/>
            </xs:choice>
        </xs:complexType>
    </xs:schema>

    child.xsd (PutDataTask.xsd)
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema targetNamespace="http://www.gi-de.com" xmlns:bk="http://www.gi-de.com" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
        <xs:annotation>
            <xs:appinfo>
                <sch:title>Schematron validation</sch:title>
                <sch:ns prefix="bk" uri="http://www.gi-de.com"/>
            </xs:appinfo>
        </xs:annotation>
        <!--xs:element name="PutDataTask" type="bk:PutDataTaskType"-->
            <xs:annotation>
                <xs:appinfo>
                    <sch:pattern id="onPutDataTaskTests">
                        <sch:rule context="bk:PutDataTask[@tag='00 42']">
                            <report test="string-length() &lt; 4">There is not enough letters in the abbreviation</report>
                            <report test="string-length() > 8">There is too much letters in the abbreviation</report>
                        </sch:rule>
                        <sch:rule context="bk:PutDataTask[@tag='00 45']">
                            <report test="string-length() &lt; 11">There is not enough letters in the abbreviation</report>
                            <report test="string-length() > 14">There is too much letters in the abbreviation</report>
                        </sch:rule>
                    </sch:pattern>
                </xs:appinfo>
            </xs:annotation>
        <!--/xs:element-->
        <xs:simpleType name="PutDataEncodingType">
            <xs:restriction base="xs:string">
                <xs:pattern value="(([ \t\r\n])*([a-fA-F0-9]{2} )*[a-fA-F0-9]{2}([ \t\r\n])*)?"/>
            </xs:restriction>
        </xs:simpleType>
        <xs:simpleType name="TagEncodingType">
            <xs:restriction base="xs:string">
                <xs:length value="5" fixed="true"/>
                <xs:pattern value="(([ \t\r\n])*([a-fA-F0-9]{2} )*[a-fA-F0-9]{2}([ \t\r\n])*)?"/>
                <xs:enumeration value="00 42"/>
                <xs:enumeration value="00 45"/>
            </xs:restriction>
        </xs:simpleType>
        <xs:complexType name="PutDataTaskType">
            <xs:simpleContent>
                <xs:extension base="bk:PutDataEncodingType">
                    <xs:attribute name="name" type="xs:string"/>
                    <xs:attribute name="tag" type="bk:TagEncodingType"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:schema>

    Thanks for your replay.

     
    • Daniel Cazzulino (kzu)

      We're not processing included schemas.
      There will be no workaround in the short term, I'm afraid.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.