XML interview questions part-II

The XML elements cannot be empty. Is it true?
No, it is not true.


14. Describe the role that XSL can play while dynamically generating HTML pages from a relational database.

The SQLXML 3.0 and advanced versions provide the facility of mapping the SQL queries output with XSLT templates. It uses XSLT to present the records that are retrieved from databases on Web pages (HTML pages).


An application can use XSLT to modify the output that is retrieved from data sources and display the output by XSL templates. The XSLT displays data without affecting the database query and the code of application.


15. What are the advantages of DOM?
The following are the advantages of DOM:
  • DOM stores the entire XML document into memory before processing. Therefore, the XML structure can be easily modified and values can be added, changed, and removed.
  • DOM enables to traverse the XML structure in any direction. It means that you can access any node of the XML structure by traversing through the XML structure.


16. Give an example of a DOM-enabled XML parser.
The XML parser is MSXML, which is fully DOM-enabled.


17. What is an XML schema?
An XML schema provides the definition of an XML document. This implies that an XML schema defines the following in an XML document:
  • The elements that can appear in an XML document.
  • The attributes that can appear in an XML document.
  • The elements that are child elements.
  • The order of child elements.
  • The number of child elements.
  • Whether an element is empty or it includes some text.
  • The data types for elements and attributes.


18. State the advantages of XML schemas over DTD.
Microsoft developed a language known as the XML Schema Definition (XSD) to describe the schema to an XML document. The following are the advantages of XML schemas over DTDs:
  • XSD keeps much better control over types of data than the DTD.
  • DTD does not allow creating customized data types while the XSD provides full support to create customized data types.
  • XSD allows you to specify restrictions on data. It means that you can define the type of data that should be stored in an element, for example numbers or alphabets.
  • The XSD is quite easy to learn and to understand because its syntax is same as that of the XML document.
19. Using XSLT, how would you extract the value of a specific attribute from an element in an XML document?
The components necessary for the above mentioned operation are as follows:
  • The template element - Matches the correct XML element.
  • The value-of element - Selects the attribute value.
  • The optional apply-templates element - Allows continuous processing of the document


20. Which classes are supported to make an XML DOM?
The following are the different classes in the System.Xml namespace that make up the XML DOM:
  • The XmlNode class
  • The XmlDocument Class
  • The XmlElement Class
  • The XmlAttribute Class
  • The XmlText class
  • The XmlComment class
  • The XmlNodeList Class


21. Which class is used to encode and decode XML names and contains different methods to convert between CLR types and XSD types.

The XmlConvert Class.


22. What is the DTD?
The DTD is Document Type Definition that describes the formation of the content of an XML document. The DTD manages the data to store in a consistent format. It defines the XML elements and attributes about how they should be present in XML documents and what relation they should have with other elements and attributes. The DTD also allows you to mention whether an XML element is optional or not. If the XML documents are not according to the DTD rules, they are not considered valid.


23. Is it true that the XML's goal is to replace HTML?
No, it is not true. Both are necessary in their respective fields.


24. What is XSLT?
XSLT is Extensible Stylesheet Language Transformations that is a part of XML, which is a mechanism to transform an XML document into another XML or HTML document.

No comments:

Post a Comment