2 Replies Latest reply on Oct 10, 2007 7:09 PM by starksm64

    SchemaBindingResolver.resolve based on ns to class

    starksm64

      The current logic of being able to register a namespace to class mapping does not work for families of descriptors like javaee that reuse the same namespace across all of the descriptors. The only indication of a difference as the time resolution is done is the optional schemaLocation information:

      <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">
      
      <ejb-jar 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/ejb-jar_2_1.xsd"
       version="2.1">
      
      


      Either the schemaLocation needs to be looked at, and a schemaLocation,class pair used to register a class, or we allow multiple class bindings for a namespace to create an uber SchemaBinding with multiple root elements. The latter seems like it would work, but I have not looked into it.


        • 1. Re: SchemaBindingResolver.resolve based on ns to class
          aloubyansky

          If there is a possibility to map a namespace to different XSDs then it's possible that those XSDs define global types/elements under the same name. In theory at least, merging them into one schema may result in conflicts. Therefore, I would vote for <schemaLocation,class> pair.

          • 2. Re: SchemaBindingResolver.resolve based on ns to class
            starksm64

            That is what I added.

             <bean name="WarSchemaResolverConfig"
             class="org.jboss.xb.binding.sunday.unmarshalling.SchemaResolverConfig">
             <!-- schemaLocation to JBossXBuilder binding classes -->
             <property name="bindingClassesByLocations">
             <map keyClass="java.lang.String" valueClass="java.lang.String">
             <entry>
             <key>http://java.sun.com/dtd/web-app_2_3.dtd</key>
             <value>org.jboss.metadata.web.spec.Web23MetaData</value>
             </entry>
             </map>
             </property>
             </bean>