The configured Filter ('SAX') cannot be used with the specified set of Smooks visitors

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

The configured Filter ('SAX') cannot be used with the specified set of Smooks visitors

Smooks User
Hi,

I am getting the following error while performing EDI to XML for a huge file.

"org.milyn.SmooksException: The configured Filter ('SAX') cannot be used with the specified set of Smooks visitors.  The 'DOM' Filter is the only filter that can be used for this set of Visitors.  Turn on Debug logging for more information."

Here is my smooks configuration:

<?xml version="1.0"?>
<smooks-resource-list
        xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
        xmlns:xsl="http://www.milyn.org/xsd/smooks/xsl-1.1.xsd"
        xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd"
        xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.4.xsd">

        <core:filterSettings type="SAX" defaultSerialization="false" />
   
    <edi:reader mappingModel="/example/edi-to-xml-mapping.xml"/> 
   
    <resource-config selector="Element1, Element2, Element3">
    <resource>org.milyn.delivery.DomModelCreator</resource>
        </resource-config>
   
        <xsl:xsl applyOnElement="Element1, Element2, Element3">
        <xsl:template>/example/BasicXslTransform.xsl</xsl:template>
    </xsl:xsl> 
</smooks-resource-list>


Here is my Java code:

        protected static void runSmooksTransform() throws IOException, SAXException, SmooksException {
        Smooks smooks = new Smooks("smooks-config.xml");
        try {
            ExecutionContext executionContext = smooks.createExecutionContext();
            smooks.filterSource(executionContext, new StreamSource(new FileInputStream("input.edi")));
        } catch (Exception e) {
        e.printStackTrace();
        }
        finally {
            smooks.close();
        }
    }

May I know what I am doing wrong here?

Thanks,
Reply | Threaded
Open this post in threaded view
|

Re: The configured Filter ('SAX') cannot be used with the specified set of Smooks visitors

Tom Fennelly
Looks like you're using a DOM only visitor in the XSL visitor. That will force Smooks to use DOM filtering no matter what you set the file to. There is something in the docs about that.

On 26 February 2015 at 22:11, Smooks User <[hidden email]> wrote:
Hi,

I am getting the following error while performing EDI to XML for a huge
file.

"org.milyn.SmooksException: The configured Filter ('SAX') cannot be used
with the specified set of Smooks visitors.  The 'DOM' Filter is the only
filter that can be used for this set of Visitors.  Turn on Debug logging for
more information."

*Here is my smooks configuration:*

<?xml version="1.0"?>
<smooks-resource-list
        xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd"
        xmlns:xsl="http://www.milyn.org/xsd/smooks/xsl-1.1.xsd"
        xmlns:core="http://www.milyn.org/xsd/smooks/smooks-core-1.4.xsd"
        xmlns:edi="http://www.milyn.org/xsd/smooks/edi-1.4.xsd">

        <core:filterSettings type="SAX" defaultSerialization="false" />

    <edi:reader mappingModel="/example/edi-to-xml-mapping.xml"/>

    <resource-config selector="Element1, Element2, Element3">
        <resource>org.milyn.delivery.DomModelCreator</resource>
        </resource-config>

        <xsl:xsl applyOnElement="Element1, Element2, Element3">
        <xsl:template>/example/BasicXslTransform.xsl</xsl:template>
    </xsl:xsl>
</smooks-resource-list>


*Here is my Java code:*

        protected static void runSmooksTransform() throws IOException,
SAXException, SmooksException {
        Smooks smooks = new Smooks("smooks-config.xml");
        try {
            ExecutionContext executionContext =
smooks.createExecutionContext();
            smooks.filterSource(executionContext, new StreamSource(new
FileInputStream("input.edi")));
        } catch (Exception e) {
                e.printStackTrace();
        }
        finally {
            smooks.close();
        }
    }

May I know what I am doing wrong here?

Thanks,



--
View this message in context: http://milyn.996300.n3.nabble.com/The-configured-Filter-SAX-cannot-be-used-with-the-specified-set-of-Smooks-visitors-tp8994.html
Sent from the milyn - dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: The configured Filter ('SAX') cannot be used with the specified set of Smooks visitors

Smooks User
Hi Tom,

Thanks for the reply. How to use SAX in XSL visitor?

Thanks,
Srikanth
Reply | Threaded
Open this post in threaded view
|

Re: The configured Filter ('SAX') cannot be used with the specified set of Smooks visitors

Tom Fennelly
You can't use SAX if using the XSL because the XSL visitor impl is DOM only. See http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide#Filtering_Process_Selection_.28DOM_or_SAX.3F.29

On 27 February 2015 at 18:04, Smooks User <[hidden email]> wrote:
Hi Tom,

Thanks for the reply. How to use SAX in XSL visitor?

Thanks,
Srikanth



--
View this message in context: http://milyn.996300.n3.nabble.com/The-configured-Filter-SAX-cannot-be-used-with-the-specified-set-of-Smooks-visitors-tp8994p8997.html
Sent from the milyn - dev mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email