user744587
user744587

Reputation:

How to write a simple XML file

Grandfather (GF) > Father > Children

Grandfather (GF) : has n number of children which denoted as father (F)

Father (F) : Father has n number of Children and also has an attribute father-name

Children : children has attribute child-name

Please correct me, if i'm wrong

<GF>
  <father>
     <father-name> f1
             <child-name> f1c1 </child-name>
             <child-name> f1c2 </child-name> 
     </father-name>
     <father-name> f2 
              <child-name> f2c1 </child-name> 
              <child-name> f2c2 </child-name>
              <child-name> f2c3 </child-name>
      </father-name>
      <father-name> f3
               <child-name> f3c1 </child-name>
      </father-name>
   <father>
</GF>

Upvotes: 2

Views: 200

Answers (1)

Andrei
Andrei

Reputation: 56726

Here is the the correct xml for your description

<GF>
     <father fName="f1">
             <child child-name="f1c1" />
             <child child-name="f1c2" />
     </father>
     <father fName="f2">
              <child child-name="f2c1" />
              <child child-name="f2c2" />
              <child child-name="f2c3" />
      </father>
      <father fName="f3">
               <child child-name="f3c1" />
      </father>
</GF>

Hope it helps

Upvotes: 1

Related Questions