Reputation: 5624
In Eclipse I got the error Invalid content was found starting with element 'description'. No child element is expected at this point.
.
The warning was from my web.xml
at this location:
<init-param>
<param-name>email</param-name>
<param-value>[email protected]</param-value>
<description>Some description.</description>
</init-param>
I had a similar error for the display-name
in the same file at this location:
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>
org.apache.axis.transport.http.AxisServlet
</servlet-class>
</servlet>
Some googling led me to this answer which says that the description
element must come first.
Following that advice worked for both my cases and my errors went away. The link to the source of the information in the answer above is broken and I am unable to find this information in the official documentation.
Why is this a requirement in the specification and where can I read more about it?
Upvotes: 0
Views: 298
Reputation: 1457
You can go through the xsd. www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-common_3_1.xsd
Let me share the approach I use to read it. Staring from the XSD referred in a web.xml.
<xsd:include schemaLocation="web-common_3_1.xsd"/>
<xsd:element name="init-param" type="javaee:param-valueType" minOccurs="0" maxOccurs="unbounded">
indicates that initi-param is of type 'javaee:param-valueType'
. Also here find <xsd:include schemaLocation="javaee_7.xsd"/>
In the javaee_7.xsd
, sSee the definition for the element 'param-valueType'
<xsd:complexType name="param-valueType">
<xsd:annotation>
<xsd:documentation>...</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="description" type="javaee:descriptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="param-name" type="javaee:string">
<xsd:annotation>
<xsd:documentation>
The param-name element contains the name of a parameter.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="param-value" type="javaee:xsdStringType">
<xsd:annotation>
<xsd:documentation>
The param-value element contains the value of a parameter.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="id" type="xsd:ID"/>
</xsd:complexType>
Upvotes: 1