Biztalk平面文件即使在空数据时也会生成CRLF [英] Biztalk flat file produces CRLF even when empty data
本文介绍了Biztalk平面文件即使在空数据时也会生成CRLF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个xsd因为来自xml映射的平面文件,例如:
<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://mynamespace" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://mynamespace" 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="File" />
</xs:appinfo>
</xs:annotation>
<xs:element name="File">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" 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 minOccurs="0" maxOccurs="unbounded" name="TransactionDate">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" repeating_delimiter_type="hex" repeating_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:element minOccurs="0" maxOccurs="unbounded" name="Items">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" repeating_delimiter_type="hex" repeating_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:element minOccurs="0" maxOccurs="unbounded" name="Item">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="positional" 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>
<!-- My elements here -->
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="1" default="EOF" name="EOF" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left" pos_offset="0" pos_length="3" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
问题是当xml有数据时,我们得到了正确的结果,如:
line1
line2
line3
EOF
但是当我们没有数据时(xml只有命名空间)
<ns:SAPFile Channel="Eziemall" xmlns:ns="http://mynamespace" />
然后平面文件是:
then the flat file is:
CRLF (for easy reading)
EOF
如何从平面文件中获取CRLF,我只想在第一行使用EOF。
How can I get rig of CRLF from my flat file, I just want EOF at the first line.
推荐答案
我认为这是
Stack Overflow 问题是你的吗?
如果是这样,根据Stack Overflow上的答案,问题不在架构中,而是在地图中并且您需要添加一个指向TransactionDate节点的链接,以便在没有数据时对其进行抑制。
If so, as per the Answer on Stack Overflow, the issue is not in the schema, but in the map and you need to add a link to the TransactionDate node so that it suppresses it when there is no data.
这篇关于Biztalk平面文件即使在空数据时也会生成CRLF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文