W
WorldCreater
Unregistered / Unconfirmed
GUEST, unregistred user!
第一个问题:
private staticdo
cumentdo
c = null;
public static void prepareDoc(String fileName) {
try{
//create the JDOM SAXBuilder
SAXBuilder saxBuilder = new SAXBuilder (true);
//prepare the JDOM tree
do
c = saxBuilder.build (new File(fileName));
} catch (JDOMException e) {
System.out.println ("JDOMException: " + e.getMessage());
} catch (IOException e) {
System.out.println ("IOException: " + e.getMessage());
} catch (Exception e) {
System.out.println ("Exception: " + e.getMessage());
}
}
SAXBuilder 强制要求要有dtd吗?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CONFIGURATIONS SYSTEM "./CONFIG.dtd"><!-----要是没有这句,就会有错误---->
<CONFIGURATIONS>
<CONFIG>
<DRIVERNAME>com.microsoft.jdbc.sqlserver.SQLServerDriver</DRIVERNAME>
</CONFIG>
</CONFIGURATIONS>
=============================================================================
JDOMException: Error on line 3 ofdo
cument file:/e:/xxx/config.xml:do
cument is
invalid: no grammar found.
Exception in thread "main" java.lang.NullPointerException
at com.bcstnet.enterprise.beans.XmlSetting.forTest(XmlSetting.java:44)
at com.bcstnet.enterprise.beans.XmlSetting.main(XmlSetting.java:24)
private staticdo
cumentdo
c = null;
public static void prepareDoc(String fileName) {
try{
//create the JDOM SAXBuilder
SAXBuilder saxBuilder = new SAXBuilder (true);
//prepare the JDOM tree
do
c = saxBuilder.build (new File(fileName));
} catch (JDOMException e) {
System.out.println ("JDOMException: " + e.getMessage());
} catch (IOException e) {
System.out.println ("IOException: " + e.getMessage());
} catch (Exception e) {
System.out.println ("Exception: " + e.getMessage());
}
}
SAXBuilder 强制要求要有dtd吗?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE CONFIGURATIONS SYSTEM "./CONFIG.dtd"><!-----要是没有这句,就会有错误---->
<CONFIGURATIONS>
<CONFIG>
<DRIVERNAME>com.microsoft.jdbc.sqlserver.SQLServerDriver</DRIVERNAME>
</CONFIG>
</CONFIGURATIONS>
=============================================================================
JDOMException: Error on line 3 ofdo
cument file:/e:/xxx/config.xml:do
cument is
invalid: no grammar found.
Exception in thread "main" java.lang.NullPointerException
at com.bcstnet.enterprise.beans.XmlSetting.forTest(XmlSetting.java:44)
at com.bcstnet.enterprise.beans.XmlSetting.main(XmlSetting.java:24)