i want answers for the questions i have posted please help me in this i want this questions formy interview
1) class>
<attributes>
<attr type='static' name='max num' default=0>
<attr type='inst' name='num = 0'\>
</attributes>
<methods>
<meth type='macro' code='x < y & y > z'\>
<meth name='getMax'>
<!CDATA[[
if (num > max num) then max num = num
]]>
</meth>
</methods>
</class>
Referring to the XML data above, how many well-formedness errors does a JAXP processor find?
a) Zero
b) Two
c) Three
d) Five
e) Six
2) What type of data can a SAX parser process?
a) RTF
b) HTML
c) XML
d) Arbitrary plain text
e) SGML
3) <message>
Good
<highlight>
day
</highlight>
earthling.
</message>
org.w3c.dom.Node message = rootnode.getFirstChild();
org.w3c.dom.Node earthling = message.getLastChild();
while (earthling != null)
{
System.out.println(earthling.getNodeValue());
earthling = earthling.getPreviousSibling();
}
Referring to the XML data and DOM code above, where rootnode is a org.w3c.dom.Document object, how many times is the print statement in the while loop executed?
Q4). public class SaxHandler extends org.xml.sax.helpers.DefaultHandler
{
private org.xml.sax.Locator locator;
public void setDocumentLocator(org.xml.sax.Locator locator)
{
this.locator = locator;
}
public void error(org.xml.sax.SAXParseException exception)
{
// Print the source of the error
}
}
Referring to the sample code above, if using a SAX parser, what code do you use in the error method to display the filename, line number, and column number of an error? (sanjay)
a) System.out.println(locator.getPublicId() + ": " +
locator.getLineNumber() + ", " + locator.getColumnNumber());
b) System.out.println(exception.getCause() + ": " +
locator.getLineNumber() + ", " + locator.getColumnNumber());
c) System.out.println(exception.getSystemId() + ": " +
exception.getLineNumber() + ", " + exception.getColumnNumber());
d) org.xml.sax.Locator source = new LocatorImpl();
System.out.println(source.getSystemId() + ": " +
source.getLineNumber() + ", " + source.getColumnNumber());
e) It is not possible to find the name of the file with either the locator or exception variables.