Thursday, 4 July 2013

What is XML

 HTML and XML are brother and sister. Their mother is SGML


XML is Widely used For Communication over web with various types of web services
When we communicate over web or Internet using Hyper text protocols Get and Post Method
To Get and Post data over web XML is highly used 

XML stands for Extensible Markup Language
XML is a markup language much like HTML And Similarly It consist of Tags.
XML was designed to Deal Mainly with Storage of Data Rather Than Display or Presentation     Of Data as Done in HTML
XML tags are not Fixed Tags You Can define your own tags with Different Names And these tags can be defined by user or declared by user According to Data You want to Store
XML is Self - Descriptive in nature And All Tags Are According to Data That is to be stored
XML is a Most Widely used Data storage Today

DIFFERENCE BETWEEN HTML AND XML

HTML Is a Hypertext markUp Language.
XML Is a Extensible markUp Language

HTML Focus on Providing Good Presentation of Data Or how to present the data
XML Focus on Storage Of Data 

HTML Does not allow you to create your own Tags
XML Allow you to Create your Own Tags


ADVANTAGES OF XML

* XML is Extensible markup language that is free of cost to use. XML can be opened in
Notepad or other default Text Editor availaible in your operating System
* XML is Independent of Operating System . It can be used with any operating availaible
today
* It is easy to read Storage of Data As it is in Hierarchial Structure. We can easily
recognize the structural Elements 

* XML Is Self-Descriptive . Like HTML it consist of tags that describe the data automatically

XML WITH VISUAL BASIC.NET

* .NET Provides good support for XML. It can easily used for storing data From Winform 
In .NET To XML Files 

* In .NET Namespace used for using XML files is :- 

System.xml

1. First ,  We Require XML Document
2. Secondly, We Require other Elements like - Declaration, comment, root, element1(name), element2(age),element3(gender).
3. Now Get Values to be stored or to get to and from XML Document
4. Now Create the xml doc.

CREATE XML DOCUMENT

An xml document is created by declaring the following elements first :-

 Dim declarexmldoc As XmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes")
            Dim xmlcomment As XmlComment = doc.CreateComment("This is my xml document")
            Dim xmlroot As XmlElement = doc.CreateElement("Persons")
            Dim person As XmlElement = doc.CreateElement("Person")
            Dim name As XmlAttribute = doc.CreateAttribute("name")
            Dim age As XmlElement = doc.CreateElement("age")
            Dim gender As XmlElement = doc.CreateElement("gender")



1. declarexmldoc :- It is an object of type xmldeclaration. It consist of three arguments 

First :- First argument tells the verson number "1.0" of XML that currently we are using.

Second :- Second Argument tells the Enconding technique that we are using "UTF-8".
Where UTF-8 is a UCS Transformation Format . It is 8-bit character encoding technique .

Third :- Third Argument tells whether to create it standalone or not 

2.  xmlroot = Persons in example given below.
3.  person ,name , age, gender are elements of xml document given in example below.

EXAMPLE of AN XML DOCUMENT

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--This is my xml document-->
<Persons>
  <Person name="one">
    <age>1</age>
    <gender>I am single</gender>
  </Person>
  <Person name="two">
    <age>2</age>
    <gender>I am double</gender>
  </Person>
  <Person name="Three">
    <age>3</age>
    <gender>I am triple</gender>
  </Person>
  <Person name="Quadruple">
    <age>4</age>
    <gender>We are quadruple</gender>
  </Person>
</Persons>

No comments:

Post a Comment