Identify the errors in XML code.

Q10. Identify the errors in the following code:

<?XML version=”1.0”>

<Message date=”8/6/2011”>

<SenderName>Harmeet</SenderName>

<Receivers>

<ReceiversName>Raju</ReceiversName>

<ReceiversName>Reena</ReceiversName>

<Receivers>

<BODY> Welcome to Kogent Pvt.Ltd </Body>

</Message>

Ans. The prolog part of the document contains the error. The word xml is a reserved keyword and cannot be written as XML (capital case).

What rules do you need to keep in mind while defining XML elements.

Q5. What rules do you need to keep in mind while defining XML elements?

Ans. The following are some rules that need to be considered while defining XML elements:

  1. Elements names can start with letters or the underscore (_) character, but not numbers or punctuation characters.
  2. After the first character, you can use numbers and characters, such as hyphen (-) and period (.), in the characters.
  3. Element names cannot contain spaces.
  4. Element names cannot contain the: character because it is reserved character or keyword (that is, it has specific meaning in XML) in the XML specification. Therefore, you should avoid using it in your documents.
  5. Element names cannot start with the word xml in any form (XML or Xml or xml).
  6. Element names cannot have a blank space after the opening character (<); the name of the element must come immediately after it. However, there can be space before the closing character (>).

Benefits of XML over EDI.

Q3. What are the benefits of XML over EDI?
Ans. The following are the benefits of  XML over EDI:

  1. XML Technology is cheaper than ETI technology though it provides more features.
  2. XML allows us to create custom tags to present our document in a standard format.
  3. XML support platform independence. In other words, we can use XML in any platform to transfer date.
  4. The XML parser easily interprets an XML document.
  5. No special knowledge or training is required to understand XML data.

Differentiate between XML and HTML.

Q2. Differentiate between XML and HTML.

Ans. The main difference between XML and HTML ate shown in the following table:

Difference between XML and HTML

XML

HTML

  • Focus on data description.
  • Focuses on the appearance of data.
  • Supports case-sensitivity.
  • Does not support case-sensitivity.
  • Allows users to define their own tags.
  • Allows users to use only predefined tags.
  • Requires the user to close each tag.
  • Does not require the user to close each tag.
  • Requires the user to close attributes and values in double quotes (“ ”).
  • Does not require the user to close attributes and values in double quotes (“ ”).
  • Requires a paper style-sheet file along with the XML document in a browser.
  • Allows us to directly display the HTML document in a browser.

 

Define XML and list benefits of XML.

Q1. Define XML and list the main benefits of XML?

Ans. Extensible markup Language (XML) is a platform –independent markup language used to process and display textual information in a structured way. The platform- independent nature of XML enables us to run an XML document on any operating system. We can create our own set of tags and attributes in XML and use them to display the content of our Web page according to our own set of tags and attributes in XML and use them to display the content of our Web page according to our requirements. The following are the main benefits of XML:

  1. Allows us to create new tags to describe and present data.
  2. Allows us to validate the data.