1 Reply Latest reply on Jun 22, 2005 6:25 AM by aloubyansky

    Transparent location of document xsd files

    starksm64

      One ease of use issue I mentioned on the dev list is having to know how to obtain the xsd file for a given namespace's schema using the current schema driven binding api. The current testscases start with at least the mapping of the root namespace schema using something like:

       String url = getResource("xml/mbeanserver/mbean-service_1_0.xsd");
       SchemaBinding schemaBinding = XsdBinder.bind(url);
      


      Another example of a document that incorporates 3 namespaces with associated schemas is:
       String url = getResource("xml/mbeanserver/mbean-service_1_0.xsd");
       SchemaBinding schemaBinding = XsdBinder.bind(url);
       schemaBinding.setSchemaResolver(new SchemaBindingResolver(){
       public SchemaBinding resolve(String nsUri, String localName)
       {
       if("urn:jboss:login-config2".equals(nsUri))
       {
       String url = getResource("xml/mbeanserver/login-config2.xsd");
       return XsdBinder.bind(url);
       }
       else if("urn:jboss:user-roles".equals(nsUri))
       {
       String url = getResource("xml/mbeanserver/user-roles.xsd");
       return XsdBinder.bind(url);
       }
       else
       {
       throw new JBossXBRuntimeException("Unrecognized namespace: " + nsUri);
       }
       }
       });
      


      Ideally this is information that the jbossxb user should not have to supply as it could be obtained from the schemaLocation attribute, or a more generic namespace to xsd mapping catalog. The latter is needed for all of the standard jboss schemas and corresponds to how we handle j2ee dtds, xsds and jboss dtds. Can the existing org.jboss.util.xml.JBossEntityResolver be used/updated for this?