<-Pre | Home | Next-> |
Can you give few examples for Markup Languages?
SGML, HTML, XML, WML and MathML are few examples of Markup Langauges.
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 SyntaxpreLacks 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 eg:
<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).State some disadvantages of XML?
These are some of the disadvantages of XML
1.XML syntax is large when compared to binary representations and is redundant.
2.Due to redundancy it occupies much higher memory and this increases costs on transmission, storage and processing costs.
3.Overlapping relationships require extra effort.
4.XML namespaces are problematic and namespace support can be difficult to implement in XML.
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 is DOM and how does it relate to XML?
The Document Object Model (DOM) is an interface specification maintained by the W3C DOM Workgroup that defines an application independent mechanism to access, parse, or
update XML data. In simple terms it is a hierarchical model that allows developers to manipulate XML documents easily Any developer that has worked extensively with XML should be able to discuss the concept and use of DOM objects freely.Additionally, it is not unreasonable to expect advanced candidates to thoroughly understand its internal workings and be able to explain how DOM differs from an event-based interface like SAX.
What is SOAP and how does it relate to XML?
The Simple Object AccessProtocol (SOAP) uses XML to define a protocol for the exchange of information in distributed computing environments. SOAP consists of three components: an envelope, a set of encoding rules, and aconvention for representing remote procedure calls. Unless experience with SOAP is a direct requirement for the open position, knowing the specifics of the protocol, or how it can be used in conjunction with HTTP, is not as important as identifying it as a natural application of XML.
What are the differences between DOM and SAX parsers?
DOM ||SAX
DOM is object based parser. || SAX is event based parser.
Stores the entire XML document into memory before processing ||Parses node by node
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.
Explain about XML data binding?
XML data binding allows the user to access the information in XML format rather than in the format of DOM. Data is referred and stored in the computer memory as an object in the form of an XML document. Some information requires different approach to store it in the format of an object. As the data contains links it is always not easy to preserve the data in the form of an object.
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
How do you display XML with XSLT?
XSLT is the recommended style sheet for XML and it is very popular. To display XML with XSLT one has to convert XML into HTML before displaying it in the browser. Different browsers interpret XSLT in different ways which makes it a necessary to amend changes to XSLT on the server.
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.
Pre->XML 1 | Next->Hibernate |
*****Please feel free to give feedback at shrawan.iitg@gmail.com and comment below *****
No comments:
Post a Comment