Monday, 29 August 2016

Introduction XML (eXtensible Markup Language)

Post Brief Table of Content

  • Introduction
  • Introduction to XML
  • XML Document Rules
  • Define XML New Elements

Introduction

Before starting Spring and Hibernate Tutorial, I would like to introduce some XML basics. We need some XML knowledge to understand Spring or Hibernate Configurations. Becase these frameworks uses XML for defining configurations.
Introduction to XML
XML stands for eXtensible Markup Language. HTML is used to display data where as XML is used to transfer and store data.
HTML contains all predefined tags like <html><head><body><title> etc.
In XML, we need to create our own xml elements (tags). We use DTD and XSD to create new XML elements
XML Document Rules
XML Document follows these rules:
  • Each XML Documents must have one and only one root element.
  • XML Document forms a Tree Structure
  • All XML Elements must have a closing tag
  • XML tags are Case Sensitive
  • XML Elements must be properly nested
  • XML attribute values must be quoted either single or double quote
Define XML New Elements
We use the following two options to define new XML elements
  • DTD (Document Type Definition)
  • XSD (XML Schema Definition)
XML Document Example:-
<?xml version=”1.0”?>
<emps>
    <emp>
 <empid>10695</empid>
        <ename>Lokesh</ename>
 <esal>75000</esal>
 <deptno>101</deptno>
   </emp>
   <emp>
 <empid>10696</empid>
        <ename>Posa</ename>
 <esal>65000</esal>
 <deptno>102</deptno>
   </emp>
</emp>


That’s it all about “XML” basics. Now it's time to start Spring and Hibernate Tutorials.
Please drop me a comment if you like my post or have any issues/suggestions. I love your valuable comments so much.
Thank you.