簡體   English   中英

如何在 BizTalk 中使用條件將 map 屬性列表添加到基於列的模式?

[英]How to map list of attributes to column-based schema with condition in BizTalk?

我有兩個模式,一個用於輸入 xml 文件,第二個用於數據庫表。

請在下面查看上述模式的源數據:

<?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>

上面的文件是輸入的xml文件,是列表形式的。

請在下面查看表創建腳本,它是 output,它是基於列格式的。

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

在此處輸入圖像描述

按照上面的SS。 我想根據目標模式中的域條件添加分類值,以便哪個功能是更好的選擇以及如何使用 function?

請在下面查看輸入模式:

<?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> 

請在下面查看 output 模式:

 <?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>

我們需要使用 Equal 和 Value 映射(奉承)function 如下 SS:

在此處輸入圖像描述

在相同的功能上,我們需要通過域來檢查條件,如下所示:

在此處輸入圖像描述

在值映射(討人喜歡的)函數中,我們需要將相等的函數值作為第一個輸入傳遞,將分類節點作為第二個輸入傳遞,並將 map 傳遞給目標模式節點。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM