I have a flat file schema that i have pasted below (this is a subset)
for a large health care provider.
When data is output from our ERP system, i map it to this schema.
The root record of the schema is set as delimted by a pipe and a
carriage return. The root record has a child record (details) that is
positionally delimited.
The child record contains all the data elements. Instances of this
schema should contain all these elements even if they are blank up to
the element named "cov3_cov_type".
If, however, cov3_cov_type is blank the pipe / CR delimter must appear
immediately and none of the other elements following it should appear
in the record instance. It's important to know that if cov3_cov_type
is blank then all the elements that trail it will be blank as well.
So to restate: If cov3_cov_type is blank, the pipe / CR delimiter
should be set, meaning all the following empty elements should be
ignored and not placed in the output instance.
The behaviour I am currently seeing from the below schema is that the
pipe delimiter is set when cov3_cov_type is blank as expected, but then
the blank spaces from all the trailing empty elements are present in
the flat file instance before the carriage return to the next record.
Thank you in advance for you help,
Ryan G.
<?xml version="1.0" encoding="utf-16"?>
<xs:schema
xmlns="http://schemas.jetblue.com/sap/hr/benefits/unitedhealth/hbni002/1_0"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
targetNamespace="http://schemas.jetblue.com/sap/hr/benefits/unitedhealth/hbni002/1_0"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<b:schemaInfo count_positions_by_byte="false"
parser_optimization="speed" lookahead_depth="3"
suppress_empty_nodes="true" generate_empty_nodes="true"
allow_early_termination="true" standard="Flat File"
root_reference="hbni002" />
<schemaEditorExtension:schemaInfo namespaceAlias="b"
extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension"
standardName="Flat File"
xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions"
/>
</xs:appinfo>
</xs:annotation>
<xs:element name="hbni002">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited"
preserve_delimiter_for_empty_data="false"
suppress_trailing_delimiters="false" sequence_number="1"
child_delimiter_type="hex" child_delimiter="0x0D 0x0A"
child_order="postfix" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<b:groupInfo sequence_number="0"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element minOccurs="0" maxOccurs="unbounded"
name="detail_records">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="2" structure="positional"
preserve_delimiter_for_empty_data="true"
suppress_trailing_delimiters="false" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attribute name="version" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="1" justification="left"
pos_length="5" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="sub_grp_id" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left"
pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="3" justification="left"
pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="rel_code" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="4" justification="left"
pos_length="2" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="emp_id" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="5" justification="left"
pos_length="11" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="6" justification="left"
pos_length="4" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ssn" type="xs:string" use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="7" justification="left"
pos_length="11" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="8" justification="left"
pos_length="4" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="prior_emp_id" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="9" justification="left"
pos_length="15" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="personal_id" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="10"
justification="left" pos_length="11" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank4" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="11"
justification="left" pos_length="5" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="employment_date" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="12"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank5" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="13"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="last_name" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="14"
justification="left" pos_length="20" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="first_name" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="15"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank6" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="16"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="middle_initial" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="17"
justification="left" pos_length="1" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_cov_type" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="77"
justification="left" pos_length="3" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_cov_startdate" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="78"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank19" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="79"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_cov_enddate" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="80"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank20" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="81"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_cov_paid_thru_date"
type="xs:string" use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="82"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank21" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="83"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_struc_field1" type="xs:string"
use="required">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="84"
justification="left" pos_length="7" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_elig_longutil1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="104"
justification="left" pos_length="20" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_life_flat_amt" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="105"
justification="left" pos_length="7" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov1_rider_crit_illness"
type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="108"
justification="left" pos_length="1" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov3_cov_type" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="141"
justification="left" pos_length="3" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov3_cov_startdate" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="142"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank35" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="143"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov3_cov_enddate" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="144"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank36" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="145"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov3_cov_paidthrudate" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="146"
justification="left" pos_length="8" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank37" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="147"
justification="left" pos_length="12" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov3_struc_field1" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="148"
justification="left" pos_length="7" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="blank38" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="149"
justification="left" pos_length="3" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="cov3_struc_field2" type="xs:string"
use="optional">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="150"
justification="left" pos_length="7" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>