简体   繁体   中英

Skip Header when converting BizTalk CSV to XML (After Generating Schema)

I used the flat file wizard to generate my schema, all is working fine, except I don't want the header in my XML.

Seems like I should be able to change one property in the schema and make it work, but I've been looking and can't find the right property (and is it on the schema, the root element, or the repeating group?) Looking for something like "CSVContainsHeader" true/false.

The first part of my schema looks like this:

- <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" 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="inventory_items" /> 
  </xs:appinfo>
  </xs:annotation>
- <xs:element name="inventory_items">
- <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 maxOccurs="unbounded" name="item">
- <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>

There's no way to have the flat file disassembler completely ignore the header content, but there are a few ways you can achieve your goal.

The easiest is to just make a record or element in your schema be the 'Header' element, and ignore it in your mapping. This is probably the most straightforward approach, even if it's annoying to have a record/field element/attribute in there that you don't use.

You could also create a separate header schema, and then set the "Preserve Header" property to false on the flat file disassembler. This is really just a more involved way of doing the same as above, but the schema you work with won't show the header data while you're mapping.

Finally, you could create a schema for an instance of the document that has no header, and then write a custom pipeline component to remove the header line from the incoming message in the decode stage. While this would technically work, I can't say I'd recommend introducing this additional dependency to achieve it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM