How do I manage line-endings when reading XML file in SSIS 2005

430 views Asked by At

I have a simple xml file. It defined an element in that file as...

<xs:element name="Comments" >
  <xs:simpleType>
   <xs:restriction base="xs:string">
     <xs:maxLength value="4000" />
   </xs:restriction>
  </xs:simpleType>
</xs:element>

I create two Xml files that matches that supposedly match that schema, one uses CR/LF line endings (Windows) and the other used LF line endings (Unix).

The length of the Comments value is 4000 bytes for the Unix file. The corresponding length for the Windows file is greater than 4000 bytes unsurprisingly because of the extra CR bytes.

When validating the Xml files with Xml Notepad, both files are valid. As expected as the CR/LF are supposed to be automatically converted to single LF as per Xml spec 2.11 End-of-Line Handling

Now when I load the files via the Xml Task, it only sees the Unix file as being valid, it sees the Windows version as having more than 4000 characters.

Can the Xml Task be configured to work per Xml spec? Or do I have to convert the CR/LF line endings myself and then re-validate?

0

There are 0 answers