I have this CSV input:
Username,"Certification ID number","Certification Name","Date completed","Date due"
nlxxxxxx,NLaaa,"NL - Test certificaat",1/12/2021,"15/12/2022, 07:55"
nlyyyyyy,CPbbb-cert,"Test Law certificaat",1/12/2021,"30/11/2023, 09:10"
I get from BizTalk Test Mapper the following error:
error btm1041: Native Parsing Error: Unmatched wrap character " The current definition being parsed is Certificate. The stream offset where the error occured is 153. The line number where the error occured is 2. The column where the error occured is 68.
I assume the error comes from the Date due field. I setted this field with wrap character property (see XSD below).
<?xml version="1.0" encoding="utf-16" ?>
<xs:schema xmlns="http://Securitas.ESB.HR.LMSToAfas_ManageCertificate.Schemas.LMSCertificate" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Securitas.ESB.HR.LMSToAfas_ManageCertificate.Schemas.LMSCertificate" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
<b:schemaInfo standard="Flat File" codepage="65001" default_pad_char="" pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="LMSCertificate" />
</xs:appinfo>
</xs:annotation>
<xs:element name="LMSCertificate">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xA" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Header">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="," child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Username" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="CertificationID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="CertificationName" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DateCompleted" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DateDue" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="Certificate">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="," child_order="infix" sequence_number="2" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Username" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="CertificationID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="CertificationName" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" wrap_char_type="char" wrap_char=""" pad_char_type="hex" pad_char="0x20" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DateCompleted" type="xs:date">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="4" pad_char_type="hex" pad_char="0x20" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DateDue" type="xs:dateTime">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="5" wrap_char_type="char" wrap_char=""" pad_char_type="none" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I can't figure out where I am wrong
First of you need to check what your lines end with, you've defined it as LF, but if it is CR LF it will throw the error above. Change it to 0x0D 0x0A on the root node.
If you then get the below, then the final line doesn't have the delimiter and you need to change the child order on the root node LMS Certificate to Infix.
Next you will get the below errors
Set the DateCompleted Custom Date/Time Format to
d/MM/yyyy, that will eliminate two of the errors.Now the DueDate one is tricky, I tried a Custom Date/Time Format of
d/MM/yyyy, hh:mm, but it didn't work and stil threw the same two errors. If I changed it to a String it parsed correctly. A clue was when I generated an native instance was that it would populate it as DueDate. After I copied your other date and renamed it, updated it to a DateTime and updated the custom format it worked.Differences
child_delimiter="0x0D 0x0A"on LMSCertificatewrap_char="""isn't valid, it should bewrap_char="""datetime_format="d/MM/yyyy"on DateCompletedpad_char_type="hex" pad_char="0x20" datetime_format="d/MM/yyyy, hh:mm"on DueDateOutput
P.S. I also assumed that the extra lines in your sample were due to trying to format it for StackOverflow, and that it actually looks like this