Home » Newcomers » Newcomers » The content of element type "*" must match(Doesn't like my elements)
The content of element type "*" must match [message #667906] |
Mon, 02 May 2011 17:51 |
Andy Messages: 16 Registered: May 2011 |
Junior Member |
|
|
I am new to Eclipse. Using Version: Helios Service Release 2 Build id: 20110218-0911.
I am learning on the Orion Primer tutorial at http://www.orionserver.com/tutorials/orion-primer/;jsessionid=PKIBIKHHMLCB#main-step2
I have connected the debugger to the Orion Server and the application runs as advertised. But the Eclipse debugger throws errors about my web.xml files. The error is: "The content of element type "web-app" must match " (icon?,display-name?,description?,distributable?,context-par am*,servlet*,servlet-mapping*,session-config?,mime-mapping*, welcome-file-list?,error-page*,taglib*,resource-ref*,securit y-constraint*,login-config?,security-role*,env-entry*,ejb-re f*) ". web.xml /hello-planet/build/hello-planet/hello-planet-web/WEB-INF line 4 XML Problem"
Obviously Eclipse doesn't like the content of my web.xml file but I cannot see anything wrong with it.
Here is a my web.xml file:
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>Orion Primer Web Application</display-name>
<servlet>
<servlet-name>hello.web.HelloServlet</servlet-name>
<description>Servlet that calls the Hello bean</description>
<servlet-class>hello.web.HelloServlet</servlet-class>
</servlet>
<ejb-ref>
<ejb-ref-name>ejb/HelloHome</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>hello.ejb.HelloHome</home>
<remote>hello.ejb.Hello</remote>
</ejb-ref>
<servlet-mapping>
<servlet-name>hello.web.HelloServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
I could sure use a hint!
Thanks!
|
|
|
Re: The content of element type "*" must match [message #668226 is a reply to message #667906] |
Wed, 04 May 2011 15:12 |
Eric Rizzo Messages: 3070 Registered: July 2009 |
Senior Member |
|
|
On 5/2/11 1:51 PM, Andy wrote:
> I am new to Eclipse. Using Version: Helios Service Release 2 Build id:
> 20110218-0911.
>
> I am learning on the Orion Primer tutorial at
> http://www.orionserver.com/tutorials/orion-primer/;jsessionid=PKIBIKHHMLCB#main-step2
>
>
> I have connected the debugger to the Orion Server and the application
> runs as advertised. But the Eclipse debugger throws errors about my
> web.xml files. The error is: "The content of element type "web-app" must
> match " (icon?,display-name?,description?,distributable?,context-par
> am*,servlet*,servlet-mapping*,session-config?,mime-mapping*,
> welcome-file-list?,error-page*,taglib*,resource-ref*,securit
> y-constraint*,login-config?,security-role*,env-entry*,ejb-re f*) ".
> web.xml /hello-planet/build/hello-planet/hello-planet-web/WEB-INF line 4
> XML Problem"
>
> Obviously Eclipse doesn't like the content of my web.xml file but I
> cannot see anything wrong with it.
> Here is a my web.xml file:
>
> <?xml version="1.0"?>
> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
> 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
>
> <web-app>
> <display-name>Orion Primer Web Application</display-name>
> <servlet>
> <servlet-name>hello.web.HelloServlet</servlet-name>
> <description>Servlet that calls the Hello bean</description>
> <servlet-class>hello.web.HelloServlet</servlet-class>
> </servlet>
>
> <ejb-ref>
> <ejb-ref-name>ejb/HelloHome</ejb-ref-name>
> <ejb-ref-type>Session</ejb-ref-type>
> <home>hello.ejb.HelloHome</home>
> <remote>hello.ejb.Hello</remote>
> </ejb-ref>
>
> <servlet-mapping>
> <servlet-name>hello.web.HelloServlet</servlet-name>
> <url-pattern>/</url-pattern>
> </servlet-mapping>
> </web-app>
Eclipse's XML editor is quite strict (unless you turn off some of the
validation options); apparently Orion's XML parsing is more lenient.
The web-app_2_2.dtd says that the <web-app> element has child elements
in a specific order. In your case, you have <servlet-mapping> after
<ejb-ref> which appears to violate the DTD. Move your <ejb-ref> element
below <servlet-mapping> and it should be OK.
By the way, I'm basing my analysis on the error message alone
(Specifically, what does
" (icon?,display-name?,description?,distributable?,context-par
am*,servlet*,servlet-mapping*,session-config?,mime-mapping*,
welcome-file-list?,error-page*,taglib*,resource-ref*,securit
y-constraint*,login-config?,security-role*,env-entry*,ejb-re f*) " mean);
you might want to take some time to learn DTD so that you can figure out
what the Eclipse warnings/error messages are telling you.
Eric
|
|
| |
Goto Forum:
Current Time: Sat Apr 27 04:13:11 GMT 2024
Powered by FUDForum. Page generated in 0.08962 seconds
|