Search the web
Sign In
New User? Sign Up
j2eeguide · Java J2EE Interview Preparation Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
XML Interview Questions   Message List  
Reply | Forward Message #3 of 3 | Next >


What is a Markup language? 
Markup refers to anything put on a document which adds some special meaning or provides some extra information.
Markup can be classified into three types
1. Stylistic Markup ( <font> <I> <B> .. )
2. Structural Markup   ( <H1><P><DIV> …)
3. Semantic Markup ( <TITLE> <META>..)

Can you give few examples for Markup Languages?
SGML, HTML, XML, WML and MathML are few examples of Markup Langauges.

What is SGML?
SGML stands for Standard Genaralised Markup Language. SGML is the base for all markup languages. 
But it is too bulky and too complicated to be used in web technology.
XML takes its root from SGML and nullifies all the drawbacks of SGML.

What is XML?
XML is the Extensible Markup Language which is designed to enable the use of SGML on the World Wide Web.
XML is not a single predefined markup language : it's a metalanguage - a language for describing other languages.

What are the advantages of XML?
The following are advantages of XML:
XML separates data and display
XML allows you to create custom tags that relate to the content.
View the same data in different ways.
XML takes the best of SGML and combines it with the ease of HTML.
XML is based on Unicode and makes it handle even complex languages also.
XML is platform and language independent.

What are the drawbacks of HTML?
The following are the drawbacks of HTML:
HTML has a fixed tag set.
HTML is a presentation technology.
HTML is flat.( No Hierarchy)
HTML is very lenient. Lacks syntactic checking.
HTML lacks structure. No order of tags specified.
No internationalization support.
HTML is not suited for data interchange.
HTML is not reusable.
HTML is not extensible.

What are the differences between XML and HTML?
XML HTML
Allows to create custom tags Has fixed set of tags.
Content driven aimed at data interchange. Format driven aimed at presentation.
Strict on Syntax Lacks syntactical checking
Supports internationalization No internationalization support.
Extensible and reusable Not extensible and reusable.

Name few syntax rules of XML?
The following syntax rules has to be followed when defining a XML document:
First line must be Processing Instruction
There should be one and only one Root Element
Tag names are case-sensitive
No spaces in the tag names. Names can start with _ and followed by letters,digits or hypen.
Every opening tag must have a corresponding closing tag.
Parent and child tags must be properly nested.
Attribute values must be quoted.
Pre-defined entities must be escaped when used in the markup area.
Empty elements cannot have any text in between their tags.

What are typical components of an XML System?
A XML System typically consists of the following:
1. XML Document ( Content )
2. XML Document Type Definition ( DTD )
3. XML Parser ( Conformity Checker )
4. XML Application .

Name elements of an XML Document.
XML Document contains five classes of elements in it they are,
1. ELEMENTS
2. ENTITIES
3. COMMENTS
4. Processing Instructions
5. CDATA Sections

What are Elements?
XML document is made up of elements . Elements are made up of Start-Tag , content and a End Tag.
<mytag> My First XML Tag /mytag>

What are Entities?
Entities are same as the #define statements.
<!ENTITY entityname "some replacement text">

To refer a entity use &entityname;

What are Comments?
Comments are skip instructions.
Comments take the following general form:
<!-- A Comment -->

What is wrong with the below comment?
<!-- I am outer <!-- Iam  Inner -->  I am Outer-->

The String "--" is not allowed to occur within a comment

What are Processing Instructions?
Processing instructions (PIs) allow documents to contain instructions for applications.  PIs are not part of the document's character data. 
PI SYNTAX
<?NameofTargetApp Instructions for App?>

PI examples
<?xml version="1.0"?>
<?xml-stylesheet href="employee.xsl"?>

What are CDATA Sections?
A CDATA section is used in XML to shield a body of text from the attention of the XML processor.
The first occurrence of "]]>" will terminate the CDATA section. CDATA sections cannot be nested.
CDATA SYNTAX
<![CDATA[ …………. ]]>

CDATA Example
<Subject name="HTML">
<Syntax>
<![CDATA[
<HTML>
<HEAD>
<BODY> Hello World
</BODY>
</HEAD>
</HTML>
]]>
</Syntax>
</Subject>

What is a XML Attribute?
XML Attributes are used to specify additional information about the element. An attribute for an element appears within the opening tag.
XML Attribute Syntax
<element attributeName="value">

What is a Prolog?
A Prolog is everything that occurs before the root element starts. A prolog consists of two parts: the XML declaration and the Document Type Declaration (DTD). The prolog is an optional component of the XML document.

What is DTD?
DTD stands for Document Type Declaration. DTD is used to declare elements, entities, attributes and so on.
The Document Type Declaration is a file that contains the necessary rules that the XML document should follow.
DTD specifies the structure of a given XML document. It details the parent - child relationship, allowable attributes and other entities.
A DTD can be declared inline inside an XML document, or as an external reference.

What is an Root Element?
The root element of an XML document is the element that contains all other elements in the document. The root element CAN BE empty(Not a useful XML document).

What are two types of XML Documents?
The two types of XML Documents are:
1. Valid Documents - A valid document must strictly follow the DTD apart from being syntactically correct.
2. Well formed documents - A well formed document need not obey DTD.

What is a XML Parser?
XML Parser is an application that validates and manipulates a XML Document.
There are two kinds of XML Parsers:
1. Validating Parser - Strictly follows the DTD.
2. Non-Validating Parser -  Ignores the DTD.

What are the two types of XML Parsers?
The two types of XML Parsers are :
1. SAX - Simple API for XML
2. DOM - Document Object Model

What is DOM?
The XML DOM defines a standard way for accessing and manipulating XML documents.
The XML DOM is a standard for how to get, change, add, or delete XML elements.

What are the differences between DOM and SAX parsers?
DOM SAX
DOM is object based parser SAX is event based parser
XML doc is parsed stored in the Processes node by node, hence ccupies smaller memory footprint.
memory before processing, hence 
memory intensive
Used for small XML docs High speed processing of very large docs
Nodes can inserted or deleted Nodes can only be read
Traverse in any direction Top to bottom parsing
DOM is slower SAX is faster

Which parser do you prefer to use?
If the XML document is small then DOM can be used. If the XML document is large or the content is object oriented then SAX should be used.

Why is SAX called an event based parser?
SAX will fire an event for every open tag, and every close tag. It also fires events for #PCDATA and CDATA sections. SAX Document Handler class will have to interpret these events. Document Handlers are used to turn your XML document into instances of your custom object model.

What is XSL?
XSL stands for eXtensible Stylesheet Language. XSL describes how the XML document should be displayed. XSL is styling to XML like CSS (Cascading Style Sheets) is to HTML.

XSL consists of three parts:
XSLT - a language for transforming XML documents
XPath - a language for navigating in XML documents
XSL-FO - a language for formatting XML documents

What is XSLT?
XSLT stands for eXtensible Stylesheet Language Transform. XSLT is a language for transforming XML documents into XHTML documents or to other XML documents.

What is XPath?
XPath is a language for navigating in XML documents. XPath is a language for finding information in an XML document. XPath is used to navigate through elements and attributes in an XML document. XQuery and XPointer are both built on XPath expressions.

What is XQuery?
XQuery is the language for querying XML data. XQuery for XML is like SQL for databases. 

What is XLink?
XLink stands for XML Linking Language. XLink is a language for creating hyperlinks in XML documents. Any element in an XML document can behave as an XLink

What is XPointer?
XPointer stands for XML Pointer Language. XPointer allows the hyperlinks to point to specific parts of the XML document. XPointer uses XPath expressions to navigate in the XML document
------------------------------------------------------------------------------------------------
XML Interview Questions  is yet to be uploaded to the site - We welcome comments, error corrections, any left out questions and anything that would value to JGuide.org  readers. Pls send your send your feedback to j2eeguide@...

------------------------------------------------------------------------------------------------



Fri Oct 17, 2008 2:39 pm

j2eeguide
Offline Offline
Send Email Send Email

Forward
Message #3 of 3 | Next >
Expand Messages Author Sort by Date

XML Interview Questions <http://www.jguide.org>  Visit www.JGuide.org <http://www.jguide.org>   for latest java J2EE interview questions ...
j2eeguide
Offline Send Email
Oct 17, 2008
2:39 pm
< Prev Topic  |  Next Topic >
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help