commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morgan Delagrange <>
Subject Re: [Jelly] restrict use of tag libraries
Date Tue, 04 Feb 2003 15:37:26 GMT
--- James Strachan <> wrote:
> Agreed - though I can't help feeling we'd end up
> reinventing XML validation
> techniques where just reusing something like
> RelaxNG, XSD or Schematron
> might be easier.
> James

Hey Christian,

That's my sentiment as well.  When designing an API,
you try to address the common usage and allow hooks
for specific implementations.  The kind of validation
you're trying to implement is pretty specific.

I have another suggestion for how you might implement
your validation.  You could use custom tags inside
your namespace to switch namespace restrictions on and
off, then enforce them with a custom JellyContext.  I
haven't checked the precise syntax, but something like
this might work.  It's not exactly elegant, but it's
simple to implement:

  <element1 xmlns="com.yadda.Yadda"> <!-- no taglibs
allowed here -->
    <element2 xmlns:j="jelly:core"

  private class YaddaContext extends JellyContext {

    * Only allow other namespaces when
    * specifically enabled.
    public TagLibrary getTagLibrary(String
namespaceURI)  {
      if (namespaceURI.equals("com.yadda.Yadda") ==
false) {
        if (getVariable("allowNS") == false) {
          throw new NoClassDefFoundError("Unexpected
tag library uri: " + namespaceURI);
      return super.getTagLibrary(namespaceURI); 

Morgan Delagrange

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

View raw message