XML

What is XML?

XML is abbreviation for EXtensible Markup Language. It’s a markup language like HTML XML was designed to carry data, not to display data.XML tags are not predefined. You must define your own tags it’s designed to be self-descriptive.


Advantages of XML:

   • It is easy to use and learn like HTML.
   • It is a platform independent language.
   • XML is compatible with applications like JAVA, and it can be used in any application which is capable of processing XML irrespective of the platform it is being used on.
   • XML is an extremely portable language; it can be used on large networks with multiple platforms like the internet.
   • XML is an extendable language; it allows creating your own tags, or using the tags which have already been created.

The Advantages of XML in Java

   • XML consists of Common Component Architecture (CCA) and Common Object Request Broker Architecture (CORBA) along with standard protocol which helps in interoperability for programs.
   • XML allow Remote Method Invocation in Java .which involves invoking one object from another object in java
   • It possible to connect to the program using the remote procedure calling, or RPC in short using XML.

XML Structure:

<root>
<child>
<subchild>.....</subchild>
</child>
</root>

The syntax and rules of XML:

1. All XML Elements Must Have a Closing Tag

   For example:

    Correct : <p>Hello World</p>
    Wrong : <p>Hello World

2. XML elements are case sensitive

   For example:

    Correct : <role>Software Engineer</role>
    Wrong : <Role>Software Engineer</role>

3. XML Attribute Values Must be quoted

   For example:

    Correct:
<log date=”12/11/2007”>
<message>File not found</message>
<errorcode>404</errorcode>
</log>
    Wrong:
<log date=12/11/2007>
<message>File not found</message>
<errorcode>404</errorcode>
</log>

XML naming conventions:

   • Numbers and punctuation characters are allowed as first character
   • Combinations of letters, Numbers and other characters are allowed
   • Xml, XML, Xml cannot be used as name.
   • Blank spaces in names are not allowed

Comments