Menu

MockStrutsTestCase web.xml parse error

2009-03-26
2013-04-25
  • bob macaluso

    bob macaluso - 2009-03-26

    Hi All,
      Trying to implement MockStrutsTestCase inside Eclipse but cannot get past paring error listed below.

    Any ideas?

    1. Script Segment
    public class TestLoginAction extends MockStrutsTestCase {
    public void testSuccessfulLogin() {
               setServletConfigFile("//C:/OpenSource/workspaces/strutsproject1/RJMCorp/webcontent/WEB-INF/web.xml");

    2. The error
    SEVERE: Parse Error at line 5 column 15: Document root element "web-app", must match DOCTYPE root "null".
    org.xml.sax.SAXParseException: Document root element "web-app", must match DOCTYPE root "null".

    3. my 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">

     
    • Carl Ballantyne

      Carl Ballantyne - 2009-04-22

      I get this as well but MockStrutsTestCase seems to truck on and parses the rest of the web.xml file. I guess because the elements I have are the same as they would be in a 2.3 web.xml file. So you might be able to just ingore this like I am.

      This seems to be because in 2.4 they changed to schemas. MockStrutsTestCase looks for the 2.3 dtd which is packaged with Struts. But if Struts don´t package the 2.4 xsd the StrutsTestCase can´t reference it to use when parsing so just uses the latest .... 2.3. I don´t know enough about the process so there could be a whole different process involved when parsing using a schema versus a dtd.

       

Log in to post a comment.