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. VS2005 doesn't like my XML Schema

VS2005 doesn't like my XML Schema

Scheduled Pinned Locked Moved XML / XSL
visual-studioxmlhelptutorialcsharp
3 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
    gritter
    wrote on last edited by
    #1

    I am using Visual Studio 2005 to create my first XML Schema. Generally it's going well. The intellisense in VS is very helpful. My only issue is that VS is flagging the element "Well" in my example, saying "The type attribute cannot be present with either simpleType or complexType." I'm not sure how to structure it if this way isn't acceptable. I've also included a XML snippet of what I am trying define in the schema. Any help appreciated.

                   <xsd:element name="Well\_Volumes">
                      <xsd:complexType>
                        <xsd:sequence>
                          
                          <xsd:element name="Well" type="xsd:decimal">
                            <xsd:complexType>
                              <xsd:attribute name="channel" type="xsd:string"/>
                              <xsd:attribute name="dispense\_order" type="xsd:string"/>
                              <xsd:attribute name="plate\_column" type="xsd:string"/>
                              <xsd:attribute name="plate\_row" type="xsd:string"/>
                            </xsd:complexType>
                          </xsd:element>
                        
                        </xsd:sequence>
                      </xsd:complexType>
                    </xsd:element>
    
    
    
     <Well\_Volumes>
        <Well channel="A" dispense\_order="1" plate\_column="1" plate\_row="1">0.209</Well>
        <Well channel="A" dispense\_order="2" plate\_column="2" plate\_row="1">0.212</Well>
        <Well channel="A" dispense\_order="3" plate\_column="3" plate\_row="1">0.219</Well>
        <Well channel="B" dispense\_order="1" plate\_column="4" plate\_row="2">0.212</Well>
        <Well channel="B" dispense\_order="2" plate\_column="5" plate\_row="2">0.222</Well>
        <Well channel="B" dispense\_order="3" plate\_column="6" plate\_row="2">0.212</Well>
    </Well\_Volumes>
    
    G S 2 Replies Last reply
    0
    • G gritter

      I am using Visual Studio 2005 to create my first XML Schema. Generally it's going well. The intellisense in VS is very helpful. My only issue is that VS is flagging the element "Well" in my example, saying "The type attribute cannot be present with either simpleType or complexType." I'm not sure how to structure it if this way isn't acceptable. I've also included a XML snippet of what I am trying define in the schema. Any help appreciated.

                     <xsd:element name="Well\_Volumes">
                        <xsd:complexType>
                          <xsd:sequence>
                            
                            <xsd:element name="Well" type="xsd:decimal">
                              <xsd:complexType>
                                <xsd:attribute name="channel" type="xsd:string"/>
                                <xsd:attribute name="dispense\_order" type="xsd:string"/>
                                <xsd:attribute name="plate\_column" type="xsd:string"/>
                                <xsd:attribute name="plate\_row" type="xsd:string"/>
                              </xsd:complexType>
                            </xsd:element>
                          
                          </xsd:sequence>
                        </xsd:complexType>
                      </xsd:element>
      
      
      
       <Well\_Volumes>
          <Well channel="A" dispense\_order="1" plate\_column="1" plate\_row="1">0.209</Well>
          <Well channel="A" dispense\_order="2" plate\_column="2" plate\_row="1">0.212</Well>
          <Well channel="A" dispense\_order="3" plate\_column="3" plate\_row="1">0.219</Well>
          <Well channel="B" dispense\_order="1" plate\_column="4" plate\_row="2">0.212</Well>
          <Well channel="B" dispense\_order="2" plate\_column="5" plate\_row="2">0.222</Well>
          <Well channel="B" dispense\_order="3" plate\_column="6" plate\_row="2">0.212</Well>
      </Well\_Volumes>
      
      G Offline
      G Offline
      gritter
      wrote on last edited by
      #2

      Thanks everyone, but never mind. Although it makes perfect sense to me, apparently an element can not include both attributes and a value. Hmmm... Maybe in the next version. Below is how I am fixing the problem.

                      <xsd:element name="Well\_Volumes">
                        <xsd:complexType>
                          <xsd:sequence>
                            
                            <xsd:element name="Well">
                              <xsd:complexType>
                                <xsd:sequence>
                                  <xsd:element name="volume" type="xsd:decimal"/>
                                </xsd:sequence>
                                <xsd:attribute name="channel" type="xsd:string"/>
                                <xsd:attribute name="dispense\_order" type="xsd:string"/>
                                <xsd:attribute name="plate\_column" type="xsd:string"/>
                                <xsd:attribute name="plate\_row" type="xsd:string"/>
                              </xsd:complexType>
                            </xsd:element>
                          
                          </xsd:sequence>
                        </xsd:complexType>
                      </xsd:element>
      
      1 Reply Last reply
      0
      • G gritter

        I am using Visual Studio 2005 to create my first XML Schema. Generally it's going well. The intellisense in VS is very helpful. My only issue is that VS is flagging the element "Well" in my example, saying "The type attribute cannot be present with either simpleType or complexType." I'm not sure how to structure it if this way isn't acceptable. I've also included a XML snippet of what I am trying define in the schema. Any help appreciated.

                       <xsd:element name="Well\_Volumes">
                          <xsd:complexType>
                            <xsd:sequence>
                              
                              <xsd:element name="Well" type="xsd:decimal">
                                <xsd:complexType>
                                  <xsd:attribute name="channel" type="xsd:string"/>
                                  <xsd:attribute name="dispense\_order" type="xsd:string"/>
                                  <xsd:attribute name="plate\_column" type="xsd:string"/>
                                  <xsd:attribute name="plate\_row" type="xsd:string"/>
                                </xsd:complexType>
                              </xsd:element>
                            
                            </xsd:sequence>
                          </xsd:complexType>
                        </xsd:element>
        
        
        
         <Well\_Volumes>
            <Well channel="A" dispense\_order="1" plate\_column="1" plate\_row="1">0.209</Well>
            <Well channel="A" dispense\_order="2" plate\_column="2" plate\_row="1">0.212</Well>
            <Well channel="A" dispense\_order="3" plate\_column="3" plate\_row="1">0.219</Well>
            <Well channel="B" dispense\_order="1" plate\_column="4" plate\_row="2">0.212</Well>
            <Well channel="B" dispense\_order="2" plate\_column="5" plate\_row="2">0.222</Well>
            <Well channel="B" dispense\_order="3" plate\_column="6" plate\_row="2">0.212</Well>
        </Well\_Volumes>
        
        S Offline
        S Offline
        Stuart Dootson
        wrote on last edited by
        #3

        You need a simpleContent[^] element as a child of the complexType. Then extend the simple type with attributes - like this:

        <xsd:element name="Well_Volumes">
        xsd:complexType
        <xsd:sequence maxOccurs="unbounded">

           <xsd:element name="Well">
             <xsd:complexType>
               <xsd:simpleContent>
                 <xsd:extension base="xsd:decimal">
                   <xsd:attribute name="channel" type="xsd:string"/>
                   <xsd:attribute name="dispense\_order" type="xsd:string"/>
                   <xsd:attribute name="plate\_column" type="xsd:string"/>
                   <xsd:attribute name="plate\_row" type="xsd:string"/>
                 </xsd:extension>
               </xsd:simpleContent>
             </xsd:complexType>
           </xsd:element>
         </xsd:sequence>
        

        </xsd:complexType>
        </xsd:element>

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!

        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