XSDファイルに対するデータフローの検証 - 7.3

XML validation

Version
7.3
Language
日本語
Product
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
Module
Talend Studio
Content
ジョブデザインと開発 > サードパーティーシステム > XMLコンポーネント > XML検証コンポーネント
データガバナンス > サードパーティーシステム > XMLコンポーネント > XML検証コンポーネント
データクオリティとプレパレーション > サードパーティーシステム > XMLコンポーネント > XML検証コンポーネント
Last publication date
2024-02-22

このシナリオでは、XSD参照ファイルShipOrder.xsdに対して入力ファイルShipOrder.csvのXMLカラムを検証し、有効な行を区切りファイルShipOrder_Valid.csvに、無効な行とエラーメッセージを区切りファイルShipOrder_Invalid.csvに出力するジョブについて説明します。XMLファイルを検証する同様のユースケースについては、XMLファイルの検証をご覧ください。

Talendでサポートされているテクノロジーの詳細は、Talendコンポーネントをご覧ください。

検証されるXMLカラムShipOrderを含む入力ファイルShipOrder.csvの内容は次のとおりです。

ID;ShipOrder
000001;<shiporder orderid="000001"><orderperson>George Bush</orderperson><shipto><name>John Adams</name><address>Oxford Street</address></shipto><item><title>Empire Burlesque</title><note>Special Edition</note><quantity>1</quantity><price>10.90</price></item></shiporder>
000002;<shiporder orderid="000002"><orderperson>Judy Liu</orderperson><shipto><name>Jack Liu</name><address>Wangfujing Street</address></shipto><item><title>Hide Your Heart</title><quantity>1</quantity><price>9.90</price></item></shiporder>
000003;<shiporder><orderperson>Peter Qian</orderperson><shipto><name>Thomas Wang</name><address>Wangfujing Street</address></shipto><item><title>The Power of Habit</title><quantity>1</quantity><price>8.99</price></item></shiporder>

XSD参照ファイルShipOrder.xsdの内容は次のとおりです。

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="shiporder">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="orderperson" type="xs:string"/>
    <xs:element name="shipto">
     <xs:complexType>
      <xs:sequence>
       <xs:element name="name" type="xs:string"/>
       <xs:element name="address" type="xs:string"/>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
    <xs:element name="item" maxOccurs="unbounded">
     <xs:complexType>
      <xs:sequence>
       <xs:element name="title" type="xs:string"/>
       <xs:element name="note" type="xs:string" minOccurs="0"/>
       <xs:element name="quantity" type="xs:positiveInteger"/>
       <xs:element name="price" type="xs:decimal"/>
      </xs:sequence>
     </xs:complexType>
    </xs:element>
   </xs:sequence>
   <xs:attribute name="orderid" type="xs:string" use="required"/>
  </xs:complexType>
 </xs:element>
</xs:schema>