XML net interview question

7. Which namespaces in .NET are used for XML?

The System.xml.dll is the real physical file, which contains the XML implementation. Some of the other namespaces that allow .NET to use XML are as follows:

  • System.Xml
  • System.Xml.Schema
  • System.Xml.XPath
  • System.Xml.Xsl

8. Explain different types of XML Application Programming Interface (API).

The following are two main types of XML parsers:

  • Tree-based API – Compiles an XMLDOCUMENT into a tree structure and loads it into memory. You can traverse and change the tree structure. The DOM is an example of a tree-based API.
  • Event-based API – Provides the report to an application about the parsing events by a set of built-in callback functions. An example of the event-based API is SAX.

9. Explain the XmlReader class.

The XmlReader class is used to read XML data in a fast, forward-only, and non-cached manner.
To work with XmlReader class in .NET, you need to import the following namespace:

In C#:
using System.Xml;

In VB:
Imports System.Xml

10. Describe the XmlWriter class.

The XmlWriter class is used to write XML to a stream, a file, or a Textwriter object. This class works in a forward-only, non-cached manner. You can configure the XmlWriter object up to a large extent. With this object, you can specify a few things, such as whether to indent content or not, the amount to indent, what quote character to use in attribute values, and whether or not namespaces are supported.

11. What is XPath?

XPath stands for XML Path. It is a language used to access different parts of an XMLDOCUMENT, such as elements and attributes.

12. What is an XML attribute?

An XML attribute contains additional information regarding that particular element. The XML attributes use the name-value pair. For example, the element student has an attribute called id and the value of this attribute is set to s01, as shown in the following code snippet:

<Student ID=”s01″>


Leave a Reply1