Let's see a basic XML file:
<root>
<child attribute='test'>
<subchild attribute='sub'>testdata</subchild>
</child>
</root>
Interpretation
The first line defines the root element of the XML. It is the <root>. The root element can contain any number of child elements. All of them can be found between the opening <root> and closing </root> tag. In our example the file contains a child element. The child element has and that in turn can have its own and so on. There is no restriction as to how many child element is defined. All is up to you.In the second line there is a new element which is a child of the root element. In this case it has an attribute which you can interpret as a property of the given element. In this example the property name is attribute and the property values is 'test'. This element has again a child (line 3) - which is a subchild of the root - element with an attribute. Besides this it has a data with the value of 'testdata'.
As you can see from this small example:
- 1. Each XML element has an opening and a closing tag.
- 2. The attributes is defined inside the opening tag.
- 3. The data is surrounded by opening and closing tags.
discuss this topic to forum
