Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. XSD problem

XSD problem

Scheduled Pinned Locked Moved XML / XSL
xmlquestiondatabasecomhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gantww
    wrote on last edited by
    #1

    I've created the following XML Schema (not for production use, but to learn by doing). Here's what is burning me at the moment: The xs:element elements that refer to classes or properties are giving me warnings that "Type 'class' is not declared". I'm still learning this stuff, so I'd really appreciate it if someone could take a quick peek at it and advise me of the (probably obvious) problem in the code below. Thanks, Will

    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema targetNamespace="http://gantsoftwaresystems.com/classspec.xsd"
    elementFormDefault="qualified"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"

    <xs:element name="classDefs">
    	<xs:complexType>
    	  <xs:sequence minOccurs="1" maxOccurs="unbounded">
    		<xs:element name="classes">
    		  <xs:complexType>
    			<xs:sequence minOccurs="1" maxOccurs="unbounded">					
    				<xs:element name="class" type="class"/>
    			</xs:sequence>            
    		  </xs:complexType>
    		</xs:element>
    		<xs:element name="views">
    		  <xs:complexType>
    			<xs:sequence>
    				<xs:element name="view" type="class"/>
    			</xs:sequence>            
    		  </xs:complexType>
    		</xs:element>
    	  </xs:sequence>      
    	</xs:complexType>
    </xs:element>
    <xs:complexType name="class">
    	<xs:sequence minOccurs="1" maxOccurs="unbounded">
    		<xs:element name="property" type="property"/>
    	</xs:sequence>
    	<xs:attribute name="name" type="xs:string"/>
    	<xs:attribute name="base" type="xs:string"/>
    	<xs:attribute name="hasImageUrl" type="xs:boolean"/>
    </xs:complexType>
    <xs:complexType name="property">
    	<xs:sequence minOccurs="0" maxOccurs="unbounded">
    		<xs:element name="alsoTriggerPropertyChanged">
    			<xs:complexType>
    				<xs:attribute name="propertyName" type="xs:string"/>
    			</xs:complexType>
    		</xs:element>
    	</xs:sequence>
    	<xs:attribute name="name" type="xs:string"/>
    	<xs:attribute name="type" type="xs:string"/>
    	<xs:attribute name="changesImageUrl" type="xs:boolean"/>
    	<xs:attribute name="imageUrlQStringParamName" type="xs:string"/>
    	<xs:attribute name="imageUrlOverridePropertyName" type="xs:string"/>
    </xs:complexType>
    

    </xs:schema>

    S 1 Reply Last reply
    0
    • G gantww

      I've created the following XML Schema (not for production use, but to learn by doing). Here's what is burning me at the moment: The xs:element elements that refer to classes or properties are giving me warnings that "Type 'class' is not declared". I'm still learning this stuff, so I'd really appreciate it if someone could take a quick peek at it and advise me of the (probably obvious) problem in the code below. Thanks, Will

      <?xml version="1.0" encoding="utf-8"?>
      <xs:schema targetNamespace="http://gantsoftwaresystems.com/classspec.xsd"
      elementFormDefault="qualified"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"

      <xs:element name="classDefs">
      	<xs:complexType>
      	  <xs:sequence minOccurs="1" maxOccurs="unbounded">
      		<xs:element name="classes">
      		  <xs:complexType>
      			<xs:sequence minOccurs="1" maxOccurs="unbounded">					
      				<xs:element name="class" type="class"/>
      			</xs:sequence>            
      		  </xs:complexType>
      		</xs:element>
      		<xs:element name="views">
      		  <xs:complexType>
      			<xs:sequence>
      				<xs:element name="view" type="class"/>
      			</xs:sequence>            
      		  </xs:complexType>
      		</xs:element>
      	  </xs:sequence>      
      	</xs:complexType>
      </xs:element>
      <xs:complexType name="class">
      	<xs:sequence minOccurs="1" maxOccurs="unbounded">
      		<xs:element name="property" type="property"/>
      	</xs:sequence>
      	<xs:attribute name="name" type="xs:string"/>
      	<xs:attribute name="base" type="xs:string"/>
      	<xs:attribute name="hasImageUrl" type="xs:boolean"/>
      </xs:complexType>
      <xs:complexType name="property">
      	<xs:sequence minOccurs="0" maxOccurs="unbounded">
      		<xs:element name="alsoTriggerPropertyChanged">
      			<xs:complexType>
      				<xs:attribute name="propertyName" type="xs:string"/>
      			</xs:complexType>
      		</xs:element>
      	</xs:sequence>
      	<xs:attribute name="name" type="xs:string"/>
      	<xs:attribute name="type" type="xs:string"/>
      	<xs:attribute name="changesImageUrl" type="xs:boolean"/>
      	<xs:attribute name="imageUrlQStringParamName" type="xs:string"/>
      	<xs:attribute name="imageUrlOverridePropertyName" type="xs:string"/>
      </xs:complexType>
      

      </xs:schema>

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      You need to namespace qualify the type references - you declare them in your target namespace, but when you reference them, don't mention that namespace. You can either use explicit namespace references or (and this is easier) use your target namespace as the default namespace for the schema.

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups