Loading ...
Sorry, an error occurred while loading the content.
 

Programmable Filter

Expand Messages
  • Tommy Fan
    Hi, I m new using xml-dbms. I m going to write an application using xml-dbms. Is there an API or method to set the filter instead of using filters.dtd ?
    Message 1 of 2 , Jan 23, 2006
      Hi,

      I'm new using xml-dbms. I'm going to write an
      application using xml-dbms. Is there an API or method
      to set the filter instead of using filters.dtd ?

      Thanks,

      Tommy
      Jakarta-ID



      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    • Ronald Bourret
      Hello, See the package org.xmlmiddlware.xmldbms.filters. The classes you will probably need are FilterBase, FilterSet, RootFilter, TableFilter,
      Message 2 of 2 , Jan 25, 2006
        Hello,

        See the package org.xmlmiddlware.xmldbms.filters. The classes you will
        probably need are FilterBase, FilterSet, RootFilter, TableFilter,
        ResultSetFilter, RelatedTableFilter, and FilterConditions. These classes
        are generally used internally, so they're not that heavily documented.
        If you have questions about their use, look at FilterCompiler, which
        reads a filter document and creates a FilterSet object using these
        classes. The classes also correspond fairly closely to the elements and
        attributes in the filter language, so learning that will help you use them.

        A word of caution:
        ------------------
        Filter, action, and map documents are all compiled into a set of
        internal objects. The top level objects (FilterSet, Actions, XMLDBMSMap)
        are designed for your application to use directly, such as when
        calling DOMToDBMS or DBMSToDOM. However, your application doesn't need
        to do anything but pass them in as opaque objects representing a
        particular filter, action, or map document.

        It is possible to build these objects directly, just as the various
        compilers do. However, there seems little reason to do this. It is far
        easier to write a document, compile it, and then use the resulting
        object in your application. Furthermore, the compiled object can be
        reused. For example, you can use a particular XMLDBMSMap object to make
        many data transfers that all use the same mapping.

        And while there is probably a performance penalty for compiling
        documents into objects (as opposed to building those objects yourself),
        it is utterly insignificant compared to the cost of the database calls
        made elsewhere in XML-DBMS. In exchange, you have a much higher
        development cost, as you are writing code to build these objects instead
        of writing a simple XML document.

        A final reason to avoid creating these objects directly is that it is
        very easy to shoot yourself in the foot, as the methods on them are more
        forgiving of abuse than those designed for more public use, such as
        those on DOMToDBMS or Transfer. For example, you can create a FilterSet
        object that contains no RootFilters or ResultSetFilters and pass this to
        DBMSToDOM. Although I have not looked, the code in DBMSToDOM probably
        doesn't check for this condition and will likely fail (such as with a
        null pointer exception) when you do this.

        That said, one good reason to build these objects directly is if you are
        writing an editor for creating XML-DBMS mappings, filters, and actions.

        -- Ron

        Tommy Fan wrote:
        > Hi,
        >
        > I'm new using xml-dbms. I'm going to write an
        > application using xml-dbms. Is there an API or method
        > to set the filter instead of using filters.dtd ?
        >
        > Thanks,
        >
        > Tommy
        > Jakarta-ID
      Your message has been successfully submitted and would be delivered to recipients shortly.