Can anybody please tell me how to identify the attributes and the child elements in the XML tree and what are attributes please its urgent tomorrow is my exam???????
Answers
Answer:
Explanation:
Root element is the one which contains all other tags. It opens and closes once in the document
Child element is which contains no tags in it and contains only the information about itself
Attributes are the information used to describe the element in which it is written
Answer
For better understanding take an example,
<?xml version="1.0"?>
<employee id="901">
<name>
<first>John</first>
<last>Doe</last>
</name>
<office>344</office>
<salary currency="USD">55000</salary>
</employee>
Attributes
Here attribute of <employee> is id=901 so while making the tree structure you need to write the attribute value under the box of employee (eg. id=901).
Similarly, currency=USD is the attribute of <salary>.
Child elements
Every subsequent tag after the root element is called child element.
Eg. <name> is the child of <employee>
Similarly, <first> and <last> are childs of <name>