In this post i am going to give an Introduction of XML technology.
What is XML?
Markup : Enclosing textual content with in textual code(tags) is nothing but markup.
Purpose :
Syntax with example :
<?xml version="1.0" encoding="utf-8"?>
<student>
<sno>10</sno>
<sname>sudeep</sname>
<sage>18</sage>
</student>
Well-Formness
It indicates the readability nature of an XML document.
1. Start element <eleementname>
2. End element </elementname>
An element can contain
Avoid using attributes.
< : <
> : >
& : &
" : "
' : '
© : c
What is XML?
- XML stands for eXtensible Markup Language.
- XML is designed to transport and store data.
- It is not a programming language, i's a markup language.
- It is a specification of W3C(World Wide Web Consortium)
Purpose :
- Used to exchange the information
- XML documents are used as deployment discriptors
- Used as textual databases.
Syntax with example :
<?xml version="1.0" encoding="utf-8"?>
<student>
<sno>10</sno>
<sname>sudeep</sname>
<sage>18</sage>
</student>
Well-Formness
It indicates the readability nature of an XML document.
- XML Document start with PROLOG.
- Start tag must have a matching end tag.
- Root element.
- Level constraint.
- Attribute values must be quoted.
- Elements are case sensitive.
1. Start element <eleementname>
2. End element </elementname>
An element can contain
- Other elements
- Text
- Attribute
- Mix of all
XML Attribute
If you want to add supplementary information attah to an element, instead of having another element.
- Attribute is unique in xml
- It can occur in any order.
Avoid using attributes.
- It can not contain multiple values.
- More difficult to manipulate code
< : <
> : >
& : &
" : "
' : '
© : c
Naming Rules :
- names can contain letters, numbers and other characters.
- name cannot start with number or punctuation characters.
- Names cannot start wiht the letters xml.
Best Practices :
- Make names descriptive.
- Names should be short and simple.
- Avoid using hyphen(-), period(.) and colon(:) in the code.
Validating XML :
If an xml document is developed accorrding to rules specified in DTD/XSD.
Validating xml can be done by :
- XML Parsers.
- XML Editors.
XML Parser :
It's an API that enables XML applications to work with xml document. It performs
- Reading the XML document.
- Checking the well-formedness
- Verify its validity.
- Making XML data available to XML applications.
XML Editors :
XML Editors are just like text editors which have the feature to check well-formness of our XML document and to validate the same.
The best one is Altova XMLSpy. You can download a windows version here. Unfortunately Altova doesn't provide Linux version for XMLSpy.
IDE's also have the feature of validating and checking the well-formedness of xml document.
No comments:
Post a Comment