>Resolving Grammars using the URIResolver Extension Point

>One of the less publicized but often needed extension points in the Eclipse Web Tools Platform is the URIResolver extension. There are many use cases in which the XML Catalog may not necessarily work for resolving the location of a grammar. A good example is when there are multiple XML files that all use the same namespace. XML Catalogs can have difficulty identifying these xmls. A perfect example are the Standards from OAGIs, STAR, HRXML, and others. Due the fact that multiple global elements could be the root element, and the standards are distributed as Standalones (i.e. they are self contained), you could have many schemas that all resolve to the same namespace.

The URIResolver allows you to create a custom resolver, and return the appropriate grammar to be used to construct the content model. This then can allow you to return the appropriate grammar based on your own specified criteria.


The stage allows for specifying how the URI to be resolved should be passed.

The one draw back to this extension point is that it requires you to implement the org.eclipse.wst.common.internal.resolver.URIResolverExtension interface. This interface is classified as being internal, but so is about 90% of the classes you need to do anything useful in webtools.

The XSL Tools component uses this extension point to provide the appropriate grammar for XSLT 1.0 or XSLT 2.0.

This entry was posted in eclipse, xml, xsd. Bookmark the permalink.

3 Responses to >Resolving Grammars using the URIResolver Extension Point

  1. Jesper says:

    >Is this a case for having per-project user configurable XML catalogs, or similar schemes?

  2. Jesper says:

    >To clarify: It'd be an enhancement, there is no such feature yet.

  3. David Carver says:

    >Of if there is a way to do this with the rewrite option in XML Catalog 1.1 I'd be interested in hearing about it.Only way I have found to resolve which schema to use when it falls under the same namespace (i.e. multiple global elements, but different physical schemas) is to use a custom resolver.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s