Wednesday 6 September 2017

XML interview Questions?



What is XML?
XML is a file extension for an Extensible Markup Language (XML) file format used to create common information formats and share both the format and the data on the World Wide Web, intranets, and elsewhere using standard ASCII text.
XML is similar to HTML. Both XML and HTML contain markup symbols to describe the contents of a page or file. HTML, however, describes the content of a Web page (mainly text and graphic images) only in terms of how it is to be displayed and interacted with. For example, the letter "p" placed within markup tags starts a new paragraph.

What is the version information in XML?
“version” tag shows which version of XML is used.
Its used to uniquely identify the XML and enable the developer to identify which XML to be used in appropriate places.

What is ROOT element in XML?
In any markup language, the first element to appear is called the "root element", which defines what kind of document the file will be. In an HTML file, the <html> tag is the root element. An HTML file will always have the HTML element as the root element, while in an XML file, it can be anything.

In an XML file, there can only be one root element. The root element must encapsulate all other elements--meaning, these other elements must show up after the opening root tag and before the closing root tag. Here is an example of an XML document with the root element "phonebook".

XML Code:-

<phonebook>
            <number>
            </number>
            <name>
            </name>
</phonebook>

If XML does not have closing tag will it work?
No, every tag in XML which is opened should have a closing tag. For instance in the top if I remove </discount> tag that XML will not be understood by lot of application.

Is XML case sensitive?
Yes - XML is case sensitive.

What is the difference between XML and HTML?
  • XML was designed to carry data - with focus on what data is
  • HTML was designed to display data - with focus on how data looks
  • XML tags are not predefined like HTML tags are
  • XML store data - HTML present it

Is XML meant to replace HTML?
No. XML itself does not replace HTML. Instead, it provides an alternative which allows you to define your own set of markup elements. HTML is expected to remain in common use on the web, and the current versions of HTML (XHTML and HTML5) are in XML syntax.
XML is designed to make the writing of processing software much easier than with SGML, which is what the original HTML was based on.

Can you explain why your project needed XML?
XML was meant to exchange data between two entities as you can define your user friendly tags with ease. In real world scenarios XML is meant to exchange data. For
instance you have two applications who want to exchange information. But because they
work in two complete opposite technologies it’s difficult to do it technically. For instance
one application is made in JAVA and the other in .NET. But both languages understand
XML so one of the applications will spit XML file which will be consumed and parsed by
other applications

What is DTD (Document Type Definition)?
A DTD is a Document Type Definition.
A DTD defines the structure and the legal elements and attributes of an XML document.

Why Use a DTD?
With a DTD, independent groups of people can agree on a standard DTD for interchanging data.
An application can use a DTD to verify that XML data is valid.

An Internal DTD Declaration
If the DTD is declared inside the XML file, it must be wrapped inside the <!DOCTYPE> definition:

XML document with an internal DTD

<?xml version="1.0"?>
<!DOCTYPE note [
<!ELEMENT note (to,from,heading,body)
>

<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend</body>
</note>

An External DTD Declaration

<?xml version="1.0"?>
<!DOCTYPE note SYSTEM "note.dtd">
<note>
  
<to>Tove</to>
  
<from>Jani</from>
  
<heading>Reminder</heading>
  
<body>Don't forget me this weekend!</body>
</note>

And here is the file "note.dtd", which contains the DTD:

If the DTD is declared in an external file, the <!DOCTYPE> definition must contain a reference to the DTD file:
<!ELEMENT note (to,from,heading,body)>
<!ELEMENT to (#PCDATA)>
<!ELEMENT from (#PCDATA)>
<!ELEMENT heading (#PCDATA)>
<!ELEMENT body (#PCDATA)>

What is well formed XML?

An XML document with correct syntax is called "Well Formed".
An XML document validated against a DTD is both "Well Formed" and "Valid".

What is a valid XML?

What is CDATA section in XML?

The CDATASection object represents a CDATA section in a document.
A CDATA section contains text that will NOT be parsed by a parser. Tags inside a CDATA section will NOT be treated as markup and entities will not be expanded. The primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.
The only delimiter that is recognized in a CDATA section is "]]>" - which indicates the end of the CDATA section. CDATA sections cannot be nested.

Example:
The following markup code shows an example of CDATA. Here, each character written inside the CDATA section is ignored by the parser.
<script>
   <![CDATA[
      <message> Welcome to TutorialsPoint </message>
   ]] >
</script >


What is XSL?
What is element and attributes in XML?
Element :-
An XML element is everything from (including) the element's start tag to (including) the element's end tag.
Example:-
<price>29.99</price>

Attribute :
Attribute values must always be quoted. Either single or double quotes can be used.

For a person's gender, the <person> element can be written like this:
Example:
<person gender="female">


Which are the namespaces in .NET used for XML?

What are the standard ways of parsing XML document?
By using XMLDocument and XDocument

In What scenarios will you use a DOM parser and SAX parser?

How was XML handled during COM times?
What is the main difference between MSML and .NET Framework XML classes?
What are the core functionalities in XML .NET framework? Can you explain in detail those
functionalities?

What is XSLT?
With XSLT you can transform an XML document into HTML.

Define XPATH?
XPath is a major element in the XSLT standard.
XPath can be used to navigate through elements and attributes in an XML document.


What is the concept of XPOINTER?
What is an XMLReader Class?
What is XMLTextReader?
How do we access attributes using “XmlReader”?
Explain simple Walk through of XmlReader.
What does XmlValidatingReader class do?