[jboss-jira] [JBoss JIRA] Commented: (JBAS-4916) Invalid content was found starting with element 'env-entry'

Alexey Loubyansky (JIRA) jira-events at lists.jboss.org
Mon Oct 29 10:14:01 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBAS-4916?page=comments#action_12384834 ] 
            
Alexey Loubyansky commented on JBAS-4916:
-----------------------------------------

This is thrown by Xerces. It's validation against the XSD. I tried a small validation test but it passed

   public void testMain() throws Exception
   {
      String xml = "<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'>" +
         "<servlet>" +
         "  <servlet-name>TestService</servlet-name>" +
         "  <servlet-class>org.jboss.test.ws.jaxrpc.enventry.EnvEntryBeanJSE</servlet-class>" +
         "</servlet>" +
         "<servlet-mapping>" +
         "  <servlet-name>TestService</servlet-name>" +
         "  <url-pattern>/*</url-pattern>" +
         "</servlet-mapping>" +
         "<env-entry>" +
         "  <env-entry-name>jsr109/entry1</env-entry-name>" +
         "  <env-entry-type>java.lang.String</env-entry-type>" +
         "  <env-entry-value>web</env-entry-value>" +
         "</env-entry>" +
         "<env-entry>" +
         "  <env-entry-name>jsr109/entry2</env-entry-name>" +
         "  <env-entry-type>java.lang.Integer</env-entry-type>" +
         "  <env-entry-value>8</env-entry-value>" +
         "</env-entry>" +
         "</web-app>";

      Validator.assertValidXml(xml, new EntityResolver()
      {
         public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
         {            
            String path = "file:///e:/cvsroot/projects/metadata/trunk/src/main/resources/schema/";
            if(systemId != null && systemId.startsWith(path))
            {
               path = systemId;
            }
            else if("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd".equals(systemId))
            {
               path += "web-app_2_4.xsd";
            }
            else if("http://www.w3.org/2001/xml.xsd".equals(systemId))
            {
               path += "xml.xsd";
            }
            else if("http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd".endsWith(systemId))
            {
               path += "j2ee_web_services_client_1_1.xsd";
            }
            else
            {
               System.out.println("resolveEntity: '" + publicId + "' '" + systemId + "'");
               return null;
            }
            
            return new InputSource(path);
         }}
      );
   }

Could you try to come up with a test like this that fails? I tried creating a test in the metadata project but that would also pass. I can commit it if you want.

> Invalid content was found starting with element 'env-entry'
> -----------------------------------------------------------
>
>                 Key: JBAS-4916
>                 URL: http://jira.jboss.com/jira/browse/JBAS-4916
>             Project: JBoss Application Server
>          Issue Type: Sub-task
>      Security Level: Public(Everyone can see) 
>            Reporter: Thomas Diesler
>         Assigned To: Alexey Loubyansky
>             Fix For:  JBossAS-5.0.0.Beta3
>
>
> [tdiesler at tddell jbossws-native-2.0.2]$ ant -Dtest=org.jboss.test.ws.jaxrpc.enventry.EnvEntryJSETestCase one-test
> <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">
>   <servlet>
>     <servlet-name>TestService</servlet-name>
>     <servlet-class>org.jboss.test.ws.jaxrpc.enventry.EnvEntryBeanJSE</servlet-class>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>TestService</servlet-name>
>     <url-pattern>/*</url-pattern>
>   </servlet-mapping>
>   <env-entry>
>    <env-entry-name>jsr109/entry1</env-entry-name>
>    <env-entry-type>java.lang.String</env-entry-type>
>    <env-entry-value>web</env-entry-value>
>   </env-entry>
>   
>   <env-entry>
>    <env-entry-name>jsr109/entry2</env-entry-name>
>    <env-entry-type>java.lang.Integer</env-entry-type>
>    <env-entry-value>8</env-entry-value>
>   </env-entry>
> </web-app>
> Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'env-entry'. One of '{"http://java.sun.com/xml/ns/j2ee":service-ref, "http://java.sun.com/xml/ns/j2ee":resource-ref, "http://java.sun.com/xml/ns/j2ee":resource-env-ref, "http://java.sun.com/xml/ns/j2ee":message-destination-ref, "http://java.sun.com/xml/ns/j2ee":callback-handler, "http://java.sun.com/xml/ns/j2ee":message-destination}' is expected. @ *unknown*[24,14]
>         at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.error(SaxJBossXBParser.java:437)
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
>         at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
>         at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
>         at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
>         at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:209)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list