[jdom-interest] Problem when reading web.xml
tshitshi kia ntoni
tkiantoni at yahoo.co.uk
Wed Sep 10 02:17:45 PDT 2003
Hi!
I have problem when reading a web.xml (only with web-app_2_3 in the doctype : web-app_2_2 works fine).
Can somebody help me.
Here are web.xml content, some code , and the error message
Thanks
Tshitshi
WEB.XML
========
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<web-app>
<!-- Remove the comments below to define a servlet. -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<!-- <servlet> -->
<!-- <servlet-name>MyServlet</servlet-name> -->
<!-- <servlet-class>examples.MyServlet</servlet-class> -->
<!-- <init-param> -->
<!-- <param-name>myparam</param-name> -->
<!-- <param-value>12345</param-value> -->
<!-- </init-param> -->
<!-- </servlet> -->
<!-- -->
<!-- -->
<!-- <servlet-mapping> -->
<!-- <servlet-name>MyServlet</servlet-name> -->
<!-- <url-pattern>/mine/*</url-pattern> -->
<!-- </servlet-mapping> -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<context-param>
<param-name>monkeyCss</param-name>
<param-value>/WEB-INF/css</param-value>
</context-param>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>tknt.ecole.struts.action.EcoleActionMapping</param-value>
</init-param>
<init-param>
<param-name>dbRelativePath</param-name>
<!-- A AFFINER -->
<param-value>/WEB-INF/classes/tknt/ecole/ecoles.odb</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- WELCOME -->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<!-- ERRORS -->
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<!-- TAGLIBS -->
<taglib>
<taglib-uri>/WEB-INF/taglib/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/taglib/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/taglib/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/taglib/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/taglib/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/taglib/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/taglib/struts-template.tld</taglib-location>
</taglib>
</web-app>
CODE
======
public static void main(String[] args) throws JDOMException, IOException {
WebConfigDocument tc = WebConfigDocument.buildWebDeployDescriptorFromPath(
"C:/Texts/JdoBase/ST_GEN/src/core/config/web/test/web.xml");
XMLOutputter outp = new XMLOutputter();
outp.setIndent(" ");
outp.setNewlines(true);
outp.output(tc.getDeploymentDescriptorDocument(), System.out);
}
.........
public WebConfigDocument() {
deploymentDescriptorDocument = new Document(new Element("web-app"));
deploymentDescriptorDocument.setDocType(
new DocType(
"web-app",
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",
http://java.sun.com/j2ee/dtds/web-app_2_3.dtd));
}
...........
ERROR MESSAGE
===============
org.jdom.input.JDOMParseException: Error on line 1 of document http://java.sun.com/j2ee/dtds/web-app_2_3.dtd: L'entité de paramètre externe "%[dtd];" contient des caractères après le balisage.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:377)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:724)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:703)
at core.config.web.WebConfigDocument.buildWebDeployDescriptor(WebConfigDocument.java:35)
at core.config.web.WebConfigDocument.buildWebDeployDescriptorFromPath(WebConfigDocument.java:98)
at core.config.web.test.WebXmlTest.main(WebXmlTest.java:25)
Caused by: org.xml.sax.SAXParseException: L'entité de paramètre externe "%[dtd];" contient des caractères après le balisage.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Source)
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.jdom.input.SAXBuilder.build(SAXBuilder.java:370)
... 5 more
Caused by: org.xml.sax.SAXParseException: L'entité de paramètre externe "%[dtd];" contient des caractères après le balisage.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Source)
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.jdom.input.SAXBuilder.build(SAXBuilder.java:370)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:724)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:703)
at core.config.web.WebConfigDocument.buildWebDeployDescriptor(WebConfigDocument.java:35)
at core.config.web.WebConfigDocument.buildWebDeployDescriptorFromPath(WebConfigDocument.java:98)
at core.config.web.test.WebXmlTest.main(WebXmlTest.java:25)
Caused by: org.xml.sax.SAXParseException: L'entité de paramètre externe "%[dtd];" contient des caractères après le balisage.
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.fatal(Unknown Source)
at org.apache.crimson.parser.Parser2.externalParameterEntity(Unknown Source)
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.jdom.input.SAXBuilder.build(SAXBuilder.java:370)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:724)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:703)
at core.config.web.WebConfigDocument.buildWebDeployDescriptor(WebConfigDocument.java:35)
at core.config.web.WebConfigDocument.buildWebDeployDescriptorFromPath(WebConfigDocument.java:98)
at core.config.web.test.WebXmlTest.main(WebXmlTest.java:25)
Exception in thread "main"
--------------------------------
Tshitshi KIA NTONI
91A, avenue des combattants
B-1340 Ottignies
GSM : 0495 / 75 48 98
Tel : 010 / 45 44 10
Fax : 010 / 75 20 69
---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030910/83b5202e/attachment.htm
More information about the jdom-interest
mailing list