2017-09-27 5 views
0

이처럼 구분 된 파일이 있습니다.BizTalk 스키마 - 필드 요소 태그 이름을 머리글과 동일하게 지정하십시오.

Name;ID;Type 
ABC;1;Blue 
PQR;2;Black 

위의 데이터에 대한 플랫 파일 스키마를 만들려고합니다. 그러나 XML 태그를 헤더와 일치시키는 방법을 찾을 수 없습니다.

가 생성되는 XML 파일이 내가 원하는 무엇

<Root> 
<Root_Child1>Root_Child</Root_Child1> 
<Root_Child2>Root_Child</Root_Child2> 
<Root_Child3>Root_Child</Root_Child3> 
</Root> 

것은 내가 55 헤더가이

<Root> 
<Name>Root_Child</Name> 
<ID>Root_Child</ID> 
<Type>Root_Child</Type> 
</Root> 

같은 것입니다 수동으로 XSD 파일을 변경하는 지루한 일이다. 이것을 달성하는 쉬운 방법이 있습니까?

+0

아니오, 당신은 단지를 업데이트해야, 플랫 파일 마법사 불행히도 헤더 행의 이름을 고르는 영리한 사람은 없습니다. 플랫 파일 마법사에서 파일의 이름을 바꿀 수는 있지만 훨씬 지루합니다. – Dijkgraaf

답변

-1

플랫 파일 스키마에서만 이것이 가능하지 않다고 생각합니다. 지도를 구현하고 해당 태그를 만들고 값을 할당해야합니다. 이 사용자 정의 XSLT와지도 구현

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://BizTalkMassCopy.FlatFileSchema8" targetNamespace="http://BizTalkMassCopy.FlatFileSchema8" 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="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="Headers"> 
      <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="Headers_Child1" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element name="Headers_Child2" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element name="Headers_Child3" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="3" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <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="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="Item_Child1" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element name="Item_Child2" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element name="Item_Child3" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="3" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

: 그리고이 플랫 파일 스키마와 예를 들어

,

<?xml version="1.0" encoding="UTF-16"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var s0" version="1.0" xmlns:s0="http://BizTalkMassCopy.FlatFileSchema8" xmlns:ns0="http://BizTalkMassCopy.Schema2"> 
    <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" /> 
    <xsl:template match="/"> 
    <xsl:apply-templates select="/s0:Root" /> 
    </xsl:template> 
    <xsl:template match="/s0:Root"> 
    <xsl:variable name="var:v1" select="Headers/Headers_Child1/text()" /> 
    <xsl:variable name="var:v2" select="Headers/Headers_Child2/text()" /> 
    <xsl:variable name="var:v3" select="Headers/Headers_Child3/text()" /> 

    <ns0:Root> 
     <xsl:for-each select="Item"> 
     <xsl:element name="Items"> 
      <xsl:element name="{$var:v1}"> 
      <xsl:value-of select="Item_Child1" /> 
      </xsl:element> 
      <xsl:element name="{$var:v2}"> 
      <xsl:value-of select="Item_Child2" /> 
      </xsl:element> 
      <xsl:element name="{$var:v3}"> 
      <xsl:value-of select="Item_Child3" /> 
      </xsl:element> 
     </xsl:element> 
     </xsl:for-each> 
    </ns0:Root> 
    </xsl:template> 
</xsl:stylesheet> 
+0

플랫 파일 스키마의 요소의 이름을 아무런 문제없이 바꿀 수 있으며 실제로 그렇게하는 것이 좋습니다. – Dijkgraaf

+0

질문은 그가 필드를 많이 가지고 있기 때문에 자동으로 수행 할 수 있는지에 대한 질문이었고, 응답에서 원하는 태그를 생성하기 위해 맵을 사용하여 솔루션을 제공했습니다. – felixmondelo

+0

출력은 XSD 파일입니까? XSLT가 XSD 파일을 가져 와서 요소의 이름을 바꿀 수 있고 처음 문장을 삭제하거나 수정하면 (올바르지 않은 경우) 올바른 답이됩니다. – Dijkgraaf