Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » The content of element type "*" must match(Doesn't like my elements)
icon5.gif  The content of element type "*" must match [message #667906] Mon, 02 May 2011 17:51 Go to next message
Andy  is currently offline Andy Friend
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 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
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
Re: The content of element type "*" must match [message #677604 is a reply to message #668226] Wed, 08 June 2011 22:50 Go to previous message
Andy  is currently offline Andy Friend
Messages: 16
Registered: May 2011
Junior Member
Thank you Eric. I think I solved this issue by matching the order of the elements with the error message.
Previous Topic:Checking Out Project
Next Topic:download.eclipse.org not reachable
Goto Forum:
  


Current Time: Sat Apr 27 04:13:11 GMT 2024

Powered by FUDForum. Page generated in 0.08962 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top