When a XML file has a DTD declared which is not accessible to the parser, what would happen? - Honey Vig
1)the document is not parsed.
2)Everything should be fine. DTD is used for validation parsing doesn't require DTD or schema.
3)The Parser will not be able to parse the XML file without the DTD and will throw a file not found exception.
4)Sloth_II is correct - although of course it depends on the parser being non-validating or configurable as such.
5)DTD is optional
6)DTD is must. if the file is not found at location specified you will get following error
java.io.FileNotFoundException: ....AddrBook.dtd (The system cannot find
the file specified)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Sou
rce)
at org.apache.crimson.parser.Parser2.maybeDoctypeDecl(Unknown Source)
at org.apache.crimson.parser.Parser2.parseInternal(Unknown Source)
at org.apache.crimson.parser.Parser2.parse(Unknown Source)
at org.apache.crimson.parser.XMLReaderImpl.parse(Unknown Source)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at XMLInfo.main(XMLInfo.java:18)
No comments:
Post a Comment