0 Replies Latest reply on Dec 12, 2005 7:52 AM by Michael Wiles

    parsing web.xml fails, looking for doctype

    Michael Wiles Newbie

      I'm trying to run the eclipse+lomboz+jboss servlet tutorial...

      on jboss 3.2.3... and lomboz 3.1 (wtp 0.7)

      This is my generated web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      
       <!--
       To use non XDoclet filters, create a filters.xml file that
       contains the additional filters (eg Sitemesh) and place it in your
       project's merge dir. Don't include filter-mappings in this file,
       include them in a file called filter-mappings.xml and put that in
       the same directory.
       -->
      
       <!--
       To use non XDoclet filter-mappings, create a filter-mappings.xml file that
       contains the additional filter-mappings and place it in your
       project's merge dir.
       -->
      
       <!--
       To use non XDoclet listeners, create a listeners.xml file that
       contains the additional listeners and place it in your
       project's merge dir.
       -->
      
       <servlet>
       <display-name>Process</display-name>
       <servlet-name>Process</servlet-name>
       <servlet-class>za.co.bbd.web.test.Process</servlet-class>
      
       </servlet>
      
       <!--
       To use non XDoclet servlets, create a servlets.xml file that
       contains the additional servlets (eg Struts) and place it in your
       project's merge dir. Don't include servlet-mappings in this file,
       include them in a file called servlet-mappings.xml and put that in
       the same directory.
       -->
      
       <servlet-mapping>
       <servlet-name>Process</servlet-name>
       <url-pattern>/process</url-pattern>
       </servlet-mapping>
      
       <!--
       To specify mime mappings, create a file named mime-mappings.xml, put it in your project's mergedir.
       Organize mime-mappings.xml following this DTD slice:
      
       <!ELEMENT mime-mapping (extension, mime-type)>
       -->
      
       <!--
       To specify error pages, create a file named error-pages.xml, put it in your project's mergedir.
       Organize error-pages.xml following this DTD slice:
      
       <!ELEMENT error-page ((error-code | exception-type), location)>
       -->
      
       <!--
       To add taglibs by xml, create a file called taglibs.xml and place it
       in your merge dir.
       -->
      
       <!--
       To set up security settings for your web app, create a file named web-security.xml, put it in your project's mergedir.
       Organize web-security.xml following this DTD slice:
      
       <!ELEMENT security-constraint (display-name?, web-resource-collection+, auth-constraint?, user-data-constraint?)>
       <!ELEMENT web-resource-collection (web-resource-name, description?, url-pattern*, http-method*)>
       <!ELEMENT web-resource-name (#PCDATA)>
       <!ELEMENT url-pattern (#PCDATA)>
       <!ELEMENT http-method (#PCDATA)>
       <!ELEMENT user-data-constraint (description?, transport-guarantee)>
       <!ELEMENT transport-guarantee (#PCDATA)>
      
       <!ELEMENT login-config (auth-method?, realm-name?, form-login-config?)>
       <!ELEMENT auth-method (#PCDATA)>
       <!ELEMENT realm-name (#PCDATA)>
       <!ELEMENT form-login-config (form-login-page, form-error-page)>
       <!ELEMENT form-login-page (#PCDATA)>
       <!ELEMENT form-error-page (#PCDATA)>
       -->
      
      </web-app>
      


      However, when I deploy the web app it gives me a parse error:
      14:31:02,589 ERROR [Digester] Parse Error at line 3 column 220: Document root element "web-app", must match DOCTYPE root "null".
      org.xml.sax.SAXParseException: Document root element "web-app", must match DOCTYPE root "null".
      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
      at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:362)
      at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:296)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:2546)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:2850)


      The doctype is specified in the web-app node as a value, it looks like the xerces parser is still expecting it in xml file.

      I think I need to fix the parser so that it does not require a doc type?