Friday, February 18, 2011

XML


XML

XML stands for extensible markup language xml is designed to carry and transport data
Where as Html is just to display data,

Xml can be categorized into 2 types they are

 1.well formed xml
 2.Validate xml

 Rules of an xml
    It should be have opening and closing tags
    Tags should have properly nested
    We can define our own tags
    The root element is called parent element and it should have some child elements(tags)
     Elements are the tag names and attributes are called their values
    
 Well fomed xml should have to follow the above rules
  Validate xml is a well formed xml and it should follow DTD rules and regulations
  Validate xml having two types they are
                                       1.DTD
                                       2.Schema
DTD example
------------------- 

<!DOCTYPE note
[
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
      

Schema example
<xs:element name="note">
<xs:complexType>
  <xs:sequence>
    <xs:element name="to" type="xs:string"/>
    <xs:element name="from" type="xs:string"/>
    <xs:element name="heading" type="xs:string"/>
    <xs:element name="body" type="xs:string"/>
  </xs:sequence>
</xs:complexType>
</xs:element>