YouTube Icon

Interview Questions.

XML Interview Questions and Answers - Jul 16, 2022

fluid

XML Interview Questions and Answers

Q1. What is XML ?

Ans: XML (Extended Markup Language) is a metalanguage which lets in customers to outline their own customized markup languages, in particular with the intention to show files at the Internet.

Q2. What are the Differences Between XML and HTML 

Ans:

XML    HTML

User definable tags    Defined set of tags designed for internet show

Content pushed    Format pushed

End tags required for nicely shaped documents    End tags no longer required

Quotes required around attributes values    Quotes not required

Slash required in empty tags    Slash now not required
 

Q3. What is Document Type Definition (DTD)?

Ans: DTD is referred to as Document Type Definition, which gives an outline of a document written in XML. DTD includes XML statement syntax. It additionally defines the naming convention guidelines for exceptional types of detail. If you need to describe the lists which includes some objects then DTD will appear like:

<!ELEMENT List (Item)+> // Element list consists of one or greater gadgets (+)

<!ELEMENT Item (#PCDATA)> // element kinds incorporates simple textual content (Parsed Character Data or PCDATA).

Q4. What is DOM and the way does it relate to XML?

Ans: The Document Object Model (DOM) is an interface specification maintained via the W3C DOM Workgroup that defines an application unbiased mechanism to get admission to, parse, or replace XML statistics. In easy terms it is a hierarchical version that permits developers to govern XML documents without problems Any developer that has labored notably with XML should have the ability to discuss the idea and use of DOM gadgets freely. Additionally, it is not unreasonable to expect superior applicants to thoroughly apprehend its internal workings and be capable of provide an explanation for how DOM differs from an occasion-based totally interface like SAX.

Q5. What are the associated specs of XML?

Ans: XML stands for Extensible Markup language that's designed to transport and keep records. The associated specification of it as follows:

 XML Namespaces: allows clean to shop XML elements and attributes for a document.

XML Base: set the base for resolution of relative URI references. It defines xml:base characteristic.

 XML statistics/infoset: describes an abstract statistics version for XML files.

 XPath: defines a syntax which identifies one or more internal additives (factors, attributes, etc) blanketed in XML record.

 XSLT: is a language with an XML-based totally syntax that is used to convert XML documents into XML or different formats.

 XQuery: lets in easy to use techniques to get entry to, control and go back XML in XML databases.

 XML Signature/Encryption: defines syntax and processing regulations for growing and encrypting digital signatures on XML content material.

Q6. What is SOAP and the way does it relate to XML?

Ans: The Simple Object Access Protocol (SOAP) uses XML to outline a protocol for the alternate of statistics in allotted computing environments. SOAP consists of three components: an envelope, a set of encoding regulations, and a conference for representing far off method calls. Unless revel in with SOAP is an immediate requirement for the open role, knowing the specifics of the protocol, or how it is able to be used in conjunction with HTTP, is not as essential as identifying it as a natural software of XML.

Q7. Describe the function that XSL can play whilst dynamically generating HTML pages from a relational database.

Ans: Even if candidates have never participated in a challenge related to this kind of structure, they should recognize it as one of the commonplace makes use of of XML. Querying a database after which formatting the result set so that it could be tested as an XML record permits builders to translate the records into an HTML desk the use of XSLT rules. Consequently, the format of the ensuing HTML desk can be modified without changing the database query or software code because the file rendering good judgment is remoted to the XSLT guidelines.

Q8. How are documents accessed and manipulated in XML?

Ans: The XML DOM (file object model) is used the get right of entry to and control of xml. It is a platform this is language impartial and lets in a program or a script to dynamically get entry to a report. It also permits the updation of content as well as the shape and style of the record. It is liable for the defining of the object and houses of all xml factors in addition to to define the techniques for his or her get entry to.

There are diverse techniques that may be used in xml dom which include:

1. GetElementsByTagName : Used to call a selected user defined tag.

2. SetAttribute : Used to change the price of an current characteristic.

3. AppendChild : Used to feature a child node to some other node.

HubSpot Video
 

Q9. Give some examples of kinds of programs which can advantage from the use of XML.

Ans: There are literally heaps of programs that could gain from XML technology. The point of this question isn't always to have the candidate rattle off a laundry listing of tasks that they have worked on, but, instead, to permit the candidate to explain the purpose for choosing XML via mentioning a few real world examples. For instance, one appropriate answer is that XML lets in content material management systems to store files independently in their format, which thereby reduces facts redundancy. Another answer pertains to B2B exchanges or deliver chain management systems. In those times, XML provides a mechanism for multiple agencies to exchange records in line with an agreed upon set of regulations. A 0.33 not unusual reaction involves wi-fi applications that require WML to render statistics accessible held gadgets.

Q10. How is metadata treated through xml?

Ans: The xml does no longer comprise any predefined factors. Xml normally in huge phrases is taken into consideration to be an structure and no longer an software. Due to this purpose it is not the responsibility of xml to specify how metadata is to be implemented. It is left as much as the user to choose a way to enforce metadata. Most browsers have their very own manner of specifying a method to address metadata. The xml metadata interchange is used as a fashionable way for users to trade information concerning metadata. The metadata facts is generally stored within the form of attributes.

For Example:

<messages>

<note id="501">

<to>Tove</to>

<from>Jani</from>

<heading>Reminder</heading>

<body>Don't forget about me this weekend!</body>

</note>

<note id="502">

<to>Jani</to>

<from>Tove</from>

<heading>Re: Reminder</heading>

<body>I will not</body>

</note>

</messages>

Q11. What is the use of annotations in connection with an xml record?

Ans: The annotations are used in a xml document to provide additional records approximately the xml report. The annotation element can be observed via a documentation detail to make it understandable to a person (human). In case an annotation detail is followed through an appInfo element then the facts is supposed to be utilized by an software.

Example of an annotation observed with the aid of record detail:

<xsd:element name=”books”>

<xsd:annotation>

<xsd:documentation xml:lang=”en”>

This is a collection of great-selling books.

</xsd:documentation>

</xsd:annotation>

</xsd:element>

Q12. How are white-spaces handled by using xml?

Ans: Any white-area ( this includes line breaks, tab characters and ordinary spaces and so forth.) are handed by the xml parser unchanged to an software. This implies that it isn't always the duty of a parser on the way to interpret a white-space, as an alternative it's far the duty of the software to realize what to do with it. The white-areas in xml can be widely categorized into  types:

1. Insignificant white-area : Those whites-paces which might be located among structural factors and are passed by way of the parser as they are to the utility without any effect ( suppressed) are the insignificant spaces. A proper example of such white-spaces are the areas given in an html file.

2. Significant white-area : Those spaces that occur between the factors and can comprise text and markup blended collectively and are surpassed by the parse precisely the manner they're to the application for his or her dealing with are called the full-size white-areas.

Q13. What are the blessings of the use of Xforms over HTML?

Ans: The Xforms is an software that has been created by the abc. The xforms software enables the separation of presentation and content. It also provides the consumer with elevated form abilities.

The benefits of using the xforms over html paperwork are as follows:

1. The statistics related to the form may be submitted and accrued in the shape of xml.

2. It lets in external xml files to be loaded as preliminary shape statistics.

Three. The xforms aid xpath expressions and also can assist xml schema datatypes.

Four. This software may be integrated with one-of-a-kind net services.

Five. The application of xforms is tool independent.

6. It also supports / gives some greater extra capabilities such as:

- Capability to specify preliminary cost for shape information.

- Switch element for shape of entirety and many others.

Q14. When building an XML DTD, how do you create an outside entity reference in an attribute cost?

Ans: Every interview consultation have to have at the least one trick question. Although feasible when using SGML, XML DTDs don't guide defining outside entity references in attribute values. It's extra critical for the candidate to reply to this query in a logical manner than than the candidate understand the extremely obscure solution.

Q15. How could you build a seek engine for massive volumes of XML data?

Ans: The manner candidates answer this question may additionally offer insight into their view of XML statistics. For folks who view XML broadly speaking as a way to indicate structure for textual content documents, a common solution is to construct a complete-text search and cope with the information in addition to the way Internet portals manage HTML pages. Others recollect XML as a wellknown manner of moving based statistics among disparate systems. These candidates frequently describe a few scheme of uploading XML into a relational or object database and relying on the database's engine for looking. Lastly, applicants which have worked with vendors specializing in this area frequently say that the first-rate way the handle this example is to apply a 3rd celebration software bundle optimized for XML records.

Obviously, a few vital areas of XML technologies had been not included in this listing -- namespaces, XPointer, XLink, and so on -- and ought to be delivered to the interviewer's set of questions if applicable to the particular function that the candidate is applying for. However, these questions in conjunction with others to assess tender talents (conversation abilties, potential to paintings on groups, management capacity, and many others.) will assist decide how nicely candidates understand the fundamental principles of XML.

Q16. When need to I use a CDATA Marked Section?

Ans: CDATA is used to permit an creator to quote fragments of textual content, containing markup characters. CDATA isn't used to preserve embedded markup characters. You use it while you want to design according to your want, like writing documentation and so on. For instance:-

“Text to jot down right here”<![CDATA[<em>markup</em>]]>

Q17. While writing an xml record what are the regulations which are to be followed?

Ans: Since xml does no longer have any predefined tags or elements there are not a whole lot issues in writing an xml file. Although there are a few policies that ought to be saved in thoughts even as writing the file which include:

The tags in xml once opened ought to also need to be closed.

All the tags in xml are case touchy.

All xml factors need to be nicely nested.For Example:<home>

<room>

….

….

</room>

</home>- The whole report should comprise a root node which might include all of the tags described within the document inside it.

- Any characteristic values have to be specific among fees.

Q18. What is the function of the doctype declaration in connection with XML?

Ans: The doctype has several functions in an xml file along with:

1. It is used for validation functions of the report.

2. It helps the browser to inform which version of the markup language was utilized by the writer.

Three. The doctype facilitates in rendering a page properly in a browser this is requirements compliant.The doctypes may be differentiated into 3 primary sorts:strict doctype assertion : This announcement is used while css is getting used to fashion a page.

Transactional doctype assertion : This doctype specification is used if the document includes any presentational markups.

Frames doctype declaration : This is used identification the record is present in shape of frames.

Q19. Can you stroll us thru the stairs essential to parse XML files?

Ans: Superficially, that is a fairly primary query. However, the factor is not to decide whether applicants apprehend the idea of a parser however rather have them stroll through the procedure of parsing XML files step-by using-step. Determining whether or not a non-validating or validating parser is needed, selecting the ideal parser, and managing errors are all essential factors to this process that ought to be covered in the candidate's reaction.

Q20. Give some examples of XML DTDs or schemas which you have labored with.

Ans: Although XML does not require records to be proven against a DTD, among the benefits of the use of the technology are derived from being able to validate XML files against enterprise or technical structure guidelines. Polling for the listing of DTDs that builders have labored with gives perception to their preferred publicity to the generation. The ideal candidate can have expertise of several of the usually used DTDs inclusive of FpML, DocBook, HRML, and RDF, in addition to revel in designing a custom DTD for a selected challenge where no general existed.

Q21. Using XSLT, how could you extract a particular characteristic from an element in an XML document?

Ans: Successful candidates ought to apprehend this as one of the maximum simple applications of XSLT. If they are not capable of assemble a reply similar to the instance underneath, they have to at least be capable of perceive the components essential for this operation: xsl:template to fit the proper XML element, xsl:price-of to choose the characteristic price, and the non-obligatory xsl:apply-templates to preserve processing the file.

Extract Attributes from XML Data

Example 1.

<xsl:template match="element-name"> Attribute Value: <xsl:value-of select="@attribute"/> <xsl:apply-templates/> </xsl:template>

Q22. What are the specific formatting objects in XSL-FO are labeled into?

Ans: The XSL-FO is used to specify how the content of a based xml file can be displayed. The gadgets are organized into the following categories:1. Declaration, pagination & layout : This is used to define the primary format of the web page.

2. Block : When this form of formatting is used it creates paragraphs, block charges and so on.

Three. Inline : On the usage of this formatting technique it would create styles which include itlaics , colorings and unique characters inner a block.

Four. Table : This is used for the creation and controlling of tables.

5. List : This sort of formatting is used to manipulate the lists of all types.

6. Links and multi : They are used to address the style links and multimedia additives.

7. Out-of-line : This formatting create and style the flow areas.

8. Other : This is used as a ctach desirous about all of the objects that dont healthy in everywhere else.

Q23. What are the sorts of nodes in the Xpath facts version? Explain in short.

Ans: There are seven sorts of nodes inside the Xpath records version:

1. Root node : This node is the basis of the xml record and includes all of the elements of the report.

2. Element node : For each element in a record there exists an element node in an effort to in turn contain different elements within it.

Three. Attribute node : Every element node has a fixed of related attribute nodes.

4. Namespace node : Every element has a namespace node associated to it. Similar to attribute nodes the element nodes are parents to the namepsace nodes.

Five. Processing training node : For every processing preparation in a file there exists a SOLARISTM Kernel - Solaris Internals and Performance FAQprocessing commands node.

6. Comment node : For each comment contained in a document there is a comment node unless it's far a part of the dtd.

7. Text node : All person information are stored inside the text nodes. Every textual content node in itself contains as a minimum one man or woman.

Q24. In XML how can the user create code which contains content that would be disregarded through the parser?

Ans: Generally an xml parser would parse via all the text in an XML document. When the parser parses via an xml detail all the textual content between the tags is likewise parsed. The parser has been programmed to accomplish that as a tag may additionally include extra tags internal it. In case the consumer desires to specify any content material that he does not want the parser to parse he can use the belongings of CDATA. Everything that a consumer specifies inside a cdata phase could be unnoticed via the parser.

Q25. Explain the used of the xml prolog segment.

Ans: The xml prolog of a xml document is the start of an xml record. It includes the statistics approximately the xml record and may be used by each the customers and computer systems to realize approximately the file. The prolog to an xml schema ought to include:XML declaration : The xml announcement is used to specify the version of xml used to jot down it and to declare that the document is an xml.For Example:<?Xml version=”1.0” encoding=”UTF-8”?>The xml detail or root statement : It described the basis detail inside which all the other xml factors / tags used are contained. In case of schemas it consists of an xmlns ( xml namespace) attribute that is used to outline the namespace for the schema.For Example:<xsd:schema xmlns: xsd=”http://www.Abc.Org/2001/XMLSchema”>




CFG