Is a Java SAS parser actually extracting DTDs from the Internet?

With an XML file declaring DOCTYPE, take the struts.xml file, for example:

Is dtd-based Java SAX processing from the provided URL?

+6
source share
3 answers

Many (most) implementations will be, albeit technically, if I remember correctly, this place should be interpreted as a URI, not a URL.

If you want to make sure that you enable it locally, check out the EntityResolver interface.

+4
source

Based on the Xerces documentation, the parser may try to download the file from the Internet when checking for. But I really think that this can change from parser to parser, because the library may decide to use a local cache, proxy server or something else.

+3
source

You can modify struts.xml to load a DTD file from the core of struts2 kernel from the class path, rather than downloading it from the Internet

FROM

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> 

EDIT

 <!DOCTYPE struts SYSTEM "struts-2.0.dtd"> 

now the sax parser downloaded the struts-2.0.dtd file from the / src folder where I placed it.

Also this is my modified hibernation configuration file, which worked a little differently. He downloaded the dtd file directly from the JAR, he did not have to physically put it in the src folder

 <!DOCTYPE hibernate-configuration SYSTEM "classpath://org/hibernate/hibernate-configuration-3.0.dtd"> 
0
source

All Articles