Also noticed following :

When wadl2java code generation  resolves <xsd:import
namespace="urn:ru:ilb:basicuuid:basicuuid"/>
using  xml-resolver, it resolves it using publicId using this record in
catalog.xml
<public publicId="urn:ru:ilb:basicuuid:basicuuid"
uri="classpath:schemas/basicuuid/basicuuid.xsd" />
This is the code:
class org.apache.xml.resolver.Catalog, method resolveLocalPublic,

    while (en.hasMoreElements()) {
...
      if (e.getEntryType() == PUBLIC
      && e.getEntryArg(0).equals(publicId)) {
    if (over || systemId == null) {
      return e.getEntryArg(1);
    }
      }
    }

and here publicId variable equals "urn:ru:ilb:basicuuid:basicuuid".

But in runtime, in org.apache.cxf.jaxrs.utils.schemas.SchemaHandler, method
createSchema
it resolves it using LSResourceResolver.resolveResource
and, surprisingly, publicId here is null, but
namespaceURI="urn:ru:ilb:basicuuid:basicuuid", and I can only resolve
schema using <uri> catalog entry
Don't  know why different processors resovle imports differently.
Looking here,
https://jaxb.java.net/guide/Fixing_broken_references_in_schema.html
it says that only public entry in catalog required.

But, to resolve schema import both in runtime and during class compilation,
i need to write in catalog.xml two entries:

    <!-- this is for xsd compilation -->
    <public publicId="urn:ru:ilb:basicuuid:basicuuid"
uri="classpath:schemas/basicuuid/basicuuid.xsd" />
    <!-- this is for SchemaHandler -->
    <uri name="urn:ru:ilb:basicuuid:basicuuid"
uri="classpath:schemas/basicuuid/basicuuid.xsd" />

Don't know, how should this fixed (or should not)
E.g. , code like this could fix that, but seems ugly:
resolvedLocation =
catalogResolver.resolvePublic(publicId!=null?publicId:namespaceURI,
systemId);

Reply via email to