因为项目原因,今天研究了 jdk 1.4 + jaxb 解析xml,运行成功
Java Architecture for XML Binding (JAXB): http://www.oracle.com/technetwork/articles/javase/index-140168.html#xmp3
The Jaxb1.5 demo is base on jdk 1.4.2 + jaxb 1.5 + dtd:
1. install the jaxb 1.5,which download from http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-jwsdp-419428.html#jwsdp-2.0-oth-JPR
2. generate the java classes base on dtd file. All the command are list in jaxbGen.bat (in Jaxb1.5 folder)
3. test client Jaxbdemo
KeyPoint: the dtd description translates into java classes and then we can use these java classes to access the xml file.
jaxbGen.bat
SET JAVA_HOME=D:\DevEnv\jdk\jdk1.4
SET JWSDP_HOME=D:\DevEnv\jwsdp-1.5
SET JAXB_HOME=%JWSDP_HOME%\jaxb
SET JAXB_LIBS=%JAXB_HOME%\lib
SET JAXP_LIBS=%JWSDP_HOME%\jaxp\lib
SET JWSDP_LIBS=%JWSDP_HOME%\jwsdp-shared\lib
SET PATH=%JAXB_HOME%\bin;%JWSDP_HOME%\jwsdp-shared\bin;%PATH%
SET CLASSPATH= %JWSDP_HOME%\jaxb\lib\jaxb-api.jar;%JWSDP_HOME%\jaxb\lib\jaxb-impl.jar;%JWSDP_HOME%\jaxb\lib\jaxb-xjc.jar;%JWSDP_HOME%\jwsdp-shared\lib\activation.jar;%JWSDP_HOME%\sjsxp\lib\jsr173_api.jar;%JWSDP_HOME%\lib\sjsxp.jar;%JWSDP_HOME%\jaxb\lib\dom4j-1.6.jar;
%JAXB_HOME%\bin\xjc.bat -dtd -p com.test quote.dtd -d src
原文链接:https://www.f2er.com/xml/300338.html