none
Načtení XSD schématu

    Dotaz

  • Ahoj všem,
    potřebuji nutně pomoci se schématem XSD. Lámu si s tím hlavu už pár týdnů a bezúspěšně.

    Mám schéma rozdělené do čtyř souborů a snažím se o jeho načtení pomocí metody ReadXMLSchema.

    Bohužel mi to hlásí tuto chybu:

    Typ urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier:IRDI_type není deklarován nebo se nejedná o jednoduchý typ.

    LineNumber: 23
    LinePosition: 4
    Name: property_ref
    SourceUri: identification-guide.xsd

    Zde jsou jednotlivá schémata:

    Identifier.xsd

    <?xml version="1.0" encoding="UTF-8"?>
    <!--
    $Id: identifier.xsd 420 2009-07-25 21:51:57Z radack $
    ISO TC 184/SC 4/WG 12 N5180 - ISO/TS 29002-5 Identifier - XML schema
    -->
    <!--
    The following permission notice and disclaimer shall be included in all copies of this XML schema ("the Schema"), and derivations of the Schema:
    
    Permission is hereby granted, free of charge in perpetuity, to any person obtaining a copy of the Schema, to use, copy, modify, merge and distribute free of charge, copies of the Schema for the purposes of developing, implementing, installing and using software based on the  Schema, and to permit persons to whom the Schema is furnished to do so, subject to the following conditions:
    
    THE SCHEMA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SCHEMA OR THE USE OR OTHER DEALINGS IN THE SCHEMA.
    
    In addition, any modified copy of the Schema shall include the following notice:
    
    THIS SCHEMA HAS BEEN MODIFIED FROM THE SCHEMA DEFINED IN ISO/TS 29002-5, AND SHOULD NOT BE INTERPRETED AS COMPLYING WITH THAT STANDARD.
    
    -->
    <!DOCTYPE xs:schema [
    	<!ENTITY % identifier.dtd SYSTEM "identifier.dtd">
    	%identifier.dtd;
    ]>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:id="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" targetNamespace="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" elementFormDefault="qualified" attributeFormDefault="unqualified">
    	<!-- IRDI -->
    	<xs:element name="IRDI" type="id:IRDI_type"/>
    	<xs:element name="IRDI_list" type="id:IRDI_list_type"/>
    	<xs:simpleType name="IRDI_type">
    		<xs:restriction base="xs:string">
    			<xs:pattern value="&irdi1;"/>
    			<xs:pattern value="&irdi2;"/>
    			<xs:pattern value="&irdi3;"/>
    		</xs:restriction>
    	</xs:simpleType>
    	<!-- IRDI sequence -->
    	<xs:complexType name="IRDI_sequence_type">
    		<xs:sequence>
    			<xs:element ref="id:IRDI" minOccurs="0" maxOccurs="unbounded"/>
    		</xs:sequence>
    	</xs:complexType>
    	<!-- IRDI list-->
    	<xs:simpleType name="IRDI_list_type">
    		<xs:list itemType="id:IRDI_type"/>
    	</xs:simpleType>
    </xs:schema>
     Data-type.xsd
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dt="http://aura.cz/data-type" xmlns:id="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" targetNamespace="http://aura.cz/data-type" elementFormDefault="qualified" attributeFormDefault="unqualified">
    	<!-- Global Elements -->
    	<xs:import namespace="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" schemaLocation="identifier.xsd"/>
    	<xs:element name="boolean_type" type="dt:boolean_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="composite_type" type="dt:composite_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="controlled_value_type" type="dt:controlled_value_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="datatype" type="dt:datatype_Type" abstract="true"/>
    	<xs:element name="date_type" type="dt:date_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="date_time_type" type="dt:date_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="field" type="dt:field_specification_type_Type"/>
    	<xs:element name="integer_format" type="dt:integer_format_Type"/>
    	<xs:element name="integer_type" type="dt:integer_type_Type" substitutionGroup="dt:numeric_type"/>
    	<xs:element name="measure_type" type="dt:measure_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="measure_number_type" type="dt:measure_number_type_Type" substitutionGroup="dt:measure_type"/>
    	<xs:element name="measure_range_type" type="dt:measure_range_type_Type" substitutionGroup="dt:measure_type"/>
    	<xs:element name="numeric_type" type="dt:numeric_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="prescribed_qualifier_of_measure" type="dt:prescribed_qualifier_of_measure_Type"/>
    	<xs:element name="prescribed_unit_of_measure" type="dt:prescribed_unit_of_measure_Type"/>
    	<xs:element name="real_format" type="dt:real_format_Type"/>
    	<xs:element name="real_type" type="dt:real_type_Type" substitutionGroup="dt:numeric_type"/>
    	<xs:element name="string_format" type="dt:string_format_Type"/>
    	<xs:element name="string_type" type="dt:string_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="time_type" type="dt:time_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="value_of_property" type="dt:value_of_property_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="year_type" type="dt:year_type_Type" substitutionGroup="dt:datatype"/>
    	<xs:element name="year_month_type" type="dt:year_month_type_Type" substitutionGroup="dt:datatype"/>
    	<!-- Boolean Type -->
    	<xs:complexType name="boolean_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Composite Type -->
    	<xs:complexType name="composite_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type">
    				<xs:sequence>
    					<xs:element ref="dt:field" minOccurs="0" maxOccurs="unbounded"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Controlled Value Type -->
    	<xs:complexType name="controlled_value_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type">
    				<xs:sequence>
    					<xs:element ref="dt:value_of_property" maxOccurs="unbounded"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Datatype -->
    	<xs:complexType name="datatype_Type">
    	</xs:complexType>
    	<!-- Date Type -->
    	<xs:complexType name="date_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Date Time Type -->
    	<xs:complexType name="date_time_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Field Specification -->
    	<xs:complexType name="field_specification_type_Type">
    		<xs:sequence>
    			<xs:element ref="dt:datatype"/>
    		</xs:sequence>
    		<xs:attribute name="property_ref" type="id:IRDI_type" use="optional"/>
    		<!-- Specific for NIPEZ project -->
    		<xs:attribute name="concept_national_term" type="xs:string" use="optional"/>
    		<xs:attribute name="concept_national_def" type="xs:string" use="optional"/>
    	</xs:complexType>
    	<!-- Integer Format -->
    	<xs:complexType name="integer_format_Type">
    		<xs:attribute name="pattern" type="xs:string" use="optional"/>
    	</xs:complexType>
    	<!-- Integer Type -->
    	<xs:complexType name="integer_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:numeric_type_Type">
    				<xs:sequence>
    					<xs:element ref="dt:integer_format" minOccurs="0"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Measure Number Type -->
    	<xs:complexType name="measure_number_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:measure_type_Type">
    				<xs:sequence>
    					<xs:element ref="dt:prescribed_qualifier_of_measure" minOccurs="0" maxOccurs="unbounded"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Measure Range Type -->
    	<xs:complexType name="measure_range_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:measure_type_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Measure Type -->
    	<xs:complexType name="measure_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type">
    				<xs:sequence>
    					<xs:element ref="dt:numeric_type" minOccurs="0"/>
    					<xs:element ref="dt:prescribed_unit_of_measure" minOccurs="0" maxOccurs="unbounded"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Numeric Type -->
    	<xs:complexType name="numeric_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Prescribed Qualifier -->
    	<xs:complexType name="prescribed_qualifier_of_measure_Type">
    		<xs:attribute name="qualifier_ref" type="id:IRDI_type" use="required"/>
    		<!-- Specific for NIPEZ project -->
    		<xs:attribute name="concept_national_term" type="xs:string" use="optional"/>
    		<xs:attribute name="concept_national_def" type="xs:string" use="optional"/>
    	</xs:complexType>
    	<!-- Prescribed Unit of Measure -->
    	<xs:complexType name="prescribed_unit_of_measure_Type">
    		<xs:sequence>
    			<xs:element ref="dt:numeric_type" minOccurs="0"/>
    		</xs:sequence>
    		<xs:attribute name="UOM_ref" type="id:IRDI_type" use="required"/>
    		<!-- Specific for NIPEZ project -->
    		<xs:attribute name="concept_national_abbr" type="xs:string" use="optional"/>
    		<xs:attribute name="concept_national_term" type="xs:string" use="optional"/>
    		<xs:attribute name="concept_national_def" type="xs:string" use="optional"/>
    	</xs:complexType>
    	<!-- Real Format -->
    	<xs:complexType name="real_format_Type">
    		<xs:attribute name="pattern" type="xs:string" use="optional"/>
    	</xs:complexType>
    	<!-- Real Type -->
    	<xs:complexType name="real_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:numeric_type_Type">
    				<xs:sequence>
    					<xs:element ref="dt:real_format" minOccurs="0"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- String Format -->
    	<xs:complexType name="string_format_Type">
    		<xs:attribute name="pattern" type="xs:string" use="optional"/>
    	</xs:complexType>
    	<!-- String Type -->
    	<xs:complexType name="string_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type">
    				<xs:sequence>
    					<xs:element name="string_format" type="dt:string_format_Type" minOccurs="0"/>
    				</xs:sequence>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Time Type -->
    	<xs:complexType name="time_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Value of Property -->
    	<xs:complexType name="value_of_property_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type">
    				<xs:attribute name="value_ref" type="id:IRDI_type" use="required"/>
    				<!-- Specific for NIPEZ project -->
    				<xs:attribute name="concept_national_term" type="xs:string" use="optional"/>
    			</xs:extension>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Year Type -->
    	<xs:complexType name="year_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    	<!-- Year Month Type -->
    	<xs:complexType name="year_month_type_Type">
    		<xs:complexContent>
    			<xs:extension base="dt:datatype_Type"/>
    		</xs:complexContent>
    	</xs:complexType>
    </xs:schema>
     Identification-guide.xsd
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ig="http://aura.cz/identification-guide" xmlns:dt="http://aura.cz/data-type" xmlns:id="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" targetNamespace="http://aura.cz/identification-guide" elementFormDefault="qualified" attributeFormDefault="unqualified">
    	<xs:import namespace="http://aura.cz/data-type" schemaLocation="data-type.xsd"/>
    	<xs:import namespace="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" schemaLocation="identifier.xsd"/>
    	<!-- Global Elements -->
    	<xs:element name="identification_guide" type="ig:identification_guide_Type"/>
    	<xs:element name="prescribed_property" type="ig:prescribed_property_Type"/>
    	<!-- Global Types -->
    	<!-- Identification Guide -->
    	<xs:complexType name="identification_guide_Type">
    		<xs:sequence>
    			<xs:element ref="ig:prescribed_property" minOccurs="0" maxOccurs="unbounded"/>
    		</xs:sequence>
    		<xs:attribute name="id" type="xs:string" use="required"/>
    		<xs:attribute name="title" type="xs:string" use="optional"/>
    	</xs:complexType>
    
    	<!-- Prescribed Property -->
    	<xs:complexType name="prescribed_property_Type">
    		<xs:sequence>
    			<xs:element ref="dt:datatype" minOccurs="0"/>
    		</xs:sequence>
    		<xs:attribute name="property_ref" type="id:IRDI_type" use="required"/>
    		<!-- Specific for NIPEZ project -->
    		<xs:attribute name="concept_national_term" type="xs:string" use="optional"/>
    		<xs:attribute name="concept_national_def" type="xs:string" use="optional"/>
    	</xs:complexType>
    </xs:schema>

    Comodity.xsd

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cm="http://aura.cz/commodity" xmlns:ig="http://aura.cz/identification-guide" xmlns:dt="http://aura.cz/data-type" xmlns:id="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" targetNamespace="http://aura.cz/commodity" elementFormDefault="qualified" attributeFormDefault="unqualified">
    	<xs:import namespace="http://aura.cz/identification-guide" schemaLocation="identification-guide.xsd"/>
    	<xs:import namespace="http://aura.cz/data-type" schemaLocation="data-type.xsd"/>
    	<xs:import namespace="urn:iso:std:iso:ts:29002:-5:ed-1:tech:xml-schema:identifier" schemaLocation="identifier.xsd"/>
    
    	<!-- Global Elements -->
    	<xs:element name="commodities" type="cm:commodities_Type"/>
    	<xs:element name="commodity" type="cm:commodity_Type"/>
    
    	<!-- Global Types -->
    	<!-- Commodities -->
    	<xs:complexType name="commodities_Type">
    		<xs:sequence>
    			<xs:element ref="cm:commodity" minOccurs="0" maxOccurs="unbounded"/>
    		</xs:sequence>
    		<xs:attribute name="description" type="xs:string" use="optional"/>
    	</xs:complexType>
    
    	<!-- Commodity -->
    	<xs:complexType name="commodity_Type">
    		<xs:sequence>
    			<xs:sequence>
    					<xs:element ref="ig:identification_guide" minOccurs="0" maxOccurs="1"/>
    			</xs:sequence>
    			<xs:sequence>
    					<xs:element ref="cm:commodity" minOccurs="0" maxOccurs="unbounded"/>
    			</xs:sequence>
    		</xs:sequence>
    		<xs:attribute name="commodity_code" type="xs:string"
    			use="required" />
    		<xs:attribute name="commodity_name" type="xs:string"
    			use="required" />
    		<xs:attribute name="parent_code" type="xs:string"
    			use="optional" />
    		<xs:attribute name="cpv_code" type="xs:string" use="optional" />
    		<xs:attribute name="commodity_note" type="xs:string"
    			use="optional" />
    		<xs:attribute name="commodity_included" type="xs:string"
    			use="optional" />
    		<xs:attribute name="commodity_not_included" type="xs:string"
    			use="optional" />
    		<xs:attribute name="commodity_obligation" type="xs:boolean"
    			use="optional" default="false" />
    		<xs:attribute name="commodity_centr_procurement"
    			type="xs:boolean" use="optional" default="false" />
    		<xs:attribute name="commodity_e_auction" type="xs:boolean"
    			use="optional" default="false" />
    	</xs:complexType>
    
    </xs:schema>
    Předem děkuji za jakoukoliv radu.

    Vladimír Nykl (Word, Excel, Access, VBA, VB.NET)




    7. srpna 2012 11:50

Odpovědi

  • Takže chyba byla ve schématu Identifier.xsd v této části:

    <xs:pattern value="&irdi1;"/>
    <xs:pattern value="&irdi2;"/>
    <xs:pattern value="&irdi3;"/>

    Týká se typu IRDI_type, který právě způsobuje popsanou chybu.
    Po jejím zakomentování již proběhlo vše bez ní.
    Jedná se pravděpodobně o špatnou syntaxi pro restrikci datového typu.


    Vladimír Nykl (Word, Excel, Access, MS SQL, VBA, VB.NET)

    • Označen jako odpověď Medvidecek 10. srpna 2012 5:39
    10. srpna 2012 5:39

Všechny reakce

  • Nebude to tím, že typ použiješ dřív než ho definuješ?

    JCH

    7. srpna 2012 17:03
  • Musel by jsi to trochu víc rozvést, ale myslím, že ne.

    Nejdříve načítám schéma Comodity.xsd, které sahá do Identification-guide.xsd a ten do Data-type.xsd.
    Identification-guide.xsd a Data-type.xsd pak následně sahají dle potřeby do Identifier.xsd.

    Prostě tam nevidím chybu, tak kdyby jsi mohl pomoci?


    Vladimír Nykl (Word, Excel, Access, MS SQL, VBA, VB.NET)

    8. srpna 2012 5:40
  • Takže chyba byla ve schématu Identifier.xsd v této části:

    <xs:pattern value="&irdi1;"/>
    <xs:pattern value="&irdi2;"/>
    <xs:pattern value="&irdi3;"/>

    Týká se typu IRDI_type, který právě způsobuje popsanou chybu.
    Po jejím zakomentování již proběhlo vše bez ní.
    Jedná se pravděpodobně o špatnou syntaxi pro restrikci datového typu.


    Vladimír Nykl (Word, Excel, Access, MS SQL, VBA, VB.NET)

    • Označen jako odpověď Medvidecek 10. srpna 2012 5:39
    10. srpna 2012 5:39