Xml-ElementRule

From WikiEducator
Jump to: navigation, search
Uou-logo-100px.png
Home  |  About UOU  |  About CEMCA  |  Contact Us    

Unit 3.3 Web application development tools & Technologies


3.3.4 XML
3.3.4.1 XML document structure
3.3.4.2 XML element naming rules
3.3.4.3 Important rules to keep in mind while creating XML document
3.3.4.4 Viewing a XML document
3.3.4.5 Displaying XML with XSLT

3.3.4.3 Important rules to keep in mind while creating XML document

Rule
Wrong Right

XML document should be well formed,

end tag must have the same name as the start tag.

<contact-detail>
<name> Aakash
</contact-detail> </name>

<contact-detail> <name> Aakash

</name> </contact-detail>

XML Document must be only one root element.
<contact-detail1> <name> Aakash Rathore </name> </contact-detail1>
<contact-detail2> <name> Naresh Kumar </name> </contact-detail2>
<contact-detail>
<name> Aakash Rathore </name>
<name> Naresh Kumar </name>
</contact-detail>

XML is case sensitive, so be aware about the name of tags.      It will generate parser error because name and NAME are different.

<name> Aakash Rathore </contact-detail> </NAME>
<name> Aakash Rathore </contact-detail> </name>
XML attribute value must be quoted.Date is an attribute of XML element <contact-detail>
<contact-detail date=02/05/2012>
<name> Aakash Rathore </name>
<company> ABC Ltd. </company>
<phone> 234567 </phone>
</contact-detail>
<contact-detail date=”02/05/2012”>
<name> Aakash Rathore </name>
<company> ABC Ltd. </company>
<phone> 234567 </phone>
</contact-detail>


Note : White space in document is not automatically truncated.
Next
Suggested Reading
  • Web Applications


 Suggested Videos
  • Video 01 Title
  • Video 02 Title
  • Video 03 Title