Csv 如何将2个字符设置为换行字符?

Csv 如何将2个字符设置为换行字符?,csv,xsd,biztalk,Csv,Xsd,Biztalk,如何为csv文件创建BizTalk平面文件XSD架构,该架构使用两个引号(“”)作为换行符,并使用相同的单个字符(“”)换行每一行数据(标题除外) 例如: header1,header2,header3,header4 "text1,""68,12"",""32,11"",""69,38""" "text2,,""13,71"",""123,56""" "text3,""12,75"",,""732,87""" "text4,""147,14"",""65,43""," 您可以使用平面文件架构

如何为csv文件创建BizTalk平面文件XSD架构,该架构使用两个引号(“”)作为换行符,并使用相同的单个字符(“”)换行每一行数据(标题除外)

例如:

header1,header2,header3,header4
"text1,""68,12"",""32,11"",""69,38"""
"text2,,""13,71"",""123,56"""
"text3,""12,75"",,""732,87"""
"text4,""147,14"",""65,43"","

您可以使用平面文件架构向导

1) 按分隔符符号

2) CR-LF

3) 记录标题并重复记录第一项]

4) 按分隔符符号“,”


这不是一个有效的CSV结构*,因此您将很难100%正确地使用它

*因为有些逗号在引号内,而逗号集之间没有引号

下面是我能创建的能够成功解析的最接近的模式,我将引号视为行的分隔符

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.46099894" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.46099894" 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="Root_Child1">
          <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>
          <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="Root_Child1_Child1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child2" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child3" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child4" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="4" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" name="Root_Child2">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="&quot;" child_order="infix" 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 maxOccurs="unbounded" name="Root_Child2_Child1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

你到底被困在哪里?你的问题太宽泛了,除非你对其进行实质性的改进,否则将被关闭。@kjhughes他基本上被困在了这里,因为你不能在BizTalk平面文件架构中为一个换行符指定多个字符来解析该有效负载,尽管这对于不了解BizTalk的人来说并不明显,但我已经编辑了Dijkgraaf:谢谢你改进了这个问题。我根据你的建议投票重新打开了。标题没有任何问题。如果你试图创建xsd方案并设置换行符,你将面临问题。换行符必须是字符,而不是字符串。你的问题也是t每个记录都有一个开始“字符和一个结束”字符。可能需要分两个步骤来完成,首先为示例生成一个中间XML:header1…text1,“68,12”,“32,11”,“69,38" ... 然后在地图中生成正确的XML。谢谢。我已经分两步成功地完成了这项工作,正如您所建议的,该模式得到了正确的数字,但结果不正确。您必须更具体地说明哪些不正确,否则我们无法帮助您。正如我所说,您的负载没有正确格式化,除非您编写一个自定义管道组件来预解析它,否则您将无法单独使用模式来完成它。好的,谢谢您的帮助。我的意思是结果必须是这样的(对于第一行):
text1
68,12
32,11
69,38
@Vitaliy你能把创建这些文件的人推回去,让他们正确地格式化为CSV文件吗?
<Root xmlns="http://Scratch.46099894">
    <Root_Child1 xmlns="">
        <Root_Child1_Child1>header1</Root_Child1_Child1>
        <Root_Child1_Child2>header2</Root_Child1_Child2>
        <Root_Child1_Child3>header3</Root_Child1_Child3>
        <Root_Child1_Child4>header4</Root_Child1_Child4>
    </Root_Child1>
    <Root_Child2 xmlns="">
        <Root_Child2_Child1/>
        <Root_Child2_Child1>text1,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>68,12</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>32,11</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>69,38</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1/>
        <Root_Child2_Child1/>
    </Root_Child2>
    <Root_Child2 xmlns="">
        <Root_Child2_Child1/>
        <Root_Child2_Child1>text2,,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>13,71</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>123,56</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1/>
        <Root_Child2_Child1/>
    </Root_Child2>
    <Root_Child2 xmlns="">
        <Root_Child2_Child1/>
        <Root_Child2_Child1>text3,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>12,75</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>,,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>732,87</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1/>
        <Root_Child2_Child1/>
    </Root_Child2>
    <Root_Child2 xmlns="">
        <Root_Child2_Child1/>
        <Root_Child2_Child1>text4,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>147,14</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>,</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>65,43</Root_Child2_Child1>
        <Root_Child2_Child1/>
        <Root_Child2_Child1>,</Root_Child2_Child1>
        <Root_Child2_Child1/>
    </Root_Child2>
</Root>
header1,header2,header3,header4
"text1","68,12","32,11","69,38"
"text2","","13,71","123,56"
"text3","12,75","","732,87"
"text4","147,14","65,43",""