Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Elements vs.

Attributes
Example 1 <Dheeru> <FirstName>Dheerendra</FirstName> <LastName>Kumar</LastName> <Employer>Wipro Technologies</Employer> <Address> <Block>274</Block> <Street>22</Street> <city>Yishun</city> </Address> </Dheeru>

Root Element Child Element Child Element Element data Corresponding DTD <!ELEMENT Dheeru (FirstName,LastName,Employer,Address)> <!ELEMENT LastName (#PCDATA)> <!ELEMENT FirstName (#PCDATA)> <!ELEMENT Block (#PCDATA)> <!ELEMENT Address (Block,Street,city)> <!ELEMENT city (#PCDATA)> <!ELEMENT Employer (#PCDATA)> <!ELEMENT Street (#PCDATA)> Example 2

<Dheeru EMPID="202658"> <FirstName>Dheerendra</FirstName> <LastName>Kumar</LastName> <Employer>Wipro Technologies</Employer> <Address> <Block>274</Block> <Street>22</Street> <city>Yishun</city> </Address> </Dheeru>

Root Element

Attribute Child Element Child Element Element data Corresponding DTD <!ELEMENT Employer (#PCDATA)> <!ELEMENT Block (#PCDATA)> <!ELEMENT LastName (#PCDATA)> <!ELEMENT Street (#PCDATA)> <!ELEMENT FirstName (#PCDATA)> <!ELEMENT Dheeru (FirstName,LastName,Employer,Address)> <!ATTLIST Dheeru EMPID CDATA #IMPLIED> <!ELEMENT Address (Block,Street,city)> <!ELEMENT city (#PCDATA)>

You might also like