Visualizzazione dei risultati da 1 a 8 su 8

Discussione: xsd.exe e xsd problema

  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826

    xsd.exe e xsd problema

    ciao.
    Ho il seguente xml ex.xsd:
    codice:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:ex="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common" elementFormDefault="qualified" attributeFormDefault="unqualified">
    	
    	<xs:include schemaLocation="configuration.xsd"/> 
    	
    	<xs:element name="iso_10303_28">
    		<xs:complexType>
    			<xs:sequence>
    				<xs:element ref="ex:iso_10303_28_header" minOccurs="0"/>
    				<xs:element ref="ex:uos"/>
    				<!-- <xs:choice minOccurs="0" maxOccurs="unbounded">
    						<xs:element ref="ex:express"/>
    						<xs:element ref="ex:schema_population"/>
    						<xs:element ref="ex:configuration"/>
    				</xs:choice> -->
    			</xs:sequence>
    			<xs:attribute name="version" type="xs:string" use="required"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<!-- schema population is not used for ifcXML 
    	<xs:element name="schema_population">
    		<xs:complexType>
    			<xs:attribute name="governing_schema" type="xs:IDREF" use="required"/>
    			<xs:attribute name="governed_sections" type="xs:IDREFS" use="optional"/>
    			<xs:attribute name="determination_method" type="xs:normalizedString" default="section_boundary"/>
    		</xs:complexType>
    	</xs:element>
    	-->
    	<!-- express element is not used for ifcXML
    ecc.....	
    </xs:schema>
    che include tramite:
    codice:
    <xs:include schemaLocation="configuration.xsd"/>
    quest'altro xml configuration.xsd:
    codice:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema 
      targetNamespace="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common"
      xmlns:ex="urn:iso.org:standard:10303:part(28):version(2):xmlschema:common"
      xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified">
    
    	<xs:element name="configuration" nillable="true">
    		<xs:complexType>
    			<xs:choice minOccurs="0" maxOccurs="unbounded">
    				<xs:element ref="ex:include"/>
    				<xs:element ref="ex:option"/>
    				<xs:element ref="ex:type"/>
    				<xs:element ref="ex:entity"/>
    			</xs:choice>
    			<xs:attribute name="id" type="xs:ID" use="required"/>
    			<xs:attribute name="targetNamespace" type="xs:anyURI" use="optional"/>
    			<xs:attribute name="schema" type="xs:IDREF" use="optional"/>
    			<xs:attribute name="configurationLocation" type="ex:Seq-anyURI" use="optional"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="include">
    		<xs:complexType>
    			<xs:attribute name="configuration" type="xs:IDREF" use="required"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="option">
    		<xs:complexType>
    			<xs:attribute name="inheritance" type="xs:boolean" default="false"/>
    			<xs:attribute name="exp-type" type="ex:exp-type" default="unspecified"/>
    			<xs:attribute name="exp-attribute" type="ex:exp-attribute" default="double-tag"/>
    			<xs:attribute name="flatten" type="ex:boolean_or_depth" default="false"/>
    			<xs:attribute name="sparse" type="xs:boolean" default="false"/>
    			<xs:attribute name="tagless" type="ex:boolean_or_unspecified" default="unspecified"/>
    			<xs:attribute name="naming-convention" type="ex:naming-convention" default="initial-upper"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="type">
    		<xs:complexType>
    			<xs:choice minOccurs="0">
    				<xs:element ref="ex:aggregate"/>
    			</xs:choice>
    			<xs:attribute name="select" type="xs:NMTOKEN" use="required"/>
    			<xs:attribute name="name" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="map" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="exp-type" type="ex:exp-type" use="optional"/>
    			<xs:attribute name="flatten" type="ex:boolean_or_depth" use="optional"/>
    			<xs:attribute name="sparse" type="xs:boolean" use="optional"/>
    			<xs:attribute name="tagless" type="ex:boolean_or_unspecified" use="optional"/>
    			<xs:attribute name="notation" type="xs:normalizedString" use="optional"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="entity">
    		<xs:complexType>
    			<xs:choice minOccurs="0" maxOccurs="unbounded">
    				<xs:element ref="ex:attribute"/>
    				<xs:element ref="ex:inverse"/>
    			</xs:choice>
    			<xs:attribute use="required" name="select">
    				<xs:simpleType>
    					<xs:restriction>
    						<xs:simpleType>
    							<xs:list itemType="xs:Name"/>
    						</xs:simpleType>
    						<xs:minLength value="1"/>
    					</xs:restriction>
    				</xs:simpleType>
    			</xs:attribute>
    			<xs:attribute name="name" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="tag-source" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="tag-values" type="xs:NMTOKENS" use="optional"/>
    			<xs:attribute name="exp-type" type="ex:exp-type" use="optional"/>
    			<xs:attribute name="content" type="ex:content" use="optional"/>
    			<xs:attribute name="exp-attribute" type="ex:exp-attribute" use="optional"/>
    			<xs:attribute name="flatten" type="ex:boolean_or_depth" use="optional"/>
    			<xs:attribute name="sparse" type="xs:boolean" use="optional"/>
    			<xs:attribute name="tagless" type="ex:boolean_or_unspecified" use="optional"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="attribute">
    		<xs:complexType>
    			<xs:choice minOccurs="0" maxOccurs="unbounded">
    				<xs:element ref="ex:aggregate"/>
    			</xs:choice>
    			<xs:attribute name="select" type="xs:NMTOKEN" use="required"/>
    			<xs:attribute name="name" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="exp-attribute" type="ex:exp-attribute" use="optional"/>
    			<xs:attribute name="content" type="ex:content" use="optional"/>
    			<xs:attribute name="keep" type="xs:boolean" default="false"/>
    			<xs:attribute name="flatten" type="ex:boolean_or_depth" use="optional"/>
    			<xs:attribute name="sparse" type="xs:boolean" use="optional"/>
    			<xs:attribute name="tagless" type="ex:boolean_or_unspecified" use="optional"/>
    			<xs:attribute name="notation" type="xs:normalizedString" use="optional"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="inverse">
    		<xs:complexType>
    			<xs:attribute name="select" type="xs:NMTOKEN" use="required"/>
    			<xs:attribute name="name" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="exp-attribute" type="ex:exp-attribute" use="optional"/>
    			<xs:attribute name="content" type="ex:content" use="optional"/>
    			<xs:attribute name="flatten" type="ex:boolean_or_depth" use="optional"/>
    			<xs:attribute name="sparse" type="xs:boolean" use="optional"/>
    			<xs:attribute name="tagless" type="ex:boolean_or_unspecified" use="optional"/>
    			<xs:attribute name="use-id" type="xs:boolean" use="optional"/>
    			<xs:attribute name="invert" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="keep" type="xs:boolean" default="false"/>
    			<xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="0"/>
    			<xs:attribute name="maxOccurs" type="ex:nonNegativeInteger_or_unbounded" use="optional" default="unbounded"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:element name="aggregate">
    		<xs:complexType>
    			<xs:choice minOccurs="0" maxOccurs="unbounded">
    				<xs:element ref="ex:aggregate"/>
    			</xs:choice>
    			<xs:attribute name="name" type="xs:NMTOKEN" use="optional"/>
    			<xs:attribute name="exp-attribute" type="ex:exp-attribute" use="optional"/>
    			<xs:attribute name="flatten" type="ex:boolean_or_depth" use="optional"/>
    			<xs:attribute name="sparse" type="xs:boolean" use="optional"/>
    			<xs:attribute name="tagless" type="ex:boolean_or_unspecified" use="optional"/>
    			<xs:attribute name="use-id" type="xs:boolean" use="optional"/>
    		</xs:complexType>
    	</xs:element>
    	
    	<xs:simpleType name="exp-type">
    		<xs:restriction base="xs:string">
    			<xs:enumeration value="root"/>
    			<xs:enumeration value="value"/>
    			<xs:enumeration value="unspecified"/>
    		</xs:restriction>
    	</xs:simpleType>
    	
    	<xs:simpleType name="exp-attribute">
    		<xs:restriction base="xs:string">
    			<xs:enumeration value="double-tag"/>
    			<xs:enumeration value="attribute-tag"/>
    			<xs:enumeration value="entity-tag"/>
    			<xs:enumeration value="no-tag"/>
    			<xs:enumeration value="attribute-content"/>
    		</xs:restriction>
    	</xs:simpleType>
    	
    	<xs:simpleType name="content">
    		<xs:restriction base="xs:string">
    			<xs:enumeration value="value"/>
    			<xs:enumeration value="ref"/>
    			<xs:enumeration value="unspecified"/>
    		</xs:restriction>
    	</xs:simpleType>
    	
    	<xs:simpleType name="naming-convention">
    		<xs:restriction base="xs:string">
    			<xs:enumeration value="initial-upper"/>
    			<xs:enumeration value="camel-case"/>
    			<xs:enumeration value="preserve-case"/>
    		</xs:restriction>
    	</xs:simpleType>
    	
    	<xs:simpleType name="boolean_or_unspecified">
    		<xs:union memberTypes="xs:boolean">
    			<xs:simpleType>
    				<xs:restriction base="xs:string">
    					<xs:enumeration value="unspecified"/>
    				</xs:restriction>
    			</xs:simpleType>
    		</xs:union>
    	</xs:simpleType>
    	
    	<xs:simpleType name="boolean_or_depth">
    		<xs:union memberTypes="xs:boolean xs:nonNegativeInteger"/>
    	</xs:simpleType>
    	<xs:simpleType name="nonNegativeInteger_or_unbounded">
    		<xs:union memberTypes="xs:nonNegativeInteger">
    			<xs:simpleType>
    				<xs:restriction base="xs:string">
    					<xs:enumeration value="unbounded"/>
    				</xs:restriction>
    			</xs:simpleType>
    		</xs:union>
    	</xs:simpleType>
    	
    	<xs:simpleType name="Seq-anyURI">
    		<xs:list itemType="xs:anyURI"/>
    	</xs:simpleType>
    	
    </xs:schema>
    il problema è che se provo a lanciare
    xsd ex.xsd mi da quest' errore:

    Errore: Errore durante la generazione di classi per lo schema 'ex'.
    - Schema con targetNamespace="urn:iso.org:standard:10303art(28):version(2):x
    mlschema:common" con sintassi non valida. Elemento simpleType 'urn:iso.org:stand
    ard:10303art(28):version(2):xmlschema:common:Seq-anyURI' già dichiarato. Riga
    106, posizione 3.
    - Elemento simpleType 'urn:iso.org:standard:10303art(28):version(2):xmlschem
    a:common:Seq-anyURI' già dichiarato.

    Sono uno schema per l'ifc http://www.iai-tech.org/products/ifc...elease/summary io vorrei creare le classi in c# a partire dallo schema.

    ma non riesco a capire l'errore , che deriva comunque dall include(se provo a toglierlo funziona) e i namespaces tipo targetnamespace o ad es xmlns:ex="urn:iso.org:standard:10303art(28):version(2):xmlschema:common".
    a cosa servono?

    grazie.

  2. #2
    Utente di HTML.it L'avatar di albgen
    Registrato dal
    Jun 2005
    Messaggi
    3,249
    Io non ho mai utilizzato questo tool ma ti faccio una domanda, lo sai che
    le classi si creano da solo quando crei il dataset?

    l'xsd lo hai creato con il designer di visual studio?
    I got the remedy

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    grazie.
    no , le classi si creano anche con l'attributo /classes del tool xsd .
    Ed è proprio quel che voglio fare.

  4. #4
    Utente di HTML.it L'avatar di albgen
    Registrato dal
    Jun 2005
    Messaggi
    3,249
    no è la risposta alla prima o alla seconda domanda?
    perchè stai utilizzando questa utility? cosa dovresti fare?
    I got the remedy

  5. #5
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    devo creare la struttura delle classi in base allo schema xsd , per questo uso quell' utilitiy , non mi interessano i dataset .
    Mi serve per deserializzare degli xml e andare automaticamete a popolare le classi che ho generato con l'xsd.
    spero di essere stato un po piu chiaro , scusa se non lo sono stato.ciao.

  6. #6
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    l'errore era che i targetnamespace dovevano essere uguali tra l'incluso e l'inclusore.
    adesso ho un altro problema:
    questi sono i miei schema:
    1)IFC2X3.xsd
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:ex="urn:iso.org:standard:10303art(28):version(2):xmlschema:common" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ifc="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" attributeFormDefault="unqualified" targetNamespace="urn:iso.org:standard:10303art(28):version(2):xmlschema:common">
    2)ex.xsd
    <xs:schema xmlns:ex="urn:iso.org:standard:10303art(28):version(2):xmlschema:common" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:iso.org:standard:10303art(28):version(2):xmlschema:common" elementFormDefault="qualified" attributeFormDefault="unqualified">
    3)configuration.xsd
    <xs:schema
    targetNamespace="urn:iso.org:standard:10303art(28):version(2):xmlschema:common"
    xmlns:ex="urn:iso.org:standard:10303art(28):version(2):xmlschema:common"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified">

    IFC2x3 include ex con:<xs:import schemaLocation="ex.xsd"/>
    mentre ex.xsd include configuration con
    <xs:include schemaLocation="configuration.xsd"/>

    in IFC2x3.xsd ho i due attributi(non so bene come sichiamano) ifc: e ex: , questi come li devo impostare?
    se li imposto tutti e due uguali ricevo uno stack overflow.
    a cosa servono questi attributi?tipo xmlns:ifc="http://www.iai-tech.org/ifcXML/IFC2x3/FINAL" , ho visto che dopo nel codice sono dichiarati prima di un entity ad es.

    grazie

  7. #7
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    up

  8. #8
    Utente di HTML.it
    Registrato dal
    Jun 2003
    Messaggi
    4,826
    nessuno?

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.