Wednesday, November 28, 2012

XML Interview Question and Answer


What is XML?
The Extensible Markup Language (XML) is a general-purpose specification for creating custom markup languages.[1] It is classified as an extensible language, because it allows the user to define the mark-up elements. XML’s purpose is to aid information systems in sharing structured data.

What is the version information in XML?
The root element can be preceded by an optional XML declaration element stating what XML version is in use (normally 1.0); it might also contain character encoding and external dependencies information.

What is ROOT element in XML?
XML documents must contain one element that is the parent of all other elements. This element is called the root element.

If XML does not have closing tag will it work?
All XML Elements Must Have a Closing Tag otherwise it will produce error while accessing or parsing.
Is XML case sensitive?

Yes it is. XML tags are case sensitive. With XML, the tag is different from the tag . Opening and closing tags must be written with the same case.
What’s the difference between XML and HTML?
On the surface, XML and HTML look similar. Both use tags (such as or ) and attributes (such as align=”left” or type=”personal”) to add information to the content. In fact, a carefully prepared HTML document can double as an XML document. The difference is that HTML is a well-defined set of elements and attributes. For example, the following is a well-formed XML document, but because it only uses tags that are defined in HTML, it’s also an HTML document:On the other hand, HTML has somewhat looser rules than XML, so some HTML documents are not well-formed XML documents.
Is XML meant to replace HTML?
xml is a portable document structure, which is not really for presentation. XSL or CSS may replace html, but really xml is meant to be a storage medium. It is like asking if databases will replace html. The one aspect that makes this whole thing blurry is that html and now Xhtml is a subset of xml. It is just used to make documents render in browsers.
Can you explain why your project needed XML?
1. If we having huge datas to be transferred instead of sending all those datas as dataset you can opt xml.
2. XML is easy to parse and it enables a faster accessing of datas.
3. Case sensitiveness is an additional advantage in validating the authentication for the user.
4. XML can be passed irrespective of OS, port and protocol.
What is DTD (Document Type definition)?
A Document Type Definition (DTD) defines the legal building blocks of an XML document. It defines the document structure with a list of legal elements and attributes.A DTD can be declared inline inside an XML document, or as an external reference Although XML allows you to invent as many different elements and attributes as you need, these elements and attributes, as well as their contents and the documents that contain them, must all follow certain rules in order to be well-formed. If a document is not well-formed, any attempts to read it or render it will fail.

What is a valid XML?
XML that meets the constraints defined by its Document Type Declaration.

11) What is CDATA section in XML?
CDATA Sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. All tags and entity references are ignored by an XML processor that treats them just like any character data. CDATA blocks have been provided as a convenience measure when you want to include large blocks of special characters as character data, but you do not want to have to use entity references all the time

What is XSL?
Extensible Style Language is a style sheet language aimed at activities such as rearranging the document that are not supported by CSS, though XSL and CSS share the same underlying concepts. XSL can be used to style XML documents u sing sets of rules and definitions of actions to be applied. XSL is a specification from the W3C.

What is Element and attributes in XML?
The basic building blocks of XML Schemas are elements and attributes. Data types define the valid content that elements and attributes contain. When you create XML Schemas, you define the individual elements and attributes and assign valid types to them. Elements describe data, whereas attributes are like properties of an element, in that they provide further definition about the element the way that properties describe characteristics of objects and classes.
An element describes the data that it contains. Elements can also contain other elements and attributes.
An attribute is a named simple-type definition that cannot contain other elements. Attributes can also be assigned an optional default value and they must appear at the bottom of complex-type definitions. Additionally, if multiple attributes are declared, they may occur in any order.

What are the standard ways of parsing XML document?
DOM and SAX parsers are the standard ways for parsing XML document.

 In What scenarios will you use a DOM parser and SAX parser?
In some scenarios, SAX is easily the better choice for quick, less-intensive parsing and processing. In others, the DOM provides an easy-to-use, clean interface to data in a desirable format. You, the developer, must always analyze your application and its purpose to make the correct decision as to which method to use, or how to use both in concert.

What is XSLT?
Extensible Stylesheet Language Transformations. A programming language specialized for the transformation of XML documents.

Define XPATH?
A query language used to identify a set of nodes within a XML document. Originally defined to be used with XSLT, it is also used by XPointer and a simple subset is used in the xs:key, xs:keyref, and xs:unique W3C XML Schema elements. The XQuery specification will be a superset of the second version of XPath. This version will use type information provided by W3C XML Schema

What is an XMLReader Class?
Represents a reader that provides fast, non-cached, forward-only access to XML data.
XmlReader provides forward-only, read-only access to a stream of XML data. The XmlReader class conforms to the W3C Extensible Markup Language (XML) 1.0 and the Namespaces in XML recommendations.

What is XMLTextReader?
The XmlTextReader class requires fast access to XML data. It does not require reading the entire document into memory via the Document Object Model (DOM). The class is derived from the XmlReader class and implements all the methods defined in the XmlReader class. The following are the functions of the XmlTextReader class:
* It enforces rules of a well-formed XML document.
* It does not provide any data validation in a document.
* It checks the Document Type Definition (DTD) and DocumentType nodes for their well-formed structure, but does not validate these nodes by using the DTD.

How do we access attributes using “XmlReader”?
The XmlReader class provides various methods and properties for reading attributes. Attributes are most commonly found on elements. However, they are also allowed on XML declaration and document type nodes.
When positioned on an element node, the MoveToAttribute methods enable you to go through the attribute list of the element. After MoveToAttribute has been called, the node properties—such as Name, NamespaceURI, Prefix, and so on—reflect the properties of that attribute, and not the containing element it belongs to.

What does XmlValidatingReader class do?
Represents a reader that provides document type definition (DTD), XML-Data Reduced (XDR) schema, and XML Schema definition language (XSD) validation.
XmlValidatingReader implements the XmlReader class and provides support for data validation. Use the Schemas property to have the reader validate by using schema files that are cached in an XmlSchemaCollection. The ValidationType property specifies what type of validation the reader should perform. Setting the property to ValidationType.None creates a non-validating reader.

What is XML?
XML is a markup language for specific documents which contain structured information. Structured information is both content and indication of contents role. Every document has specific structure. The mechanism which is used to determine structures in a document is known as a markup language. XML specification describes a perfect way to add markup o the documents.
• The abbreviation of XML is extensible markup language.
• XML is also a markup language which is same as HTML.
• XML is especially designed to describe data.
• The tags of XML are not predefined and the tags must be defined on your own.
• XML describes data using XML schema or Document Type Definition.
• XML is W3C recommendation.
• XML with XML or DTD Schema is especially designed to be self-descriptive.

Differentiate SAX and DOM parsers?
XML document is parsed using both SAX and DOM. Both have some advantages and disadvantages and are used in the programs based on the situation.
SAX:
• It parses node by node.
• XML is not stored in the memory.
• A node cannot be inserted or deleted.
• Traversing is from top to bottom.
DOM:
• It occupies more space in the memory.
• Complete document is stored in the memory before processing.
• Nodes can be inserted or deleted.
• Traversing is possible in any direction.

How an XML file is created?
XML can be created by plain text editor such as notepad or by .net model using various inbuilt methods such as XmlTextWriter.

Define XML namespace?
XML namespace offer a method to prevent element name conflicts. The collection of attribute names and element type is known as a XML namespace. A reasonable argument is made that XML namespaces do not exist conceptual or physical entities.

Does XML language replace HTML?
No, HTML is not replaced by XML. Instead, it is an alternative which permits you to define own set of markup elements. XML is specially designed to make DTDs writing simpler than full SGML.
Describe XMLHttpRequest Object?
XMLHttpRequest is sued to:
• Update webpage without reloading.
• Data is requested from server after loading the page.
• Data is received from the server after loading the page.
• Data is sent to the server in the background.
XMLhttp=new XMLHttpRequest();


Which software is used to process XML namespaces?
There is no special XML software.

Define XML namespace name?
XML namespace name is URI that identifies namespace uniquely. URIs are used as they are used widely and documented perfectly. Because, people allocate URIs under their control and it is easy to ensure no two XML namespaces are determined by same URI.

Differentiate XML and HTML?
XML:
• Slash
• These tags are defined by user
• Quotes
• Content driven end tags
HTML:
• Slash is not required
• Defined set of tags
• Quotes are not necessary
• Format driven
• End tags are not required

Define DOM?
The abbreviation of DOM is Document Object Model. It is an interface specification which is maintained by W3C DOM workgroup.
11. Why XML is vital in development?
Two constraints are removed by XML which hold back web developments: inflexible document type and dependence on a single.


Give basic issues to use attributes?
Some of the issues in using attributes are:
• Attributes do not have many values.
• Attributes do not contain tree structures
• Attributes cannot be expanded easily
Reading and maintaining attributes is very difficult. Elements are used for data. Attributes are used for information which is not related to data.

Give essential components of security and do signatures of XML provide it?
The following are three components:
• Message integrity
• Authentication
• Non-repudiation
Besides signature information, information is also present in the XML signature which describes key used to sign content.

Give examples for XML Editors?
• eNotepad
• XML Spy
• XML Pro
• XML Notepad
• XML Cooktop

Give XML Editor Benefits?
• While coding XML, it prevents from making mistakes.
• XML and HTML editors are same and they give syntax highlighting which helps with readability while coding.
• Closing tag is inserted automatically if you add an opening tag such as HTML editor.


  1. What is the difference between SAX parser and DOM parser?
  2. What is the difference between Schema and DTD?
  3. How do you parse/validate the XML document?
  4. What is XML Namespace?
  5. What is Xpath?
  6. What is XML template?
  7. How would you produce PDF output using XSL’s?
  8. What are the steps to transform XML into HTML using XSL?
  9. What is XSL?
  10. What is XSLT?

4 comments:

  1. Thanks for sharing useful post regarding website promotion. Before start website promotion work you should optimized website in proper way like you mansion step by step techniques in your post. || Smo Package Plans in Mumbai || Seo Package Plans in Mumbai || PPC Advertising Services in Mumbai

    ReplyDelete
  2. The post is absolutely fantastic! Lots of great information and inspiration both of which we all need! Also like to admire the time and effort you put into your blog. For more info visit. SEM company in Mumbai || SMO Services in Mumbai || SMO Company in Mumbai

    ReplyDelete

  3. Great blog. Thanks for share this post. It may helpful for all newbie bloggers, i really appreciate
    SMM Services in Mumbai || SEM Services in Mumbai || SMM Company in Mumbai

    ReplyDelete

  4. Great blog. Thanks for share this post. It may helpful for all newbie bloggers, i really appreciate
    SMM Services in Mumbai || SEM Services in Mumbai || SMM Company in Mumbai

    ReplyDelete

SQL BASIC

  • Sql-Overview
  • Sql-Sysntax
  • Sql-Normalization
  • RDBMS Concept
  • Sql-Data Type
  • Sql-Operator
  • Sql-Expression
  • Create database
  • Sql-Delete
  • Sql-Select
  • Sql-Create
  • Sql-Like
  • Sql-Join
  • Sql-Insert
  • Sql-Drop Table
  • Sql-Wild Card
  • Sql-Order By
  • Sql-Group By
  • Sql-Index
  • Not Null Constraints
  • Transaction Control
  • Sql-Transaction
  • Sql-In
  • Sql-Distinct
  • Check Constraint
  • Sql Alias
  • Sql-Primary
  • Sql-Where
  • Sql-Update
  • Sql-Alias
  • Sql-Top-Rownum
  • Primary key vs Unique key
  • SQL Interview Question
  • PL/SQL BASIC

  • Variable
  • Block Structure
  • Function
  • Procedure
  • Nested Blog
  • If Statement
  • While Loop
  • For Loop
  • SEO

  • Introduction Seo
  • Top Social Bookmarking List
  • Directory Submission List
  • Classified Ads
  • Key Word Research
  • Html

  • Introduction Html
  • Introduction Css
  • Introduction Java Script
  • Unix

  • Unix
  • Software Testing

  • Software Testing
  • Computer Network

  • Computer Network
  •