Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] XML Catalog - namespaces or schemaLocations ... or both

This is an issue we've run into a few times with our schema locations and proxies, have gone two different directions at two different times, and are less sure than ever which way we're supposed to go with it.

We'd like to support both of these use cases:

1 - Automatic validation for XML of form:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
...

This requires us to set up an entry in org.eclipse.jst.standard.schemas of:

    <uri
        name="http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
        uri="dtdsAndSchemas/persistence_1_0.xsd" />


such that the schema location actually redirects to the locally stored file.  (Check https://bugs.eclipse.org/bugs/show_bug.cgi?id=227037 for background.)

2 - Automatic validation for XML of form:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
    xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...

This seems to require us to set up an entry in org.eclipse.jst.standard.schemas of:

    <uri
        name="http://java.sun.com/xml/ns/persistence"
        uri="dtdsAndSchemas/persistence_1_0.xsd" />

such that the namespace is used to retrieve the correct schema.  The problem that seems to come from this approach is the possibility of multiple schema versions using the same namespace, which they usually do.


So, there are a few problems here. 

a)  The namespace-version problem.  Can we use the namespace-to-schema location mechanism reliably, knowing that there may (will) be multiple schema versions per namespace?

b)  If not, must we always generate XML of the first form, and count on the user setting up his workspace catalog to take advantage of namespace entries, assuming that the user will only be working with one version of the schema in this case?

c)  The problem of a user specifying a namespace->schema location for one of our included schemas.  As far as I know (I wasn't able to) a user can't set up a catalog entry whose key is a namespace and whose schema is included in the plugin jars.  (Additionally, I'd expect that if a user specified a namespace-to-web location of a schema catalog entry, and that web location was further mapped to a local schema, as in use case #1 above, that eclipse would automatically use the local schema for validation.)  Does this mean that, if a user wants to not have schemaLocation tags, that she would have to download her own copy of the schema to use locally?

d)  Should we provide both entries in the org.eclipse.jst.standard.schemas plugin and hope for the best?

Paul Fullbright
Oracle Corp.
Eclipse Dali/Java Persistence Tools Development
paul.fullbright@xxxxxxxxxx

Back to the top