Search code examples
anypoint-studiomulesoft

Invalid content error on compression:extract


I am attempting to use the zip-extract method in a foreach loop to unzip several files. When I attempt to deploy the project the following error is returned:

Invalid content was found starting with element 'compression:extract'. One of >'{"http://www.mulesoft.org/schema/mule/core":annotations, >"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, >"http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor}' is expected.

The actual code is:

<compression:extract doc:name="Extract" doc:id="9119d722-95eb-4aee-a734-50e2a2825449" >
    <set-payload value="#[payload]" />
    <compression:extractor >
        <compression:zip-extractor />
    </compression:extractor>
</compression:extract>

I have not been able to find anything online that would point towards a solution.


Solution

  • It look like accidentally a <set-payload> was put inside the <compression:extract> element. Also it doesn't make sense at all because it puts the payload as the payload, which it is already is. Just remove that line.

    Maybe the intention was to use <compression-compressed>?

    Example:

    <compression:extract>
        <compression:compressed>#[payload]</compression:compressed> 
        <compression:extractor>
            <compression:zip-extractor/> 
        </compression:extractor>
    </compression:extract>
    

    payload is already the default, so it is not needed.