SAX 2.0 extension proposals.

Miles Sabin msabin at cromwellmedia.co.uk
Wed Feb 2 17:58:06 GMT 2000


Toby Speight wrote,
> [snip: detailed example]
>
> Now an application asks for a parser that provides q and r.  
> The factory could use the above table to discover that C and 
> F together will provide this (no other combination works).

Hmm ... that strikes me as a tad specialized. Even so, I think
the case is covered. How about,

  package foo;

  public class MyFilterImpl
    implements XMLReaderImplementation
  {
    private XMLReaderImplementation
      itsBaseImpl;

    public TableDrivenImplementation()
    {
      // Search for a suitable base impl possibly using
      // XMLReaderImplementations.implementations()
      itsBaseImpl = ???
    }

    public boolean supportsFeature(String name, boolean state)
    {
      if(itsBaseImpl == null)
        return false;
      else
        return
          name.equals("q") || name.equals("r") ||
          itsBaseImpl.supportsFeature(name, state);
    }

    public XMLReader createReader()
    {
      return new MyFilter(itsBaseImpl.createReader());
    }
  }

If MyFilter(Impl) has a provider file located at
org.xml.sax.helpers.XMLReaderImplentations.providers which
looks like,

  foo.MyFilterImpl

then,

  XMLReader reader = XMLReaderImplementation.
    createReader(new String[] { "q", "r" });

will do what you want. Or am I still missing something?

Cheers,


Miles

-- 
Miles Sabin                       Cromwell Media
Internet Systems Architect        5/6 Glenthorne Mews
+44 (0)20 8817 4030               London, W6 0LJ, England
msabin at cromwellmedia.com          http://www.cromwellmedia.com/


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Please note: New list subscriptions and unsubscriptions
are  now ***CLOSED*** in preparation for list transfer to OASIS.





More information about the Xml-dev mailing list