I have a flat file and I need to create a schema so I can convert that flat file into XML and bring it to BizTalk.
I have used flat file schema wizard to create a schema but it is not working. I've modified it manually still not working. I will explain what is not working.
Flat File structure:
File header
Batch header
Detail (repeating records)
Address (repeating records)
Trailer
END
After creating the schema I'm trying to validate it and I'm getting error at this point.
Detail and Address are the body and they are repeatable.
My issue is that after it reads the line "DET" it is suppose to read the "ADD". However it is looking for "DET" again.
Error description:
error BEC2004: Unexpected data found while looking for:
'DET'
The current definition being parsed is RefundsRoot. The stream offset where the error occured is 799. The line number where the error occured is 4. The column where the error occured is 0.
Here is the sample
FDR06281339CREDIT REFUND CHECKS AC
HDR9008100000000000100006428
DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900
ADDF 6902 PINE ST OMAHA NE 68106-2855USA
TRL90081000000000001000000020000000000000642800000000000004900000000000000000000
END000000100000000200000000000000000000004900000000000000000000
Here is the schema (due to character limits I've only included related section)
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Fingerhut.BizTalk.Schemas.FSIn_Refunds" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Fingerhut.BizTalk.Schemas.FSIn_Refunds" 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="0x0A 0x0D" pad_char_type="hex" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="true" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="true" compile_parse_tables="false" root_reference="RefundsRoot" />
</xs:appinfo>
</xs:annotation>
<xs:element name="RefundsRoot">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
</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:complexType name="Detail">
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="DETL-HDR" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-SYSTEM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-PRIN-BANK" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-AGENT-BANK" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-ACCOUNT-NUMBER" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="16" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-PRMR-PI-ID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="16" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-ENTR-ID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="16" sequence_number="7" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-PI-NM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="8" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-FILLER" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="9" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-PI-ROLE-CD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="10" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-PRIMARY-NAME" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="11" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-SECONDARY-NAME" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="12" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-ADDRESS-LINE-1" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="13" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-ADDRESS-LINE-2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="26" sequence_number="14" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-CITY" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="18" sequence_number="15" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-STATE" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="16" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-POST-CODE" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="17" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-REF-NUM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="18" sequence_number="18" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-CHK-STARTING-NUM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="5" sequence_number="19" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-NUMBER-OF-CKS" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="4" sequence_number="20" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-DUALITY-FLAG" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="1" sequence_number="21" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-CREDIT-LIMIT" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="14" sequence_number="22" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-NUMBER-OF-PLASTICS" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="23" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="DETL-CHECKING-ACCOUNT-NUM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="17" sequence_number="24" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Address">
<xs:sequence>
<xs:annotation>
<xs:appinfo>
<groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
<xs:element name="ADDR-EXPN-ADDR-RCRD-HEDR-ID" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-PRMR-CUST-ADDR-FRMT-CD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="1" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-ATTN-LINE-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CMPN-NM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="4" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-HOUS-NR" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="5" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-STRT-NM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="40" sequence_number="6" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CNTN-ADDR-LINE-1-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="7" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CNTN-ADDR-LINE-2-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="8" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CNTN-ADDR-LINE-3-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="9" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CNTN-ADDR-LINE-4-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="50" sequence_number="10" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-PO-BOX-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="11" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CITY-NM" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="25" sequence_number="12" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-ST-CD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="2" sequence_number="13" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-SBDV-TX" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="25" sequence_number="14" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-PSTL-CD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="15" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-CTRY-CD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="3" sequence_number="16" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="ADDR-FILLER" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="17" justification="left" pos_length="271" pos_offset="0" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>
The following schema works (you of cause need to change my string elements to the correct positional record).
What you have to do is:
Add a record after the flat file wizard.
Put the record after your FDR element.
Add your repeating records DEC ADD to this new records as child elements.
Set the record to unbound
Set Child order Infix
Child delimiter type to Hex
Child delimiter to 0x0D 0x0A
This gives you the following schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://FlatFileSchema4" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://FlatFileSchema4" 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="Root" />
</xs:appinfo>
</xs:annotation>
<xs:element name="Root">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 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="FDR">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="FDR" tag_offset="0" 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="FDR" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="35" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="HDR">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="HDR" tag_offset="0" 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="HDR" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="29" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element maxOccurs="unbounded" name="RR">
<xs:annotation>
<xs:appinfo>
<recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="3" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="infix" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
</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="DET">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="DET" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" />
</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="DET" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="482" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ADD">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="ADD" tag_offset="0" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="2" />
</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="ADD" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="41" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TRL">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="TRL" tag_offset="0" sequence_number="4" 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="TRL" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="81" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="END">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" tag_name="END" tag_offset="0" sequence_number="5" 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="END" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="63" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
With test file:
FDR06281339CREDIT REFUND CHECKS AC
HDR9008100000000000100006428
DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900
ADDF 6902 PINE ST OMAHA NE 68106-2855USA
DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900
ADDF 6902 PINE ST OMAHA NE 68106-2855USA
TRL90081000000000001000000020000000000000642800000000000004900000000000000000000
END000000100000000200000000000000000000004900000000000000000000
And output:
<Root xmlns="http://FlatFileSchema4">
<FDR xmlns="">
<FDR>FDR06281339CREDIT REFUND CHECKS AC</FDR>
</FDR>
<HDR xmlns="">
<HDR>HDR9008100000000000100006428</HDR>
</HDR>
<RR xmlns="">
<DET>
<DET>DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900</DET>
</DET>
<ADD>
<ADD>ADDF 6902 PINE ST OMAHA NE 68106-2855USA</ADD>
</ADD>
</RR>
<RR xmlns="">
<DET>
<DET>DET900810000000636992103500048763699210350004876369921035000487STMT, TEST 5 01TEST 5 STMT 6902 PINE ST OMAHA NE68106-2855 0000000000+0000000000500000 00FINUT A +00000000000004900 FHSC999999 +0000000000500 EN 0099000000000 +0000000000000+000000000000000000+0000000000000+000000000000000000+0000000000000+0000000000000000000000000000+00009999999999999+00009999999999999+00000000000000000+00000000000000000+999999999999999+99999999999999900000000000+9999999999999990000000000000009900</DET>
</DET>
<ADD>
<ADD>ADDF 6902 PINE ST OMAHA NE 68106-2855USA</ADD>
</ADD>
</RR>
<TRL xmlns="">
<TRL>TRL90081000000000001000000020000000000000642800000000000004900000000000000000000</TRL>
</TRL>
<END xmlns="">
<END>END000000100000000200000000000000000000004900000000000000000000</END>
</END>
</Root>
I have updated the schema to also include the extra records that your testfile now have. And it works for me.
Related
I have two schema one is for input xml file and second is for database table.
Please look below for source data of above schema:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl'?>
<List>
<Classification domain="Type">deviceSku</Classification>
<Classification domain="Color">(PRODUCT)RED</Classification>
<Classification domain="ColorCode">#D82E2E</Classification>
<Classification domain="OS">Apple iOS</Classification>
<Classification domain="ChargeType">One Time Charge</Classification>
<Classification domain="Capacity">128GB</Classification>
</List>
Above file is input xml file which is in list form.
Please look below for table creation scripts which is output, and it is based on column format.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[cata_class](
[ID] [int] IDENTITY(1000,1) NOT NULL,
[classification_type] [varchar](100) NULL,
[classification_color] [varchar](100) NULL,
[classification_colorCode] [varchar](50) NULL,
[classification_os] [varchar](100) NULL,
[classification_chargetype] [varchar](100) NULL,
[classification_capacity] [varchar](100) NULL,
PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
)
GO
As per above SS. I want to add classification value based on condition of domain in destination schema so which functiod is better option and how to use that function?
Please look below for input schema:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="List">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="Classification">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="domain" type="xs:string" use="required" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Please look below for output schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:ns3="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<fileNameHint xmlns="http://schemas.microsoft.com/servicemodel/adapters/metadata/xsd">Table.dbo</fileNameHint>
</xs:appinfo>
</xs:annotation>
<xs:complexType name="cata_class">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="1" name="ID" nillable="true" type="xs:int" />
<xs:element minOccurs="0" maxOccurs="1" name="classification_type" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="classification_color" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="classification_colorCode" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="classification_os" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="classification_chargetype" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="classification_capacity" nillable="true">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:element name="cata_class" nillable="true" type="ns3:cata_class" />
<xs:complexType name="ArrayOfcata_class">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="cata_class" type="ns3:cata_class" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfcata_class" nillable="true" type="ns3:ArrayOfcata_class" />
</xs:schema>
We need to use Equal and Value mapping (flattering) function as per below SS:
On equal functiod we need to pass domain to check condition as below:
and in value mapping (flattering) functiod we need to pass equal functiod value as first input and classification node as second input and map it to destination schema node.
I have a very large xml field inside of a SQL Database that I have to edit regularly. I wrote the following Query to change that code which was easy following the xml path to get to what needed changed.
However I found more things further down in SQL that needs altered and I can not figure out the xml path to edit to make that change.
I've been utilizing the following Query to change just the username
DECLARE #config_xml2 xml
select #config_xml2 = configuration_xml from tblDatafeed where datafeed_name = 'DatafeedName' update tbldatafeed
set configuration_xml.modify('replace value of (//*:NetworkCredentialWrapper/#UserName)[1] with sql:variable("#LOGIN")') where datafeed_name ='DataFeedName'
Which is used to change the Username in the following:
<Tokens>
<Token name="DataFileDirectoryName" />
<Token name="DataFileName" />
<Token name="DataFileExtension" />
<Token name="LastRunTime" />
<Token name="LastFileProcessed" />
</Tokens>
<Transporter>
<transporters:WebServiceTransportActivity xmlns:transporters="clr-namespace:ArcherTech.DataFeed.Activities.Transporters;assembly=ArcherTech.DataFeed" xmlns:out="clr-namespace:ArcherTech.DataFeed;assembly=ArcherTech.DataFeed" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:compModel="clr-namespace:ArcherTech.DataFeed.ComponentModel;assembly=ArcherTech.DataFeed" xmlns:channel="clr-namespace:ArcherTech.DataFeed.Engine.Channel;assembly=ArcherTech.DataFeed" xmlns:engine="clr-namespace:ArcherTech.DataFeed.Engine;assembly=ArcherTech.DataFeed" xmlns:kernel="clr-namespace:ArcherTech.Kernel.Channel;assembly=ArcherTech.Kernel" xmlns="clr-namespace:ArcherTech.DataFeed;assembly=ArcherTech.DataFeed" xmlns:schema="clr-namespace:System.Xml.Schema;assembly=System.Xml" xmlns:xmlLinq="clr-namespace:System.Xml.Linq;assembly=System.Xml" xmlns:domain="clr-namespace:ArcherTech.Common.Domain;assembly=ArcherTech.Common" xmlns:s="clr-namespace:System;assembly=mscorlib" x:Key="transportActivity" SearchType="ReportId" Uri="Type URL Here" RecordsPerFile="100" ReportID="" UseWindowsAuth="false" IsWindowsAuthSpecific="false" WindowsAuthUserName="" WindowsAuthPassword="" WindowsAuthDomain="" ProxyName="" ProxyPort="" ProxyUsername="" ProxyPassword="" ProxyDomain="" IsProxyActive="False" ProxyOption="None" InstanceName="Type Instance Name Here" TempFileOnSuccessAction="DoNothing" TempFileOnSuccessRenameString="" TempFileOnErrorAction="DoNothing" TempFileOnErrorRenameString="" Transform="{engine:DataFeedBinding Path=Transform}" SessionContext="{engine:DataFeedBinding Path=Session}">
<transporters:ArcherWebServiceTransportActivity.Credentials>
<NetworkCredentialWrapper UserName="" />
</transporters:ArcherWebServiceTransportActivity.Credentials>
</transporters:ArcherWebServiceTransportActivity>
</Transporter>
<Iterator>
<XmlIterator>
But now I need to alter a string that a lot more complex and I am not sure my xml location is right. I have tried using //*NewSourceName1/#Calculation but it doesnt seem work:
Line of code Here I am trying to edit:
<xs:element name="NewSourceName1" type="xs:string" nillable="true" c:Name="Dashboard_Instance_Name" c:Calculation="=STATIC("MYSTRINGOFTEXTHERE")" dfm:SimpleFieldType="StaticText" />
Full xml it falls under
<Action>
<DataTransfer TargetType="Application" TargetLevel="20595ffc-afd5-4d34-babb-c8fa67c610ee" DisableValidation="true" PreValidate="false" InsertRecords="true" UpdateRecords="false" SyncAction="None" SyncFlagField="00000000-0000-0000-0000-000000000000" SyncFlagValue="00000000-0000-0000-0000-000000000000">
<Source>
<Schema><Schemas>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.archer-tech.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dfm="http://schemas.archer-tech.com/2009/xaml/datafeed" xmlns:c="http://archertech.com/ChannelFramework/Extensions" dfm:ComplexFieldType="None">
<xs:element name="ArcherRecords" nillable="true">
<xs:complexType>
<xs:sequence>
<xs:element name="ArcherRecord" nillable="true" c:Name="ArcherRecord" dfm:ComplexFieldType="None" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" nillable="true" c:Name="Name" />
<xs:element name="Container_Type" nillable="true" c:Name="Container_Type">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" type="xs:string" nillable="true" c:Name="Item" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Path" type="xs:string" nillable="true" c:Name="Path" />
<xs:element name="Abbreviation_Unique_Key" type="xs:string" nillable="true" c:Name="Abbreviation_Unique_Key" />
<xs:element name="Container_Owner" nillable="true" c:Name="Container_Owner">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" type="xs:string" nillable="true" c:Name="Item" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Send_Upstream" nillable="true" c:Name="Send_Upstream">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" type="xs:string" nillable="true" c:Name="Item" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewSourceName" type="xs:string" nillable="true" c:Name="Iteration" c:Calculation="=IF(AND(HOUR(NOW())>=0,HOUR(NOW())<8), "ONE",
 IF(AND(HOUR(NOW())>=8,HOUR(NOW())<16), "TWO", "THREE"))" dfm:SimpleFieldType="CalculatedField" />
<xs:element name="NewSourceName1" type="xs:string" nillable="true" c:Name="Dashboard_Instance_Name" c:Calculation="=STATIC("MyTextHere")" dfm:SimpleFieldType="StaticText" />
<xs:element name="NewSourceName2" type="xs:string" nillable="true" c:Name="Date_Created" c:Calculation="=DATEFORMAT(TODAY(), "MM/dd/yyyy")" dfm:SimpleFieldType="CalculatedField" />
<xs:element name="NewSourceName3" type="xs:string" nillable="true" c:Name="Created_By" c:Calculation="=STATIC("Local Dashboard")" dfm:SimpleFieldType="StaticText" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</Schemas></Schema>
</Source>
Hopeful out come (Look for MYSTRINGOFTEXTHERE or if I could just edit all of =STATIC("MYSTRINGOFTEXTHERE")):
<xs:element name="NewSourceName1" type="xs:string" nillable="true" c:Name="Dashboard_Instance_Name" c:Calculation="=STATIC("MYSTRINGOFTEXTHERE")" dfm:SimpleFieldType="StaticText" />
What I tried that didn't work
DECLARE #config_xml2 xml
select #config_xml2 = configuration_xml from tblDatafeed where datafeed_name = 'DatafeedName' update tbldatafeed
set configuration_xml.modify('replace value of (//*:NewSourceName1/#Calculation)[1] with sql:variable("#CoolVariableName")') where datafeed_name ='DataFeedName'
Any help would be greatly appreciated.
The XPath expression was completely off, so I adjusted it.
In XML, there are only five built-in character entities: <, >, &, " and ' for <, >, &, " and ' respectively. I replaced them with their literals. Please try the following.
SQL
DECLARE #tbl TABLE (id int IDENTITY PRIMARY KEY, configuration_xml XML);
INSERT INTO #tbl (configuration_xml)
VALUES
(N'<Action>
<DataTransfer TargetType="Application" TargetLevel="20595ffc-afd5-4d34-babb-c8fa67c610ee" DisableValidation="true" PreValidate="false" InsertRecords="true" UpdateRecords="false" SyncAction="None" SyncFlagField="00000000-0000-0000-0000-000000000000" SyncFlagValue="00000000-0000-0000-0000-000000000000">
<Source>
<Schema>
<Schemas>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.archer-tech.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dfm="http://schemas.archer-tech.com/2009/xaml/datafeed" xmlns:c="http://archertech.com/ChannelFramework/Extensions" dfm:ComplexFieldType="None">
<xs:element name="ArcherRecords" nillable="true">
<xs:complexType>
<xs:sequence>
<xs:element name="ArcherRecord" nillable="true" c:Name="ArcherRecord" dfm:ComplexFieldType="None" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" nillable="true" c:Name="Name" />
<xs:element name="Container_Type" nillable="true" c:Name="Container_Type">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" type="xs:string" nillable="true" c:Name="Item" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Path" type="xs:string" nillable="true" c:Name="Path" />
<xs:element name="Abbreviation_Unique_Key" type="xs:string" nillable="true" c:Name="Abbreviation_Unique_Key" />
<xs:element name="Container_Owner" nillable="true" c:Name="Container_Owner">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" type="xs:string" nillable="true" c:Name="Item" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Send_Upstream" nillable="true" c:Name="Send_Upstream">
<xs:complexType>
<xs:sequence>
<xs:element name="Item" type="xs:string" nillable="true" c:Name="Item" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="NewSourceName" type="xs:string" nillable="true" c:Name="Iteration" c:Calculation="=IF(AND(HOUR(NOW())>=0,HOUR(NOW())<8), "ONE",
 IF(AND(HOUR(NOW())>=8,HOUR(NOW())<16), "TWO", "THREE"))" dfm:SimpleFieldType="CalculatedField" />
<xs:element name="NewSourceName1" type="xs:string" nillable="true" c:Name="Dashboard_Instance_Name" c:Calculation="=STATIC("MyTextHere")" dfm:SimpleFieldType="StaticText" />
<xs:element name="NewSourceName2" type="xs:string" nillable="true" c:Name="Date_Created" c:Calculation="=DATEFORMAT(TODAY(), "MM/dd/yyyy")" dfm:SimpleFieldType="CalculatedField" />
<xs:element name="NewSourceName3" type="xs:string" nillable="true" c:Name="Created_By" c:Calculation="=STATIC("Local Dashboard")" dfm:SimpleFieldType="StaticText" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</Schemas>
</Schema>
</Source>
</DataTransfer>
</Action>');
DECLARE #CoolVariableName varchar(30) = 'Whatever Value';
UPDATE #tbl
SET configuration_xml.modify('replace value of (//xs:element[#name="NewSourceName1"]/#*:Calculation)[1] with sql:variable("#CoolVariableName")');
SELECT * FROM #tbl;
I am receiving "Schema validation failed" from the server when calling my WCF service.
The error message returned states that the validation is failing on an element of type "date"
Response from server
<s:Fault>
<s:Code>
<s:Value>s:VCE1001</s:Value>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-GB">Schema validation failed.</s:Text>
</s:Reason>
<s:Detail>
<FaultDetails xmlns="http://schemas.datacontract.org/2004/07/project.Error_Handler" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Information>Element Name: ExampleDateElement, Line Number: 0, Line Position: 0</Information>
</FaultDetails>
</s:Detail>
</s:Fault>
Request to server
<Message xsi:type="q1:Example_OutboundMessage" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:q1="project_messages">
<q1:Element1>123456789123</q1:Element1>
<q1:Element2>
<Nested1>string123</Nested1>
<Nested2>string123</Nested2>
</q1:Element2>
<q1:Element3>2017-03-28</q1:Element3>
<q1:ExampleDateElement>2017-03-29</q1:ExampleDateElement>
<q1:Element4>64bc7ab8-b418-4d23-8d31-47312e838c92</q1:Element4>
</Message>
Schema
<xs:complexType name="Example_OutboundMessage">
<xs:complexContent>
<xs:extension base="vct:OutboundMessage_Type">
<xs:sequence>
<xs:element name="Element1" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Info here
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="12" />
<xs:maxLength value="13" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Element2" minOccurs="1" maxOccurs="1" type="vct:Example_Type">
<xs:annotation>
<xs:documentation>
Info here.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Element3" minOccurs="1" maxOccurs="1" type="xs:date">
<xs:annotation>
<xs:documentation>
Info here.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="ExampleDateElement" minOccurs="1" maxOccurs="1" type="xs:date">
<xs:annotation>
<xs:documentation>
Info here.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Element4" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>
Info here.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:minLength value="1" />
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
Cannot see anything wrong with the date that is passed in for "ExampleDateElement".
Also the schema seems to pass for the date element above, even though the date formats are the same. It even fails if the dates are exactly the same.
Under Microsoft BizTalk 2009, we want to test the ReceivePipeline(which has a Flat file disassembler) with the built-in TestableReceivePipeline class.
It works fine if we use one single Schema, but it throws an error (System.Xml.Schema.XmlSchemaException: The 'ABC' element is not declared.) when we try to use a schema(Schema1) which has an imported schema(Schema2) inside.
Why I'm getting this error?
code for testing pipeline:
StringCollection documents = new StringCollection();
documents.Add(#"c:\Test.dat");
StringCollection parts = new StringCollection();
Dictionary<string, string> schemas = new Dictionary<string, string>();
schemas.Add("MyCompany.Schema2", #"C:\Schema2.xsd");
schemas.Add("MyCompany.Schema1", #"C:\Schema1.xsd");
Microsoft.BizTalk.TestTools.Pipeline.TestableReceivePipeline pipeline = new MyReceivePipeline();
pipeline.TestPipeline(documents, parts, schemas);
Schema1.xsd source:
<xs:import schemaLocation=".\Schema2.xsd" namespace="http://MyCompany.Schema2" />
<xs:element name="Schema1">
<xs:complexType>
<xs:sequence>
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element name="ClientRef" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element ref="ns1:Data" />
<xs:element name="Tail">
<xs:complexType>
<xs:sequence>
<xs:element name="RecordCount" type="xs:int">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
Schema2.xsd source:
<xs:element name="Data">
<xs:complexType>
<xs:sequence>
<xs:element name="FirstName" type="xs:string" nillable="true">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" wrap_char_type="default" sequence_number="2" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="Surname" type="xs:string" nillable="true">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="left" sequence_number="3" wrap_char_type="default" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
AFAIK this is currently not supported in BizTalk 2009.
i have a problem that I want to resolve in a best possible way. The thing is that I made a schema that looks like this:
print("
<xs:complexType name="rentACarT">
<xs:sequence>
<xs:element name="poslovnice" type="poslovniceT" />
<xs:element name="korisnici" type="korisniciT" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="poslovniceT">
<xs:sequence>
<xs:element name="poslovnica" type="poslovnicaT" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="poslovnicaT">
<xs:sequence>
<xs:element name="naziv" type="xs:string" />
<xs:element name="adresa" type="adresaT" />
<xs:element name="grad" type="gradT" />
<xs:element name="vozila" type="vozilaT" />
<xs:element name="zaposlenici" type="zaposleniciT" />
<xs:element name="posudbe" type="posudbeT" />
</xs:sequence>
<xs:attribute name="id" type="xs:int" />
</xs:complexType>
<xs:complexType name="vozilaT">
<xs:sequence>
<xs:element name="vozilo" type="voziloT" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="zaposleniciT">
<xs:sequence>
<xs:element name="zaposlenik" type="zaposlenikT" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="korisniciT">
<xs:sequence>
<xs:element name="korisnik" type="korisnikT" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="posudbeT">
<xs:sequence>
<xs:element name="posudba" type="posudbaT" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="posudbaT">
<xs:sequence>
<xs:element name="idVozila" type="xs:int" />
<xs:element name="jmbgZaposlenika" type="jmbgT" />
<xs:element name="jmbgKorisnika" type="jmbgT" />
<xs:element name="datumPosudbe" type="xs:date" />
<xs:element name="ugovoreniDatumPovratka" type="xs:date" />
<xs:element name="stvarniDatumPovratka" type="xs:date" />
</xs:sequence>
<xs:attribute name="id" type="xs:integer" />
</xs:complexType>
<xs:complexType name="voziloT">
<xs:sequence>
<xs:element name="registracija" type="xs:string" />
<xs:element name="modelVozila" type="modelVozilaT" />
<xs:element name="godinaProizvodnje" type="godinaT" />
<xs:element name="cijenaPosudbePoDanu" type="xs:double" />
</xs:sequence>
<xs:attribute name="id" type="xs:int" />
</xs:complexType>
<xs:complexType name="zaposlenikT">
<xs:sequence>
<xs:element name="ime" type="xs:string" />
<xs:element name="prezime" type="xs:string" />
<xs:element name="spol" type="spolT" />
<xs:element name="datumZaposlenja" type="xs:date" />
<xs:element name="grad" type="xs:double" />
</xs:sequence>
<xs:attribute name="jmbg" type="jmbgT" />
</xs:complexType>
<xs:complexType name="korisnikT">
<xs:sequence>
<xs:element name="ime" type="xs:string" />
<xs:element name="prezime" type="xs:string" />
<xs:element name="spol" type="spolT" />
<xs:element name="adresa" type="adresaT" />
<xs:element name="grad" type="gradT" />
<xs:element name="status" type="statusKorisnikaT" />
</xs:sequence>
<xs:attribute name="jmbg" type="jmbgT" />
</xs:complexType>
<xs:complexType name="modelVozilaT">
<xs:sequence>
<xs:element name="tipVozila" type="tipVozilaT" />
<xs:element name="marka" type="xs:string" />
<xs:element name="model" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:simpleType name="tipVozilaT">
<xs:restriction base="xs:string">
<xs:enumeration value="auto" />
<xs:enumeration value="kombi" />
<xs:enumeration value="kamion" />
<xs:enumeration value="limuzina" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="godinaT">
<xs:restriction base="xs:int">
<xs:minInclusive value="1980" />
<xs:maxInclusive value="2050" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="jmbgT">
<xs:restriction base="xs:string">
<xs:pattern value="([0-9]){13}" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="spolT">
<xs:restriction base="xs:string">
<xs:enumeration value="m" />
<xs:enumeration value="f" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="statusKorisnikaT">
<xs:restriction base="xs:string">
<xs:enumeration value="stalni" />
<xs:enumeration value="novi" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="gradT">
<xs:sequence>
<xs:element name="postanskiBroj" type="xs:int" />
<xs:element name="naziv" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="adresaT">
<xs:sequence>
<xs:element name="ulica" type="xs:string" />
<xs:element name="kucniBroj" type="xs:int" />
</xs:sequence>
</xs:complexType>
");
Now, I don't want to put the entire xml document into one row. At least I think it is bad.
I would like to move "poslovnice"(contains multiple "poslovnica") in one table and "vozila" in other...
And is it better to hold each "poslovnica" in one row in table Poslovnica or have all elements "poslovnica" in one row?
And what about uniqueness since SQL Server doesn't support unique xml data type, I've seen that you can use triggers and functions, is there any other way?
Also, if I break the xml document, and have poslovnice in one table and their vozila in other, how to achieve to show that vozilo belongs to poslovnica, should I put id of poslovnica in each vozilo in xml or should I reference rows in SQL Server?
Or would you reccomend some other database?
Thank you very much, I am sorry if I wasn't clear enough :( !
Miroslav
well first you have to ask yourself why do you want it stored in XML in the db?
this seems like a perfect scenario to have tables Poslovnica, Vozilo and Zaposlenik and have intermediate tables that hold info on which employee rented what car where.
i don't see a reason to store this in xml at all.