statement do?","comment":{"@type":"Comment","text":"The <xsl:value-of> element extracts and outputs the text content of an XML element."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Sets a new XML value","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Deletes the name element","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Applies a CSS style to name","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Selects the text value of the name element","comment":{"@type":"Comment","text":"The <xsl:value-of> element extracts and outputs the text content of an XML element."},"answerExplanation":{"@type":"Comment","text":"The <xsl:value-of> element extracts and outputs the text content of an XML element."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you conditionally apply a transformation in XSLT?","comment":{"@type":"Comment","text":"The <xsl:choose> element allows for conditional transformations in XSLT."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Using JavaScript","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Using CSS styles","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Using <xsl:apply-if>","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Using <xsl:choose>","comment":{"@type":"Comment","text":"The <xsl:choose> element allows for conditional transformations in XSLT."},"answerExplanation":{"@type":"Comment","text":"The <xsl:choose> element allows for conditional transformations in XSLT."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What does the following XSLT code do? <xsl:template match="book"><h2><xsl:value-of select="title"/></h2></xsl:template>","comment":{"@type":"Comment","text":"The template replaces book elements with h2 tags containing the book title."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Deletes book elements","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Replaces book elements with h2","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Ignores book elements","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Outputs the title inside an h2 tag","comment":{"@type":"Comment","text":"The template replaces book elements with h2 tags containing the book title."},"answerExplanation":{"@type":"Comment","text":"The template replaces book elements with h2 tags containing the book title."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why does an XSLT transformation fail when applied to an XML document?","comment":{"@type":"Comment","text":"XSLT transformations require the XML document to be well-formed to process correctly."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The XML document is missing a DTD","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"The XML document contains an inline schema","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The XSLT file is too large","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The XML document is not well-formed","comment":{"@type":"Comment","text":"XSLT transformations require the XML document to be well-formed to process correctly."},"answerExplanation":{"@type":"Comment","text":"XSLT transformations require the XML document to be well-formed to process correctly."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"An XSLT transformation does not apply to some XML elements. What is the most likely cause?","comment":{"@type":"Comment","text":"XSLT only applies transformations to elements with explicitly defined templates."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"XSLT does not support transformation","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"The XML file is encrypted","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"XSLT is case-insensitive","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The elements do not have matching templates","comment":{"@type":"Comment","text":"XSLT only applies transformations to elements with explicitly defined templates."},"answerExplanation":{"@type":"Comment","text":"XSLT only applies transformations to elements with explicitly defined templates."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why would the following XSLT code not work? <xsl:template match="title"><p><xsl:value-of select="." /></p></xsl:template>","comment":{"@type":"Comment","text":"If title is not directly under the root, it must be matched using //title."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"title is not a valid XML element","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"title is an attribute, not an element","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"XSLT does not support text nodes","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The template should match //title instead","comment":{"@type":"Comment","text":"If title is not directly under the root, it must be matched using //title."},"answerExplanation":{"@type":"Comment","text":"If title is not directly under the root, it must be matched using //title."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is XML parsing?","comment":{"@type":"Comment","text":"XML parsing is the process of reading and analyzing an XML document to extract information."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Converting XML to binary","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Encrypting XML files","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Compressing XML documents","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Processing XML to extract data","comment":{"@type":"Comment","text":"XML parsing is the process of reading and analyzing an XML document to extract information."},"answerExplanation":{"@type":"Comment","text":"XML parsing is the process of reading and analyzing an XML document to extract information."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which of the following is a characteristic of DOM parsing?","comment":{"@type":"Comment","text":"DOM parsing loads the entire XML document into memory, making it easier to manipulate but more memory-intensive."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Processes XML sequentially","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Cannot modify XML","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Uses event-based processing","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Loads the entire XML document into memory","comment":{"@type":"Comment","text":"DOM parsing loads the entire XML document into memory, making it easier to manipulate but more memory-intensive."},"answerExplanation":{"@type":"Comment","text":"DOM parsing loads the entire XML document into memory, making it easier to manipulate but more memory-intensive."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is an advantage of SAX parsing over DOM parsing?","comment":{"@type":"Comment","text":"SAX parsing processes XML elements one by one without loading the entire document into memory."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"SAX parsing allows direct modification of XML","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"SAX is faster for small files","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"SAX loads the entire XML document into memory","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"SAX is event-driven and uses less memory","comment":{"@type":"Comment","text":"SAX parsing processes XML elements one by one without loading the entire document into memory."},"answerExplanation":{"@type":"Comment","text":"SAX parsing processes XML elements one by one without loading the entire document into memory."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"When should SAX parsing be preferred over DOM?","comment":{"@type":"Comment","text":"SAX parsing is preferred for large XML files since it does not load the entire document into memory."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"When XML needs frequent modifications","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"When searching for a specific node","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"When working with small XML files","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"When memory consumption is a concern","comment":{"@type":"Comment","text":"SAX parsing is preferred for large XML files since it does not load the entire document into memory."},"answerExplanation":{"@type":"Comment","text":"SAX parsing is preferred for large XML files since it does not load the entire document into memory."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is a drawback of SAX parsing?","comment":{"@type":"Comment","text":"SAX parsing is read-only and does not allow direct modification of XML data."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"It is slower than DOM","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"It does not support event handling","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"It requires loading the entire document into memory","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"It cannot modify XML while parsing","comment":{"@type":"Comment","text":"SAX parsing is read-only and does not allow direct modification of XML data."},"answerExplanation":{"@type":"Comment","text":"SAX parsing is read-only and does not allow direct modification of XML data."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which of the following correctly initializes an XML parser in Python using DOM?","comment":{"@type":"Comment","text":"The xml.dom.parse() method is used to load an XML file using the DOM parser in Python."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"xml.sax.parse(\"file.xml\")","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"xml.etree.ElementTree(\"file.xml\")","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"xml.parser.load(\"file.xml\")","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"xml.dom.parse(\"file.xml\")","comment":{"@type":"Comment","text":"The xml.dom.parse() method is used to load an XML file using the DOM parser in Python."},"answerExplanation":{"@type":"Comment","text":"The xml.dom.parse() method is used to load an XML file using the DOM parser in Python."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"In Java, which class is used to parse an XML file using DOM?","comment":{"@type":"Comment","text":"The DocumentBuilderFactory class is used to parse XML documents using DOM in Java."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"SAXParserFactory","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"JsonParser","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"XMLReader","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"DocumentBuilderFactory","comment":{"@type":"Comment","text":"The DocumentBuilderFactory class is used to parse XML documents using DOM in Java."},"answerExplanation":{"@type":"Comment","text":"The DocumentBuilderFactory class is used to parse XML documents using DOM in Java."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which of the following methods is used to register a handler in SAX parsing?","comment":{"@type":"Comment","text":"The setContentHandler() method is used in SAX parsing to register an event handler."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"setHandler()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"registerHandler()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"setXMLHandler()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"setContentHandler()","comment":{"@type":"Comment","text":"The setContentHandler() method is used in SAX parsing to register an event handler."},"answerExplanation":{"@type":"Comment","text":"The setContentHandler() method is used in SAX parsing to register an event handler."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the output of the following Java SAX parser snippet? startElement(\"bookstore\", \"book\", \"book\", attributes)","comment":{"@type":"Comment","text":"In SAX parsing, the startElement method is triggered when a new XML element begins."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The start of the XML document","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"The end of the XML document","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The end of a book element","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The start of a book element","comment":{"@type":"Comment","text":"In SAX parsing, the startElement method is triggered when a new XML element begins."},"answerExplanation":{"@type":"Comment","text":"In SAX parsing, the startElement method is triggered when a new XML element begins."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why does a DOM parser consume more memory than SAX?","comment":{"@type":"Comment","text":"DOM loads the full XML document into memory for easier traversal, making it more memory-intensive."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"It processes XML line by line","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"It cannot handle large XML files","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"It requires a network connection","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"It loads the entire XML file into memory","comment":{"@type":"Comment","text":"DOM loads the full XML document into memory for easier traversal, making it more memory-intensive."},"answerExplanation":{"@type":"Comment","text":"DOM loads the full XML document into memory for easier traversal, making it more memory-intensive."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"A SAX parser throws an error while processing an XML file. What is the likely cause?","comment":{"@type":"Comment","text":"SAX parsers process XML sequentially and require the XML document to be well-formed."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The XML file is too small","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"SAX does not support XML parsing","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The XML document is missing comments","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The XML file has an invalid structure","comment":{"@type":"Comment","text":"SAX parsers process XML sequentially and require the XML document to be well-formed."},"answerExplanation":{"@type":"Comment","text":"SAX parsers process XML sequentially and require the XML document to be well-formed."}}}]}
Master XML with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Extensible Markup Language (XML) concepts. Begin your placement preparation journey now!
Q61
Q61 Which XPath expression retrieves all title elements inside bookstore?
A
bookstore/title
B
/bookstore/title
C
//bookstore/title
D
bookstore//title
Q62
Q62 Which XPath expression selects the price element of the second book in bookstore?
A
/bookstore/book[2]/price
B
//book[2]/price
C
/bookstore//price[2]
D
//bookstore/price[2]
Q63
Q63 What does the following XPath expression return: //book[last()]?
A
The first book element
B
The last book element
C
All book elements
D
The parent of all book elements
Q64
Q64 Which XPath expression selects all book elements that have a price greater than 30?
A
//book[price>30]
B
//book[@price>30]
C
//book[price>="30"]
D
//book[price>'30']
Q65
Q65 Why does the following XPath expression cause an error? /library/book[@id=001]
A
@id must be enclosed in quotes
B
XPath does not support attributes
C
The path should start with //
D
The id attribute must be numeric
Q66
Q66 An XPath query /bookstore/book/title returns an empty result. What is the likely cause?
A
The XML document does not contain books
B
The XPath query is incorrect
C
The XML structure does not match the query
D
The XPath query should use // instead of /
Q67
Q67 An XPath query //book[3]/title does not return a result, even though books exist. What is the problem?
A
The XML document has fewer than three books
B
The title elements are missing
C
The XPath query syntax is incorrect
D
The index should be 2 instead of 3
Q68
Q68 What is the purpose of XSLT?
A
To query XML data
B
To transform XML documents into other formats
C
To validate XML documents
D
To encrypt XML data
Q69
Q69 Which of the following best describes XSLT?
A
It is a scripting language
B
It is a declarative transformation language
C
It is a subset of Java
D
It is used to style XML
Q70
Q70 How does XSLT process an XML document?
A
Sequentially, like a script
B
Using pattern matching and templates
C
By compiling XML into binary
D
By executing JavaScript
Q71
Q71 What is an XSLT template?
A
A function that modifies XML
B
A set of rules applied to elements
C
A script that runs on the server
D
A schema for XML validation
Q72
Q72 Which of the following XSLT elements is used to iterate over XML nodes?
A
<xsl:apply-templates>
B
<xsl:for-each>
C
<xsl:if>
D
<xsl:choose>
Q73
Q73 Which XSLT element is used to apply a transformation rule?
A
<xsl:apply-templates>
B
<xsl:value-of>
C
<xsl:transform>
D
<xsl:attribute>
Q74
Q74 What does the <xsl:value-of select="name"/> statement do?
A
Sets a new XML value
B
Selects the text value of the name element
C
Deletes the name element
D
Applies a CSS style to name
Q75
Q75 How do you conditionally apply a transformation in XSLT?
A
Using <xsl:choose>
B
Using JavaScript
C
Using CSS styles
D
Using <xsl:apply-if>
Q76
Q76 What does the following XSLT code do? <xsl:template match="book"><h2><xsl:value-of select="title"/></h2></xsl:template>
A
Deletes book elements
B
Replaces book elements with h2
C
Outputs the title inside an h2 tag
D
Ignores book elements
Q77
Q77 Why does an XSLT transformation fail when applied to an XML document?
A
The XML document is missing a DTD
B
The XML document is not well-formed
C
The XML document contains an inline schema
D
The XSLT file is too large
Q78
Q78 An XSLT transformation does not apply to some XML elements. What is the most likely cause?
A
The elements do not have matching templates
B
XSLT does not support transformation
C
The XML file is encrypted
D
XSLT is case-insensitive
Q79
Q79 Why would the following XSLT code not work? <xsl:template match="title"><p><xsl:value-of select="." /></p></xsl:template>
A
title is not a valid XML element
B
The template should match //title instead
C
title is an attribute, not an element
D
XSLT does not support text nodes
Q80
Q80 What is XML parsing?
A
Converting XML to binary
B
Processing XML to extract data
C
Encrypting XML files
D
Compressing XML documents
Q81
Q81 Which of the following is a characteristic of DOM parsing?
A
Processes XML sequentially
B
Loads the entire XML document into memory
C
Cannot modify XML
D
Uses event-based processing
Q82
Q82 What is an advantage of SAX parsing over DOM parsing?
A
SAX parsing allows direct modification of XML
B
SAX is event-driven and uses less memory
C
SAX is faster for small files
D
SAX loads the entire XML document into memory
Q83
Q83 When should SAX parsing be preferred over DOM?
A
When memory consumption is a concern
B
When XML needs frequent modifications
C
When searching for a specific node
D
When working with small XML files
Q84
Q84 What is a drawback of SAX parsing?
A
It is slower than DOM
B
It does not support event handling
C
It cannot modify XML while parsing
D
It requires loading the entire document into memory
Q85
Q85 Which of the following correctly initializes an XML parser in Python using DOM?
A
xml.dom.parse("file.xml")
B
xml.sax.parse("file.xml")
C
xml.etree.ElementTree("file.xml")
D
xml.parser.load("file.xml")
Q86
Q86 In Java, which class is used to parse an XML file using DOM?
A
SAXParserFactory
B
DocumentBuilderFactory
C
JsonParser
D
XMLReader
Q87
Q87 Which of the following methods is used to register a handler in SAX parsing?
A
setHandler()
B
registerHandler()
C
setContentHandler()
D
setXMLHandler()
Q88
Q88 What is the output of the following Java SAX parser snippet? startElement("bookstore", "book", "book", attributes)
A
The start of the XML document
B
The start of a book element
C
The end of the XML document
D
The end of a book element
Q89
Q89 Why does a DOM parser consume more memory than SAX?
A
It processes XML line by line
B
It loads the entire XML file into memory
C
It cannot handle large XML files
D
It requires a network connection
Q90
Q90 A SAX parser throws an error while processing an XML file. What is the likely cause?