1 Reply Latest reply on Oct 5, 2011 1:25 PM by Steve L Walker

    Difficulty Binding Children and SubChildren

    no2morrow

      So I've got a Neighborhood.  In this neighborhood I have multiple Houses, each of which has Owners and the owners have Children.

       

      I've got the following schema:

                                                                                                                                                                                                                                                                                                                                                                                                 

                                                                                                                                                                                                                                                                                                                               

       

      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="Neighborhood">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="House" minOccurs="1" maxOccurs="unbounded">
              <xs:complexType>
                <xs:sequence>
                  <xs:element name="Address" type="xs:string"/>
                  <xs:element name="Color" type="xs:string"/>
                  <xs:element name="Owner" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                      <xs:sequence>
                  
                        <xs:element name="FName" type="xs:string"/>
                        <xs:element name="LName" type="xs:string"/>
                        <xs:element name="child" minOccurs="0" maxOccurs="unbounded">
                          <xs:complexType>
                          <xs:sequence>
                            <xs:element name="CFName" type="xs:string"/>
                            <xs:element name="CLName" type="xs:string"/>
                          </xs:sequence>
                          </xs:complexType>
                        </xs:element>
          
                      </xs:sequence>
                    </xs:complexType>
                  </xs:element>
                </xs:sequence>
              </xs:complexType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      </xs:schema>
      

       

       

      When I fill out my form, unfortunately I only get the following and I do not know why.

       

       

        <?xml version="1.0" encoding="UTF-8" ?>
       <Neighborhood>
             <House>
                 <Address><br>123 Main</Address>
                      <Color>Blue</Color>
              </House>
            <House>
                 <Address>16 S St</Address>
                 <Color><br>Red</Color>
            </House>
       </Neighborhood>
      
        • 1. Re: Difficulty Binding Children and SubChildren
          Steve L Walker Level 5

          If you entered address and color data only, the results are accurate for your schema.

           

          Is this what you're after?

           

          <?xml version="1.0" encoding="UTF-8"?>

                    <House>

                              <Address>String</Address>

                              <Color>String</Color>

                              <Owner>

                       <FName>String</FName>

                       <LName>String</LName>

                       <child>

                            <CFName>String</CFName>

                            <CLName>String</CLName>

                        </child>

                        <child>

                            <CFName>String</CFName>

                            <CLName>String</CLName>

                                        </child>

                              </Owner>

                    </House>

          </Neighborhood>

           

          If so, try this...

           

          <?xml version="1.0" encoding="ISO-8859-1"?>

          <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

                    <xs:element name="Neighborhood">

                              <xs:complexType>

                                        <xs:sequence>

                                                  <xs:element name="House" minOccurs="1" maxOccurs="unbounded">

                                                            <xs:complexType>

                                                                      <xs:sequence>

                                                                                <xs:element name="Address" type="xs:string"/>

                                                                                <xs:element name="Color" type="xs:string"/>

                                                                                <xs:element name="Owner">

                                                                                          <xs:complexType>

                                                                                                    <xs:sequence>

                                                                                                              <xs:element name="FName" type="xs:string"/>

                                                                                                              <xs:element name="LName" type="xs:string"/>

                                                                                                              <xs:element name="child" maxOccurs="unbounded">

                                                                                                                        <xs:complexType>

                                                                                                                                  <xs:sequence>

                                                                                                                                            <xs:element name="CFName" type="xs:string"/>

                                                                                                                                            <xs:element name="CLName" type="xs:string"/>

                                                                                                                                  </xs:sequence>

                                                                                                                        </xs:complexType>

                                                                                                              </xs:element>

                                                                                                    </xs:sequence>

                                                                                          </xs:complexType>

                                                                                </xs:element>

                                                                      </xs:sequence>

                                                            </xs:complexType>

                                                  </xs:element>

                                        </xs:sequence>

                              </xs:complexType>

                    </xs:element>

          </xs:schema>

           

          Steve