Unanswered my xsd file

  • Wednesday, March 06, 2013 5:32 PM
     
      Has Code

    Hi

    I want to be able to do the following but i am not sure how to do it. As you can see in the ConfigurationFileType there are three elements.

    ServerSettingsType and AdministrativeType can appear in any order 0 or 1 times. thats fine.

    But my xml file might have 1 or more additional elements at the same level. how do i do this.

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">
      
    
     <xsd:element name="ConfigurationFile" type="ConfigurationFileType"/>
     
     <xsd:complexType name="ConfigurationFileType">
    	<xsd:all>
       		<xsd:element name="ServerSettings"  type="ServerSettingsType" minOccurs="0" maxOccurs="1"/>
       		<xsd:element name="Administrative"  type="AdministrativeType" minOccurs="0" maxOccurs="1"/>
          <xsd:element name="*" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:all>
    </xsd:complexType>
    
     <xsd:complexType name="ServerSettingsType">
      <xsd:sequence>
       <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
      </xsd:sequence>
     </xsd:complexType>
    
    <xsd:complexType name="AdministrativeType">
      <xsd:sequence>
       <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
      </xsd:sequence>
     </xsd:complexType>
    
    </xsd:schema>

All Replies

  • Wednesday, March 06, 2013 6:28 PM
     
      Has Code

    I guess the following works but is kinda relaxed.

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">
      
    
     <xsd:element name="ConfigurationFile" type="ConfigurationFileType"/>
    
      <xsd:complexType name="ConfigurationFileType">
        <xsd:sequence>
          <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>

    could i make the <xsd:any ref="SettingsType" so how?

    <xsd:element name="SettingsType" >
        <xsd:complexType>
          <xsd:sequence>      
            <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

  • Monday, March 11, 2013 8:38 PM
     
     
    You'll be OK if you will not validate your xml with this xsd. The schema validation is optional.

    Leonid Ganeline [BizTalk MVP] BizTalk: the Naming Conventions in Examples