cancel
Showing results for 
Search instead for 
Did you mean: 

Is XML Parser _very_ strict?

mikeandrews
New Contributor III

Hi folks,

I was looking to expose a Task via URL trigger with a payload of an XML message, so i started mocking this up with a sample XML as a file in SLFS and a simple pipeline File Reader → XML Parser → do-stuff.

I didnt specify the “Inbound schema” on the XML Parser for the incoming binary XML, and even on a very simplified XML structure I’m getting:

Failure: Failed to convert xml to json, Reason: Mixed content is not supported: ’ ', Resolution: Please check if the xml data is well formed

the XML is considered valid by other non-SL tools:

<EnterpriseMessage xmlns="http://schemas.xxxx.com/enterprise/services/2014/05" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<EnterpriseHeader>
    <MessageId>1369611c-eb2b-41ca-9573-852125cb418e</MessageId>
    <ThreadId>774c8fe4-145d-40c0-bfea-442bb29aa85c</ThreadId>
    <CreatedUtc>2016-01-12T14:13:32.654Z</CreatedUtc>
</EnterpriseHeader>
<MessageBody>
    <BusinessData xmlns="">
        <Label>
            <OBJ_VER>0</OBJ_VER>
            <xxxx_COMPANY>10448</xxxx_COMPANY>
        </Label>
        <Company>
            <xxxx_COMPANY_ID>10448</xxxx_COMPANY_ID>
            <xxxx_COUNTRY_ID>320</xxxx_COUNTRY_ID>
        </Company>
    </BusinessData>
</MessageBody>
</EnterpriseMessage>

Is it essential to set the schema to assist the parser? Sometimes the namespaces will vary or the schema be dynamic…

3 REPLIES 3

Piyush
New Contributor III

Tried. Just worked for me.

Just File Reader (File name specified) → XML parser (No changes)

mikeandrews
New Contributor III

Spooky, that sample works for me too it is just a redacted/cut down representation of the larger original. Maybe there were some newlines or tabs that were purged via cut/paste… Cant see anything invalid in the original, that still shows the “mixed content is not supported” error…

Had a closer look, in the original machine-generated xml the elements were indented with some kind of space characters and the parser failed. Changing these to tab characters and the parser worked fine… Just a bit confusing as the failing XML appears to be valid UTF-8 XML.

Thanks anyway,
Mike

Piyush
New Contributor III

Just check if its unix or windows filetype.

I had parser issue in past where I was using windows file on linux snaplogic runtime.