Pc 861 XML Guide

download Pc 861 XML Guide

of 152

Transcript of Pc 861 XML Guide

  • 7/31/2019 Pc 861 XML Guide

    1/152

    Informatica PowerCenter(Version 8.6.1)

    XML Guide

  • 7/31/2019 Pc 861 XML Guide

    2/152

    Informatica PowerCenter XML Guide

    Version 8.6.1February 2009

    Copyright (c) 19982009 Informatica Corporation. All rights reserved.

    This software and documentation contain proprietary information of Informatica Corporation and are provided under a license agreement containing restrictions on use and disclosure and are alsprotected by copyright law. Reverse engineering of the software is prohibited. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying,recording or otherwise) without prior consent of Informatica Corporation. This Software may be protected by U.S. and/or international Patents and other Patents Pending.

    Use, duplication, or disclosure of the Software by the U.S. Government is subject to the restrictions set forth in the applicable software license agreement and as provided in DFARS 227.7202-1(a227.7702-3(a) (1995), DFARS 252.227-7013(c)(1)(ii) (OCT 1988), FAR 12.212(a) (1995), FAR 52.227-19, or FAR 52.227-14 (ALT III), as applicable.

    The information in this product or documentation is subject to change without notice. If you find any problems in this product or documentation, please report them to us in writing.

    Informatica, PowerCenter, PowerCenterRT, PowerCenter Connect, PowerCenter Data Analyzer, PowerExchange, PowerMart, Metadata Manager, Informatica Data Quality, Informatica DataExplorer, Informatica B2B Data Exchange and Informatica On Demand are trademarks or registered trademarks of Informatica Corporation in the United States and in jurisdictions throughout tworld. All other company and product names may be trade names or trademarks of their respective owners.

    Portions of this software and/or documentation are subject to copyright held by third parties, including without limitation: Copyright DataDirect Technologies. All rights reserved. Copyright 2Adobe Systems Incorporated. All rights reserved. Copyright Sun Microsystems. All rights reserved. Copyright RSA Security Inc. All Rights Reserved. Copyright Ordinal Technology Corprights reserved. Copyright Platon Data Technology GmbH. All rights reserved. Copyright Melissa Data Corporation. All rights reserved. Copyright Aandacht c.v. All rights reserved. Copy1996-2007 ComponentSource. All rights reserved. Copyright Genivia, Inc. All rights reserved. Copyright 2007 Isomorphic Software. All rights reserved. Copyright Meta Integration TechnolInc. All rights reserved. Copyright Microsoft. All rights reserved. Copyright Oracle. All rights reserved. Copyright AKS-Labs. All rights reserved. Copyright Quovadx, Inc. All rights reseCopyright SAP. All rights reserved. Copyright 2003, 2007 Instantiations, Inc. All rights reserved. Copyright Intalio. All rights r eserved.

    This product includes software developed by the Apache Software Foundation (http://www.apache.org/), software copyright 2004-2005 Open Symphony (all r ights reserved) and other software wis licensed under the Apache License, Version 2.0 (the License). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agrein writing, software distributed under the License i s distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licensthe specific language governing permissions and limitations under the License.

    This product includes software which was developed by Mozilla (http://www.mozilla.org/), software copyright The JBoss Group, LLC, all rights reserved; software copyright, Red Hat MiddlewareLLC, all rights reserved; software copyright 1999-2006 by Bruno Lowagie and Paulo Soares and other software which is licensed under the GNU Lesser General Public License Agreement, whichbe found at http://www.gnu.org/licenses/lgpl.html. The materials are provided free of charge by Informatica, as-is, without warranty of any kind, either express or implied, including but not limto the implied warranties of merchantability and fitness for a particular purpose.

    The product includes ACE(TM) and TAO(TM) software copyrighted by Douglas C. S chmidt and his research group at Washington University, University of California, Irvine, and VanderbiltUniversity, Copyright (c) 1993-2006, all rights reserved.

    This product includes software copyright (c) 2003-2007, Terence Parr. All rights reserved. Your right to use such materials is set for th in the license which may be found at http://www.antlr.org/license.html. The materials are provided free of charge by Informatica, as-is, without warranty of any kind, either express or implied, including but not limited to the implied warranties ofmerchantability and fitness for a particular purpose.

    This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (copyright The OpenSSL Project. All Rights Reserved) and redistribution of this software is subto terms available at http://www.openssl.org.

    This product includes Curl software which is Copyright 1996-2007, Daniel Stenberg, . All Rights Reserved. Permissions and limitations regarding this software are subject to termavailable at http://curl.haxx.se/docs/copyright.html. Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the abovecopyright notice and this permission notice appear in all copies.

    The product includes software copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. Permissions and limitations regarding this software are subject to terms available at http://www.dom4license.html.

    The product includes software copyright (c) 2004-2007, The Dojo Foundation. All Rights Reserved. Permissions and limitations regarding thi s software are subject to terms available at http://svn.dojotoolkit.org/dojo/trunk/LICENSE.

    This product includes ICU software which is copyright (c) 1995-2003 International Business Machines Corporation and others. All rights reserved. Permissions and limitations regarding this software subject to terms available at http://www-306.ibm.com/software/globalization/icu/license.jsp

    This product includes software copyright (C) 1996-2006 Per Bothner. All rights reserved. Your right to use such materials is set forth in the license which may be found at http://www.gnu.org/softkawa/Software-License.html.

    This product includes OSSP UUID software which is Copyright (c) 2002 Ralf S. Engelschall, Copyright (c) 2002 The OSSP Project Copyright (c) 2002 Cable & Wireless Deutschland. Permissioand limitations regarding this software are subject to terms available at http://www.opensource.org/licenses/mit-license.php.

    This product includes software developed by Boost (http://www.boost.org/) or under the Boost software license. Permissions and limitations regarding this software are subject to terms available athttp://www.boost.org/LICENSE_1_0.txt.

    This product includes software copyright 1997-2007 University of Cambridge. Permissions and limitations r egarding this software are subject to terms available at http://www.pcre.org/license.t

    This product includes software copyright (c) 2007 The Eclipse Foundation. All Rights Reserved. Permissions and limitations regarding this software are subject to terms available at http://www.eclipse.org/org/documents/epl-v10.php.

    The product includes the zlib library copyright (c) 1995-2005 Jean-loup Gailly and Mark Adler.

    This product includes software licensed under the terms at http://www.tcl.tk/software/tcltk/license.html.

    This product includes software licensed under the terms at http://www.bosrup.com/web/overlib/?License.

    This product includes software licensed under the terms at http://www.stlport.org/doc/license.html.

    This product includes software licensed under the Academic Free License (http://www.opensource.org/licenses/afl-3.0.php). This product includes software copyright 2003-2006 Joe WaInes, 22007 XStream Committers. All rights reserved. Permissions and limitations regarding this software are subject to terms available at http://xstream.codehaus.org/license.html. This product includesoftware developed by the Indiana University Extreme! Lab. For further information please visit http ://www.extreme.indiana.edu/.

    This Software is protected by U.S. Patent Numbers 6,208,990; 6,044,374; 6,014,670; 6,032,158; 5,794,246; 6,339,775; 6,850,947; 6,895,471; 7,254,590 and other U.S. Patents Pending.

    DISCLAIMER: Informatica Corporation provides this documentation as is without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of non-infringement, merchantability, or use for a particular purpose. Informatica Corporation does not war rant that this software or documentation is error free. The information provided in this softwadocumentation may include technical inaccuracies or typographical errors. The information in this software and documentation is subject to change at any time without notice.

    Part Number: PC-XML-86100-0002

  • 7/31/2019 Pc 861 XML Guide

    3/152

    Table of Contents iii

    Table of Contents

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    Informatica Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    Informatica Customer Portal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    Informatica Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ix

    Informatica Web Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixInformatica How-To Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

    Informatica Knowledge Base . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

    Informatica Global Customer Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

    Chapter 1: XML Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    XML Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    Validating XML Files with a DTD or Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    DTD Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    DTD Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5DTD Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    XML Schem a File s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Types of XML Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Namespace. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

    Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Cardinality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Absolute Cardinali ty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Relative Cardinality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    Simple and Complex XML Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Simple Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    Complex Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Any Type Eleme nts and Attri butes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    anyType Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    anySimpleType Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    ANY Content Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    AnyAt tr ibu te Attr ibutes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    Component Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    Element and Attribute Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    Substitution Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    XML Path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    Code Pages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    Chapter 2: Using XML with PowerCenter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    Importing XML Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    Importing Metadata from an XML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

  • 7/31/2019 Pc 861 XML Guide

    4/152

    iv Table of Contents

    Importing Metadata from a DTD File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Importing Metadata from an XML Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    Creating Metadata from Relational Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    Creating Metadata from Flat Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    Understanding XML Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

    Creating Custom XML Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Rules and Guidelines for XML Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Understanding Hierarchical Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Normalized Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    Denormalized Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    Understanding Entity Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Rules and Guidelines for Entity Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    Type 1 Entity Relationship Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

    Type II Entity Relationship Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    Using Substitution Groups in an XML Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    Working with Circular Referen ces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    Understanding View Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    Using XPath Query Predicates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    Rules and Guidelines for Using View Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    Pivoting Columns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    Using Multiple-Level Pivots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

    Chapter 3: Working with XML Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    Importing an XML Source Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    Multi-line Attributes Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Working with XML Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Importing Part of an XML Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    Generating Entity Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    Generating Hierarchy Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

    Creating Custom XMLViews . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    Selecting Root Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    Reducing MetadataExplosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    Synchronizing XMLDefinitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    Editing XML Source Definition Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Creating XML Definitions from Repository Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    Chapter 4: Using the XML Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    XML Naviga tor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    XML Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Columns Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Creating and Editing Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Creating an XML View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

  • 7/31/2019 Pc 861 XML Guide

    5/152

    Table of Contents v

    Add ing Columns to a View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    Deleting Columns from a View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    Expanding a Complex Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

    Importing anyType Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Applying Con tentto anyAttribute or ANY Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    Using anySimpleType in the XML Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Add ing a Pass-Throu gh Port . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Add ing a FileName Column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    Creating anXPath Query Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    Querying the Value of an Element of Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    Testing for Elements or Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    XPat h Query Predicate Rules and Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66

    Steps for Creating an XPath Query Predicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    Maintaining View Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    Creating a Relationship Between Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    Creating a Type Relationship . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    Re-Creating Entity Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    Viewing Schema Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Updating a Namespace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Navigating to Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

    Searching for Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

    Viewing a Simple or Complex Type Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    Viewing XML Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    ValidatingXML Defin iti ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Setting XML ViewOptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    Generating All Hierarchy Foreign Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Generating Rows in Circular Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    Generating Hierarchy Relationship Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

    Setting the Force Row Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Generating Rows for Views in Type Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

    Chapter 5: Working with XML Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    Importing an XML Target Definition from an XML File . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    Creating a Target from an XML Source Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    Editing XML Target Definition Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    Validating XML Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    Hierarchy Relationship Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    Type Relationship Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    Inheritance Validation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    Using an XML Target in a Mapping. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

    Act ive Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    Selecting a RootElement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    Connecting Target Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    Connecting Abstract Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

  • 7/31/2019 Pc 861 XML Guide

    6/152

    vi Table of Contents

    Flushing XML Data to Targets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    Naming XML Files Dynamically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

    Chapter 6: XML Source Quali fier Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Adding an XML Source Quali fier to a Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

    Creating an XML Source Qualifier Transformation by Default . . . . . . . . . . . . . . . . . . . . 96Creating an XML Source Qualifier Transformation Manually . . . . . . . . . . . . . . . . . . . . . 96

    Editing an XML Source Qualifier Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Setting Sequence Numbers for Generated Keys. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    Using the XML Source Qualifier in a Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99

    XML Source Qualifier Transformation Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

    Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102

    Chapter 7: Midstream XML Transformat ions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    XML Pars er Trans formation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Streaming XML to the XML Parser Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

    XML Decim al Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

    XML Gen erator Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

    Creating a Midstream XML Transformation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

    Synchronizing a Midstream XML Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    Editing Midstream XML Transformation Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    Properties Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

    Midstream XML Parser Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    Midstream XML Generator Tab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    Generating Pass-Through Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    Appendix A: XML Datatype Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    XML and Transformati on Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    Unsupported Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    XML Date Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    Appendix B: XPath Query Functions Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    Function Quick Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120boolean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

    ceiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

    concat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

    contains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

    false . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

    floor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

    lang . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

  • 7/31/2019 Pc 861 XML Guide

    7/152

    Table of Contents vii

    normalize-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

    not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

    number . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

    round . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    starts-with . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    string-length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130

    substring-after . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

    substring-before . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132

    translate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

    true . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

  • 7/31/2019 Pc 861 XML Guide

    8/152

    viii Table of Contents

  • 7/31/2019 Pc 861 XML Guide

    9/152

    ix

    Preface

    The XML Guideis written for developers and software engineers responsible for working with XML in a datawarehouse environment. Before you use theXML Guide, ensure that you have a solid understanding of XMLconcepts, your operating systems, flat files, or mainframe system in your environment. Also, ensure that you arefamiliar with the interface requirements for your supporting applications.

    Informatica Resources

    Informatica Customer Portal

    As an Informatica customer, you can access the Informatica Customer Portal site at http://my.informatica.com.The site contains product information, user group information, newsletters, access to the Informatica customersupport case management system (ATLAS), the Informatica How-To Library, the Informatica Knowledge Base,Informatica Documentation Center, and access to the Informatica user community.

    Informatica Documentation

    The Informatica Documentation team takes every effort to create accurate, usable documentation. If you havequestions, comments, or ideas about this documentation, contact the Informatica Documentation teamthrough email at [email protected]. We will use your feedback to improve ourdocumentation. Let us know if we can contact you regarding your comments.

    The Documentation team updates documentation as needed. To get the latest documentation for your product,navigate to the Informatica Documentation Center from http://my.informatica.com.

    Informatica Web Site

    You can access the Informatica corporate web si te a t http://www.informatica.com. The site containsinformation about Informatica, its background, upcoming events, and sales offices. You will also find product

    and partner information. The s ervices area of the site includes important information about technical support,training and education, and implementation services.

    Informatica How-To Library

    As an Informatica customer, you can access the In formatica How-To Library at http://my.informatica.com.The How-To Library is a collection of resources to help you learn more about Informatica products andfeatures. It includes articles and interactive demonstrations that provide solutions to common problems,compare features and behaviors, and guide you through performing specific real-world tasks.

  • 7/31/2019 Pc 861 XML Guide

    10/152

    x Preface

    Informatica Knowledge Base

    As an Informatica customer, you can access the Informatica Knowledge Base at http://my.informatica.com. Usethe Knowledge Base to search for documented solutions to known technical issues about Informatica products.You can also find answers to frequently asked questions, technical white papers, and technica l tips.

    Informatica Global Customer Support

    There are many ways to access Informatica Global Customer Support. You can contact a Customer Support

    Center through telephone, email, or the WebSupport Service.

    Use the following email addresses to contact Informatica Global Customer Support:

    [email protected] for technical inquiries

    [email protected] for general customer service requests

    WebSupport requires a user name and password. You can request a user name and password at http://my.informatica.com.

    Use the following telephone numbers to contact Informatica Global Customer Support:

    No rt h Am er ic a / So ut h A mer ic a Eu ro pe / Mi dd le East / Af ri ca Asi a / Au st ral ia

    Informatica CorporationHeadquarters

    100 Cardinal Way

    Redwood City, California

    94063

    United States

    Toll Free

    +1 877 463 2435

    Standard Rate

    Brazil: +55 11 3523 7761Mexico: +52 55 1168 9763

    United States: +1 650 385 5800

    Informatica Software Ltd.6 Waltham Park

    Waltham Road, White Waltham

    Maidenhead, Berkshire

    SL6 3TN

    United Kingdom

    Toll Free

    00 800 4632 4357

    Standard Rate

    Belgium: +32 15 281 702France: +33 1 41 38 92 26

    Germany: +49 1805 702 702

    Netherlands: +31 306 022 797Spain and Portugal: +34 93 480 3760

    United Kingdom: +44 1628 511 445

    Informatica BusinessSolutions Pvt. Ltd.

    Diamond District

    Tower B, 3rd Floor

    150 Airport Road

    Bangalore 560 008

    India

    Toll Free

    Australia: 1 800 151 830

    Singapore: 001 800 46324357

    Standard Rate

    India: +91 80 4112 5738

  • 7/31/2019 Pc 861 XML Guide

    11/152

    1

    C H A P T E R 1

    XML Concepts

    This chapter includes the following topics:

    Overview, 1

    XML Files , 2

    DTD Files, 5

    XML Schema Files, 6 Types of XML Metadata, 7

    Cardinality, 9

    Simple and Complex XML Types, 11

    Any Type Elements and Attributes, 15

    Component Groups, 17

    XML Path, 19

    Code Pages, 20

    Overview

    Extensible Markup Language (XML) is a flexible way to create common information formats and to share theformats and data between applications and on the internet.

    You can import XML definitions into PowerCenter from the following file types:

    XML file. An XML file contains data and metadata. An XML file can reference a Document Type Definitionfile (DTD) or an XML schema definition (XSD) for validation.

    DTD file. A DTD file defines the element types, attributes, and entities in an XML file. A DTD fileprovides some constraints on the XML file structure but a DTD file does not contain any data.

    XML schema. An XML schema defines elements, attr ibutes, and type definitions. Schemas contain simpleand complex types. A simple type is an XML element or attribute that contains text. A complex type is anXML element that contains other elements and attributes.

    Schemas support element, attribute, and substitution groups that you can reference throughout a schema.Use substitution groups to substitute one element with another in an XML instance document. Schemas alsosupport inheritance for elements, complex types, and element and attribute groups.

  • 7/31/2019 Pc 861 XML Guide

    12/152

    2 Chapter 1: XML Concepts

    XML Files

    XML files contain tags that identi fy data in the XML file, but not the format of the data. The basic componentof an XML file is an element. An XML element includes an element start tag, element content, and element endtag. All XML files must have a root element defined by a single tag at the top and bottom of the file. The rootelement encloses all the other elements in the file.

    An XML file models a hierarchica l database. The position of an element in an XML hierarchy repre sents itsrelationships to other e lements. An element can contain child elements, and elements can inherit characteristics

    from other elements.

    For example, the following XML file describes a book:

    Fun with XML

    Understanding XMLUsing XML

    Using DTD Files

    Fun with Schemas

    Book is the root element and it contains the t itle and chapter elements. Book is the parent element of title andchapter, and chapter is the parent of heading. Title and chapter are sibling elements because they have the sameparent.

    An e lement can have attributes that provide additional information about the element. In the followingexample, the attribute graphic_type describes the content of picture:

    computer.gif

  • 7/31/2019 Pc 861 XML Guide

    13/152

    XML Files 3

    The following figure shows the structure, elements, and attributes in an XML file:

    An XML file has a hierarchical structure. An XML hierarchy includes the fol lowing elements:

    Child element. An element contained within another element.

    Enclosure element.An element that contains other elements but does not contain data . An enclosureelement can include other enclosure elements.

    Global element. An element that is a direct child of the root element. You can reference global elements

    throughout an XML schema. Leaf element. An element that does not contain other elements. A leaf element is the lowest level element in

    the XML hierarchy.

    Local element. An element that is nested in another element. You can reference local elements only withinthe context of the parent element.

    Multiple-occurring element. An element that occurs more than once within its parent element. Enclosureelements can be multiple-occurring elements.

    Parent chain. The succession of child-parent elements that traces the path from an element to the root.

    Parent element. An element that contains other elements.

    Single-occurring element. An element that occurs once within its parent.

    Element Data

    Attr ibute Value

    Element Tags

    Element Data

    Enclosure Element

    Root Element

    Attr ibute Tag

    Element Tags

  • 7/31/2019 Pc 861 XML Guide

    14/152

    4 Chapter 1: XML Concepts

    The following figure shows some elements in an XML hierarchy:

    Validating XML Files with a DTD or SchemaA val id XML file conforms to the structure of an associated DTD or s chema file .

    To reference the location and name of a DTD file, u se the DOCTYPE declaration in an XML file. TheDOCTYPE declaration also names the root element for the XML file.

    For example, the following XML file references the location of the note.dtd file:

    XML Data

    To reference a schema, use the schemaLocation declaration. The schemaLocation contains the location andname of a schema.

    The following XML file references the note.xsd schema in an external location:

    XML Data

    Leaf Element:

    Element Zip, along with all its

    sibling elements, is the

    lowest level element withinelement Address.

    Multiple-occurring Element:

    Element Sales Regionoccursmore than once within

    element Product.

    Single-occurring Element:

    Element PNameoccurs oncewithin element Product.

    Enclosure Element:

    Element Addressencloses

    elements StreetAddress, City,State, and Zip. Element

    Addressis also a Parent

    element.

    Parent Chain:Element YTDSalesis a child of element Sales, which is a child of element

    Product, which is a child of root element Store.All these elements belong in

    the same parent chain.

    Child Element:

    Element PNameis a child of

    Product, which is a child of

    Store.

    The DOCTYPE identifies anassociated DTD file.

    The encoding attribute

    identifies the code page.

  • 7/31/2019 Pc 861 XML Guide

    15/152

    DTD Files 5

    Unicode Encoding

    An XML file contains an encoding attr ibute that indicates the code page in the file . The most commonencodings are UTF-8 and UTF-16. UTF-8 represents a character with one to four bytes, depending on theUnicode symbol. UTF-16 represents a character as a 16-bit word.

    The following example shows a UTF-8 attribute in an XML file:

    XML Data

    DTD Files

    A Document Type Definition (DTD) file defines the element types and attributes in an XML file. A DTD filealso provides some constraints on the XML file structure. A DTD file does not contain any data or elementdatatypes.

    The following figure shows elements and attributes in a DTD file:

    DTD Elements

    In the DTD file, an element declaration defines an XML element. An element declaration has the followingsyntax:

    The DTD description defines the XML tag . The description (#PCDATA) specifies parsed character

    data. Parsed data is the text between the start tag and the end tag of an XML element. Parsed character data istext without child elements.

    The following example shows a DTD description of an element with two child elements:

    Brand and type are child elements of boat. Each child element can contain characters. In this example, brandand type can occur once inside the element boat. The following DTD description specifies that brand mustoccur one or more times for a boat:

    ElementElement List

    Attri bute

    Element Occurrence

    Attr ibute Value Op tion

    Attr ibute Name

  • 7/31/2019 Pc 861 XML Guide

    16/152

  • 7/31/2019 Pc 861 XML Guide

    17/152

    Types of XML Metadata 7

    The following figure shows XML schema components:

    RELATED TOPICS:

    Simple and Complex XML Types on page 11.

    Component Groups on page 17.

    Types of XML Metadata

    You can create PowerCenter XML defin itions from XML, DTD, or XML schema f iles. XML files provide dataand metadata. DTD files and XML schema files provide metadata.

    PowerCenter extracts the following types of metadata from XML, DTD, and XML schema files:

    Namespace. A collection of elements and attribute names identified by a Uniform Resource Identifier (URI)

    reference in an XML file. Namespace differentiates between elements that come from different sources. Formore information about namespace, see Namespace on page 8.

    Name. A tag that contains the name of an element or attribute. For more information about the name tag,see Name on page 8.

    Hierarchy. The position of an element in relationship to other elements in an XML file. For moreinformation, see Hierarchy on page 9.

    Cardinality. The number of times an element occurs in an XML file. For more information aboutcardinality, see Cardinality on page 9.

    Element Name

    Element List

    and

    Occurrence

    Att ribute Typeand Null

    Constraint

    Att ribute

    Element List and Datatype

    Element Data

    ElementDatatype

  • 7/31/2019 Pc 861 XML Guide

    18/152

    8 Chapter 1: XML Concepts

    Datatype. A classification of a data element, such as numeric, string, Boolean, or time. XML supportscustom datatypes and inheritance. For more information about datatypes, see Simple and Complex XMLTypes on page 11.

    Namespace

    A namespace contains a URI to identify schema location. A URI is a string of characters that identifies aninternet resource. A URI is an abstraction of a URL. A URL locates a resource, but a URI identifies a resource.A DTD or schema file does not have to exist at the URI location.

    An XML namespace identi fies groups of elements. A namespace can identify elements and at tributes fromdifferent XML files or distinguish meanings between elements. For example, you can distinguish meanings forthe element table by declaring different namespaces, such as math:tableandfurniture:table. XML is casesensitive. The namespaceMath: tableis different from the namespace math:table.

    You can declare a namespace at the root level of an XML file, or you can declare a namespace inside any elementin an XML structure. When you declare multiple namespaces in the same XML file, you use a namespace prefixto associate an element with a namespace. A namespace declaration appears in the XML file as an attribute thatstarts with xmlns. Declare the namespace prefix with the xmlns attribute. You can create a prefix name of anylength.

    The following example shows two namespaces in an XML instance document:

    xmlns:math = http://www.mathtables.comxmlns:furniture = http://www.home.com>4X6

    Brueners

    One namespace has math elements, and the other namespace has furniture elements. Each namespace has anelement called table, but the elements contain different types of data. The namespace prefix distinguishesbetween the math table and the furniture table.

    The following text shows a common schema declaration:

    ......

    The following table describes each part of the namespace declaration:

    Name

    In an XML file, each tag is the name of an element or attribute. In a DTD file, the tag specifiesthe name of an element, and the tag indicates the set of attributes for an element. In a schema file, specifies the name of an element and specifies the name of an attribute.

    Schema Declaration Description

    xmlns:xs="http://www.w3.org/2001/XMLSchema" Namespace that contains the native XML schema and

    datatypes. In this example, each schema component hasthe prefix of xs.

    targetNamespace="http://w ww.w3XML.com" Namespace that contains the schema.

    xmlns="http://www.w3XML.com" Default namespace declaration. All elements in the

    schema that have no prefix belong to the defaultnamespace. Declare a default namespace by using an

    xmlns attribute with no prefix.

    elementFormDefault="qualified" Specifies that any element in the schema must have anamespace in the XML file.

  • 7/31/2019 Pc 861 XML Guide

    19/152

    Cardinality 9

    When you import an XML defin ition, the element tags become column names in the PowerCenter definition,by default.

    Hierarchy

    An XML file models a hierarchica l database. The position of an element in an XML hierarchy repre sents itsrelationship to other elements. For example, an element can contain child elements, and elements can inheritcharacteristics from other elements.

    Cardinality

    Element cardinality in a DTD or schema file is the number of times an e lement occurs in an XML file. Elementcardinality affects how you structure groups in an XML definition. Absolute cardinality and relative cardinalityof elements affect the structure of an XML definition.

    Absolute Cardinality

    The absolute cardinality of an element is the number of times an element occurs within its parent element in an

    XML hierarchy. DTD and XML schema files describe the absolute cardinality of elements within the hierarchy.A DTD file uses symbols , and an XML schema f ile uses the and attributes todescribe the absolute cardinality of an element.

    For example, an element has an absolute cardinality of once (1) if the element occurs once within its parentelement. However, the element might occur many times within an XML hierarchy if the parent element has acardinality of one or more (+).

    The absolute cardinality of an element determines its null constraint. An element that has an absolutecardinality of one or more (+) cannot have null values, but an element with a cardinality of zero or more (*) canhave null values. An attribute marked as fixed or required in an XML schema or DTD file cannot have nullvalues, but an implied attribute can have null values.

    The following table describes how DTD and XML schema files represent cardinality:

    Absolute Cardinali ty DTD Schema

    Zero or once ? minOccurs=0 maxOccurs=1

    Zero or one or more times * minOccurs=0 maxOccurs=unbounded

    minOccurs=0 maxOccurs=n

    Once minOccurs=1 maxOccurs=1

    One or more times + minOccurs=1 maxOccurs=unbounded

    minOccurs=1 maxOccurs=n

    Note: You can declare a maximum number of occurrences or an unlimited occurrences in a schema.

  • 7/31/2019 Pc 861 XML Guide

    20/152

    10 Ch ap ter 1: X ML Co nc ept s

    The following figure shows the absolute cardinality of elements in a sample XML file:

    Relative Cardinality

    Relative cardinality is the relationship of an element to another element in the XML h ierarchy. An el ement canhave a one-to-one, one-to-many, or many-to-many relationship to another element in the hierarchy.

    An element has a one- to-one relationship with another e lement if every occurrence of one element can have oneoccurrence of the other element. For example, an employee element can have one social security numberelement. Employee and social security number have a one-to-one relationship.

    An e lement has a one-to-many rela tionship with another element if every occurrence of one element can havemultiple occurrences of another element. For example, an employee element can have multiple email addresses.Employee and email address have a one-to-many relationship.

    An e lement has a many-to-many rela tionship with another element if an XML file can have multipleoccurrences of both elements. For example, an employee might have multiple email addresses and multiplestreet addresses. Email address and street address have a many-to-many relationship.

    Element Cityoccursonce within its parent

    element Address. Its

    absolute cardinality isonce(1).

    Element Addressoccurs more than

    once within Store. Its

    absolute cardinality is

    one or more(+).

    Element Salesoccurszero or more times

    within its parent

    element Product. Its

    absolute cardinality is

    zero or more(*).

  • 7/31/2019 Pc 861 XML Guide

    21/152

  • 7/31/2019 Pc 861 XML Guide

    22/152

    12 Ch ap ter 1: X ML Co nc ept s

    Atomic Types

    An atomic datatype is a basic datatype such as a Boolean, string, integer, decimal, or date. To define customatomic datatypes, add restrictions to an atomic datatype to limit the content. Use a facet to define which valuesto restrict or allow.

    A facet is an expression that defines minimum or maximum values, specific values, or a data pat tern of validvalues. For example, a pattern facet restricts an element to an expression of data values. An enumeration facetlists the legal values for an element.

    The following example contains a pattern facet that restricts an element to a lowercase letter between a and z:

    The following example contains an enumeration facet that restricts a string to a, b, or c:

    Lists

    A lis t is an array collection of atomic types, such as a list of st rings that represent names. The list itemTypedefines the datatype of the list components.

    The following example shows a list called names:

    An XML file might contain the following data in the names list :

    Joe Bob Harry Atlee Will

    Unions

    A union is a combination of one or more atomic or list types that map to one simple type in an XML file. Whenyou define a union type, you specify what types to combine. For example, you might create a type called size.Size can include string data, such as S, M, and L, or size might contain decimal sizes, such as 30, 32, and 34. Ifyou define a union type element, the XML file can include a sizename type for string sizes, and a sizenum typefor numeric sizes.

  • 7/31/2019 Pc 861 XML Guide

    23/152

    Simple and Complex XML Types 13

    The following figure shows a schema file containing a shoesize union that contains sizenames and sizenumslists:

    The union defines sizenames and sizenums as union member types. Sizenames defines a list of string values.Sizenums defines a list of decimal values.

    Complex Types

    A complex type aggregates a collection of simple types into a logical unit. For example, a customer type mightinclude the customer number, name, street address, town, city, and zip code. A complex type can also reference

    other complex types or element and attribute groups.XML supports complex type inheritance. When you define a complex type, you can create other complex typesthat inherit the components of the base type. In a type relationship, the base type is the complex type fromwhich you derive another type. A derived complex type inherits elements from the base type.

    An extended complex type is a derived type that inherits e lements from a base type and includes additionalelements. For example, a customer_purchases type might inherit its definition from the customer complex type,but the cu stomer_purchases type adds item, cost, and date_sold elements.

    A res tricted complex type is a deri ved type that rest ricts some elements from the base type. For example,mail_list might inherit elements from customer, but restrict the phone_number element by setting theminoccurs and maxoccurs boundaries to zero.

    Sizename is a

    restricted

    string type.

    The sizenums

    type accepts a list

    decimals.

    The shoesize union

    accepts both the

    decimal and string

    lists.

    The sizenames

    type accepts alist of strings.

  • 7/31/2019 Pc 861 XML Guide

    24/152

    14 Ch ap ter 1: X ML Co nc ept s

    The following figure shows derived complex types that restrict and extend the base complex type:

    In the above figure, the base type is PublicationType. BookType extends PublicationType and includes theISBN and Publisher elements.

    Publication_Minimum restricts PublicationType. Publication_Minimum requires between 1 and 25 Authorsand restricts the date to the year.

    Abstract Elements

    Sometimes a schema contains a base type that defines the basic structure of a complex element but does notcontain all the components. Derived complex types extend the base type with more components. Since the basetype is not a complete definition, you might not want to use the base type in an XML file. You can declare thebase type element to be abstract. An abstract element is not valid in an XML file. Only the derived elements arevalid.

    To define an abstract element, add an abstract attribute with the value true. The default is false.

    For example, PublicationType is an abstract element. BookType inherits the elements in PublicationType, butalso includes ISBN and Publisher elements. Since PublicationType is abstract, a PublicationType element is notvalid in the XML file. An XML file can contain the derived type, BookType.

    The following schema contains the PublicationType and BookType:

    Base

    Complex

    Type

    ExtendedComplex

    Type

    Restricted

    Complex

    Type

    Element

    Reference

  • 7/31/2019 Pc 861 XML Guide

    25/152

  • 7/31/2019 Pc 861 XML Guide

    26/152

    16 Ch ap ter 1: X ML Co nc ept s

    anySimpleType Elements

    An anySimpleType element can contain any atomic type . An atomic type is a basic datatype such as a Boolean,string, integer, decimal, or date.

    The following schema describes a person with a first name, last name, and other element that is anySimpleType:

    The following XML instance document substitutes the anySimpleType element with a string datatype:

    Kathy

    Russell Cissy

    The following XML instance document substitutes the anySimpleType element with a numeric datatype:

    Kathy Russell 34

    ANY Content Elements

    The ANY content element accepts any content in an XML file. When you declare an ANY content element in aschema, you can substitute it for an element of any name and type in an XML instance document. Thesubstitute element must exist in the schema.

    When you specify ANY content, you use the keyword ANY instead of an element name and element type.

    The following schema describes a person with a first name, last name, and an element that is ANY content:

    The schema includes a son element and a daughter element. You can substitute the ANY element for the son ordaughter element in the XML instance document:

    Danny

    Russell Atlee

    Christine

    Slade Susie

  • 7/31/2019 Pc 861 XML Guide

    27/152

  • 7/31/2019 Pc 861 XML Guide

    28/152

    18 Ch ap ter 1: X ML Co nc ept s

    The following element groups provide constraints on XML data:

    Sequence group. All elements in an XML file must occur in the order that the schema lists them. Forexample, OrderHeader requires the customerName first, then orderNumber, and then orderDate:

    Choice group. One element in the group can occur in an XML file. For example, the CustomerInfo grouplists a choice of elements for the XML file:

    All group. All elements must occur in the XML file or none at all. The elements can occur in any order. For

    example, CustomerInfo requires all or none of the three elements:

    Substitution Groups

    Use substitution groups to replace one element with another in an XML file. For example, if you have addressesfrom Canada and the United States, you can create an address type for Canada and another type for the United

    States. You can create a substitution group that accepts either type of address.The following schema fragment shows an Address base type and the derived types CAN_Address andUSA_Address:

  • 7/31/2019 Pc 861 XML Guide

    29/152

    XML Path 19

    CAN_Address includes Province and PostalCode, and USA_Address includes State and Zip. The MailAddresssubstitution group includes both address types.

    RELATED TOPICS:

    Using Substitution Groups in an XML Definition on page 33.

    XML Path

    XMLPath (XPath) is a l anguage that describes a way to locate i tems in an XML file. XPath uses an addressingsyntax based on the route through the hierarchy from the root to an element or attribute. An XML path can

    contain long schema component names.

    XPath uses a s lash (/) to distinguish between elements in the hierarchy. XML attributes are preceded by @ inthe XPath.

    The following figure shows the XPath addresses for elements and attributes in a hierarchy:

    You can create a query on an element or attribute XPath to filter XML data .

    STORE

    STORE/PRODUCT/

    PNAME

    STORE/PRODUCT/

    SALES/YTDSALES

    STORE/ADDRESS/STREETADDRESS

    STORE/SNAME

    STORE/PRODUCT/

    @PID

    STORE/PRODUCT/

    SALES/@REGION

  • 7/31/2019 Pc 861 XML Guide

    30/152

  • 7/31/2019 Pc 861 XML Guide

    31/152

    21

    C H A P T E R 2

    Using XML with PowerCenter

    This chapter includes the following topics:

    Overview, 21

    Importing XML Metadata, 22

    Understanding XML Views, 26

    Understanding Hierarchical Relationships, 27 Understanding Entity Relationships, 30

    Working with Circular References, 34

    Understanding View Rows, 35

    Pivoting Columns, 37

    Limitations, 39

    Overview

    You can create an XML defin ition in PowerCenter from an XML file, DTD file, XML schema, flat filedefinition, or relational table definition. When you create an XML definition, the Designer extracts XMLmetadata and creates a schema in the repository. The schema provides the structure from which you edit andvalidate the XML definition.

    An XML definition can conta in multiple groups. In an XML defin ition, groups are called views. Therelationship between elements in the XML hierarchy defines the relationship between the views. When youcreate an XML definition, the Designer creates views for multiple-occurring elements and complex types in aschema by default. The relative cardinality of elements in an XML hierarchy affects how PowerCenter createsviews in an XML definition. Relative cardinality determines if elements can be part of the same view.

    The Designer defines relationships between the views in an XML definition by keys. Source definitions do notrequire keys, but target views must have them. Each view has a primary key that is an XML element or a

    generated key.

    When you create an XML defin ition, you can create a hierarchical model or an entity relat ionship model of theXML data. When you create a hierarchical model, you create a normalized or denormalized hierarchy. Anormalized hierarchy contains separate views for multiple-occurring elements. A denormalized hierarchy hasone view with duplicate data for multiple-occurring elements.

    If you create an entity model, the Designer creates views for complex types and multiple-occurring elements.The Designer creates an XML definition that models the inheritance and c ircular relationships the schemaprovides.

  • 7/31/2019 Pc 861 XML Guide

    32/152

    22 Chapter 2: Us ing XML wi th PowerCente r

    Importing XML Metadata

    When you import an XML defin ition, the Designer c reates a schema in the repository for the definition. Therepository schema provides the structure from which you edit and validate the XML definition.

    You can create metadata from the fol lowing file types:

    XML files

    DTD files

    XML schema files

    Relational tables

    Flat files

    Importing Metadata from an XML File

    In an XML file, a pair of tags marks the beginning and end of each data element. These tags are the basis for themetadata that PowerCenter extracts from the XML file. If you import an XML file without an associated DTDor XML schema, the Designer reads the XML tags to determine the elements, their possible occurrences, andtheir position in the hierarchy. The Designer checks the data within the element tags and assigns a datatypedepending on the data representation. You can change the datatypes for these elements in the XML definition.

    The following figure shows a sample XML file. The root element is Employees. Employee is a multipleoccurring element. The Employee element contains the LastName, FirstName, and Address. The Employeeelement also contains the multiple-occurring elements: Phone and Email.

    The Designer determines a schema structure from the XML data.

    Employee, Phone,

    and Email are

    multiple-occurring

    elements.

  • 7/31/2019 Pc 861 XML Guide

    33/152

  • 7/31/2019 Pc 861 XML Guide

    34/152

    24 Chapter 2: Us ing XML wi th PowerCente r

    The following figure shows an example of an XML file with a portion of the hierarchy from the associated DTDand the source definition that the Designer creates:

    Importing Metadata from an XML SchemaA schema file defines the structure of elements and attributes in an XML file. A schema file containsdescriptions of the type of elements and attributes in the file. When you import an XML schema, the Designerdetermines the datatype, precision, and cardinality of the elements. You cannot change an element definition inPowerCenter if the element definition comes from a schema.

    Each simple type definition in an XML schema is a restriction of another simple type definition in the schemaAtomic datatypes, such as Boolean, string, or integer, res trict the anySimpleType datatype. When you def ine asimple datatype in an XML schema, you derive a new datatype from an existing datatype. For example, you canderive a restricted integer type that holds only numbers from 1 to 20. The base type is integer.

    When you derive a complex datatype from another datatype, you create a new datatype that contains theelements of the base type. You can add new elements to the derived type or create restrictions on the inherited

    elements. The Designer creates views for derived types without duplicating the columns that represent inheritedcomponents. This reduces metadata and decreases the size of the XML definition in the repository.

    StoreInfo.dtd contains the Store

    element. Product is one of the

    child elements of Store.

    ProductInfo.xml uses the

    Product element from

    StoreInfo.dtd. Product includes

    the multiple-occurring Sales

    element.

    The ProductInfo definition contains the

    Product and Sales groups. The XML file

    determines what elements to include in

    the definition. The DTD file determines

    the structure of the XML definition.

  • 7/31/2019 Pc 861 XML Guide

    35/152

  • 7/31/2019 Pc 861 XML Guide

    36/152

    26 Chapter 2: Us ing XML wi th PowerCente r

    The following figure shows a sample XML target definition from the relational definitions, Orders andOrder_Items. The root is XRoot. XRoot encloses Orders and Order Items. Order_Items has a foreign key thatpoints to Orders.

    Creating Metadata from Flat Files

    You can create an XML defin ition by importing a flat f ile def inition from the repositor y. If you import morethan one flat file definition, the Designer creates an XML definition with a view for each flat file. The viewshave no relationship to each other in the XML definition. If you choose to create a root view, the Designercreates the views with foreign keys to the root.

    The following figure shows a sample XML source definition from flat files orders and products:

    Understanding XML Views

    The relationship between elements in the XML hierarchy defines the relationship between XML views in aPowerCenter definition. In a source definition, a view does not have to be related to any other view. Therefore,views in a source definition do not require primary or foreign keys. A denormalized view can be independent ofany other view. However, the Designer generates keys if you do not designate key columns when views arerelated to other views.

    Each view in a target definition must be related to at least one other group. Therefore, each view needs at leastone key to establish its relationship with another view. If you do not designate the keys, the Designer generates

    Products and Orders

    have a foreign key to

    the root view.

  • 7/31/2019 Pc 861 XML Guide

    37/152

    Understanding Hierarchical Relationships 27

    primary and foreign keys in the target views. You can define primary and foreign keys for views if you create theviews and relationships in the XML Editor instead of allowing the Designer to create them for you.

    When the Designer creates a primary or foreign key column, it a ssigns a column name with a prefix. In an XMLdefinition, the prefixes are XPK_ for a generated primary key column and XFK_ for a generated foreign keycolumn. The Designer uses the prefix FK_ for a foreign key that points to a primary key.

    For example, when the Designer creates a primary key column for the Sales group, the Designer names thecolumn XPK_Sales. When the Designer creates a foreign key column connecting a sales group to anothergroup, it names the column XFK_Sales. You can rename any column name that the Designer creates.

    If a mapping contains an XML source, the Integration Service creates the values for the generated primary keycolumns in the source de finition when you run the session. You can configure start values for the generatedkeys.

    Creating Custom XML Views

    Custom views are groups that you create with the XML Wizard or the XML Editor. If you use the XML Wizardto create custom views, the wizard creates views containing all the components in the schema. If you use theXML Editor, you can define each view and choose the components.

    The elements in the views and the relationship between views are dependent on the schema the Designer createsin the repository when you import the definition. The XML Editor validates XML definitions using the rulesfor valid views.

    Rules and Guidelines for XML Views

    Consider the following rules and guidelines when you work with view keys and relationships:

    An PowerCenter XML definition can have up to 400 views.

    A view can have one primary key.

    A view can be related to several other views, and a vi ew can have multiple foreign keys .

    A column cannot be both a primary key and a foreign key.

    A view in a source definition does not require a key.

    A view in a target defin ition requires a t least one key.

    The target root view requires a primary key, but the target root does not require a foreign key.

    A target leaf view requires a foreign key, but the target leaf vi ew does not require a primary key.

    An enclosure element cannot be a key.

    A foreign key always refers to a pr imary key in another group. You cannot use self-referenc ing keys.

    A generated foreign key column always refers to a generated pr imary key column.

    The relative cardinality of elements in an XML hierarchy affects how PowerCenter creates views in an XMLdefinition. The following rules determine when elements can be part of the same view:

    Elements that have a one-to-one relationship can be part of the same view.

    Elements that have a one-to-many relationship can be part of the same normalized or denormalized view.

    Elements that have a many-to-many relationship cannot be part of the same view.

    Understanding Hierarchical Relationships

    An XML definition with hierarchical view rela tionships has each element in the hierarchy appear under i tsparent element in a view. Multiple-occurring elements can become views. Complex types do not become views,and elements unique to derived complex types do not occur in any view.

  • 7/31/2019 Pc 861 XML Guide

    38/152

  • 7/31/2019 Pc 861 XML Guide

    39/152

    Understanding Hierarchical Relationships 29

    The following figure shows a data preview for each view in the source definition:

    Denormalized Views

    When the Designer generates a denormalized view, it creates one view and puts all elements of the hierarchyinto the view. All the elements in a denormalized view belong to the same parent chain. Denormalized views,

    like denormalized tables, generate duplicate data.The Designer can generate denormalized views for XML definitions that contain more than one multiple-occurring element if the multiple-occurring elements have a one-to-many relationship and are all part of thesame parent chain.

    The following figure shows a DTD file that contains multiple-occurring elements:

    Product and Sales are multiple-occurring elements. Because the multiple-occurring elements have a one-to-many relationship, the Designer can create a single denormalized view that includes all elements.

    The following figure shows the denormalized view for ProdAndSales.dtd in a source definition:

    The denormalized view does not need a primary or foreign key.

    STORE View

    ADDRESSView

    PRODUCT View

    SALES View

    EMPLOYEE View

    STORE: Root

    PRODUCT*: Multiple-Occurring

    SALES*: Multiple-Occurring

    The Designer creates a single view for all the

    elements in the ProdAndSales hierarchy. Becausea DTD file does not define datatypes, the Designerassigns a datatype of string to all columns.

  • 7/31/2019 Pc 861 XML Guide

    40/152

    30 Chapter 2: Us ing XML wi th PowerCente r

    The following figure shows a data preview for the denormalized view:

    RELATED TOPICS:

    Adding an XML Source Qualifier to a Mapping on page 96.

    Understanding Entity Relationships

    You can create entity rela tionships from an XML schema. When you create an XML defin ition that containsentity relationships, the Designer generates separate views for multiple-occurring elements, element groups, andcomplex types. The Designer includes views for all derived complex types. The Designer creates links and keysbetween the views based on type and hierarchy relationships.

    When you work with XML schemas, you can reference parts of the schema rather than repeat the sameinformation in schema components. A component can inherit the elements and attributes of anothercomponent and restrict or extend the elements from the component. For example, you might use a complextype as a base for creating a new complex type. You can add more elements to the new type to create anextended complex type. Or, you might create a restricted complex type, which is a subset of another complextype.

    If you create views manually or re-create entity relationships in the XML Editor, you choose how you want tostructure the metadata. When you create an XML definition based on an XML schema that uses inheritance,you can generate separate views for the base type and derived type. You might create inheritance relationhips ifyou plan to map the XML data to normalized relational tables.

    An XML Type I inheritance relationship is a relationship between two views. Each view root is a global complex

    type. One view is derived from the other.

    You can create an inheritance relat ionsh ip between a column and a view. This is an XML Type II inheritancerelationship.

    The Designer generates separate views for substitution groups.

    Rules and Guidelines for Entity Relationships

    The Designer generates entities based on the following guidelines:

    An entity represents a portion of an XML, DTD, or XML schema hierarchy. This hierarchy does not need tostart at the root of the XML file.

    The Designer uses entities defined in a DTD file to create entity relationships. The Designer uses type structures defined in an XML schema to generate entity relationships.

    The Designer creates a new entity when it encounters a multiple-occurring element under a parent element.

    The Designer generates a separate view for each member of a substitution group.

    The Designer generates primary keys and foreign keys to relate separate entities.

  • 7/31/2019 Pc 861 XML Guide

    41/152

  • 7/31/2019 Pc 861 XML Guide

    42/152

    32 Chapter 2: Us ing XML wi th PowerCente r

    The following figure shows an XML file that has a publication, a magazine, and books:

    If you process the sample XML file using the XML definition in the preceding figure, you create data in thefollowing views:

    PublicationType view. Contains the title and date for each publication.

    BookType view. Contains the ISBN and publisher. BookType contains a foreign key to PublicationType.

    MagazineType view. Contains volume and ed ition. MagazineType also contains a foreign key to thePublicationType.

    Author view. Contains authors for all the publications. The Designer generates a separate view for Authorbecause Author is a multiple-occurring element. Each publication can contain multiple authors.

    Type II Entity Relationship Example

    You can create an inheritance relat ionsh ip between a column and a complex type view. The column must be anelement of a local complex type. The view must be rooted at a global complex type. The local complex typemust be derived from the global complex type.

    For example, the following schema defines a complex type called EmployeeType. EmployeeType containsEmployeeNumber and EmployeeName elements.

  • 7/31/2019 Pc 861 XML Guide

    43/152

    Understanding Entity Relationships 33

    EmployeeStatusType includes an element called Employee that extends EmployeeType. Employee includes anEmployeeStatus element.

    xs:sequence>

    When you import the schema, the Designer creates a view for Employee_Payroll , EmployeeType, andEmployeeStatus. The EmployeeStatus view contains the column called Employee. Employee is anEmployeeType.

    The following figure shows the XML views the Designer creates from the schema:

    Using Substitution Groups in an XML Definition

    When you create an XML definition containing entity re lationships, the Designer generate s separate views forelement groups and complex types. When you import an XML schema that uses substitution groups, the

    Employeeis derived

    from

    EmployeeType

  • 7/31/2019 Pc 861 XML Guide

    44/152

    34 Chapter 2: Us ing XML wi th PowerCente r

    Designer imports each member of the substitution group as a separate entity. The Designer makes a separateview for each group.

    The following figure shows a sample portion of an XML schema containing substitution groups:

    The following figure shows an XML definition with the substitution groups:

    Working with Circular References

    A ci rcular relat ionship is a circular hierarchy relat ionsh ip between two views in an XML definit ion o r within a

    single view in an XML definition. For example, a complex element called Part might contain an ID, part name,and a reference to another part.

    The following example shows the Part element components:

    Substitution

    Group

    Members

    The Designer creates a new view for

    each member of the substitution

    group.

  • 7/31/2019 Pc 861 XML Guide

    45/152

    Understanding View Rows 35

    /xs:sequence>

    The following figure shows a circular reference in the XML Editor workspace:

    You might use the Part XML definition to read the following XML file in a sess ion:

    1

    Big PartL

    1.A

    Middle Part

    M

    1.A.B

    Small PartS

    In the XML file, Part 1 contains Part 1.A, and Part 1.A contains Part 1.A.B.

    The following figure shows the data and the keys that a session might generate from the XML source:

    Note:You cannot run a session that contains a circular XML reference if the session is enabled for constraint-based loading. The session rejects all rows.

    Understanding View Rows

    To extract data from an XML document, you specify the rows to generate, the columns of data to include, andwhen to generate the rows. When you define a view in the XML Editor, you create the view row, an e lement ora global complex type that the Integration Service requires to generate a row of data.

    The Integration Service uses a view row to determine when to read and write data for an XML view. You can seta view row at any single or multiple-occurring element. Once you set the view row, every element you add tothe view has a one-to-one correspondence with the view row.

    For example, the Employees view contains e lements Employee, Name, Firstname, and Lastname. When you setthe view row to Employee, the Integration Service extracts data using the following algorithm:

  • 7/31/2019 Pc 861 XML Guide

    46/152

  • 7/31/2019 Pc 861 XML Guide

    47/152

  • 7/31/2019 Pc 861 XML Guide

    48/152

    38 Chapter 2: Us ing XML wi th PowerCente r

    The following figure shows the ADDRESS element of the StoreInfo XML file pivoted into two sets of addresscolumns:

    Using Multiple-Level Pivots

    You can pivot more than one level of elements in a view by specifying f ixed offs ets for multiple-occurr ingelements in the XPath for a column. For example, you might have the following elements in a view:

    STORE

    PRODUCT+PNAME

    ORDER+

    ORDERNAMECUSTOMER+

    CUSTNAME

    The XPath STORE/PRODUCT[2]/ORDER[1]/ORDERNAME refers to the ordername for the first order for the secondproduct in the store. The XPath STORE/PRODUCT[2]/ORDER/CUSTOMER[1] refers to the first customer for allorders of the second product.

    If you pivot a view row, any column in the XML view that occurs below the view row must have an XPath thatmatches XPath of the view row.

    First occurrence of

    Addresspivoted tohome address

    columns with prefix

    HOM_.

    XPath shows the two sets of columns

    that come from the same elements.

    Second

    occurrence of

    Address

    pivoted to

    office address

    columns with

    prefix OFC_.

    The first and second occurrences ofAddressrepresented as columns in the group:

  • 7/31/2019 Pc 861 XML Guide

    49/152

    Limitations 39

    For example, a view might have the following view row:

    Transaction/Trade[1]

    The following columns have the same occurrence of Trade in the XPath:

    Transaction/Trade[1]/Date

    Transaction/Trade[1]/Price

    Transaction/Trade[1]/Person[1]/Firstname

    You cannot create a column with the following XPath in the view :

    Transaction/Trade[2]/Date

    Limitations

    PowerCenter does not support the following functions:

    Concatenated columns. A column cannot be a concatenation of two elements. For example, you cannotcreate a column FULLNAME that refers to a concatenation of two elements FIRSTNAME andLASTNAME.

    Composite keys. A key cannot be a concatenation of two e lements. For example, you cannot create a key

    CUSTOMERID that refers to a concatenation of two elements LASTNAME and PHONENUMBER. Parsed lists. PowerCenter stores a list type as one string that contains all array elements. PowerCenter does

    not parse the respective simple types from the string.

  • 7/31/2019 Pc 861 XML Guide

    50/152

    40

    C H A P T E R 3

    Working with XML Sources

    This chapter includes the following topics:

    Overview, 40

    Importing an XML Source Definition, 41

    Working with XML Views, 43

    Generating Entity Relationships, 45 Generating Hierarchy Relationships, 46

    Creating Custom XML Views, 47

    Synchronizing XML Definitions, 49

    Editing XML Source Definition Properties, 50

    Creating XML Definitions from Repository Definitions, 52

    Troubleshooting, 52

    OverviewThe Designer provides an XML Wizard that you can use to create XML definitions in the repository. You canimport files from a URL or local node to c reate an XML definition. You can also import relational or flat filedefinitions from a PowerCenter repository. You can create XML definitions from the following file types:

    XML files

    XML schema files

    DTD files

    Relational definitions

    Flat file definitions

    When you create XML definitions, you import files with the XML Wizard and organize metadata into XMLviews. XML views are groups of columns containing the elements and attributes in the XML file. The wizardcan generate views for you, or you can create custom views. For more information, see Working with XMLViews on page 43.

    You can create rel ationships between views in the XML Wizard. You can create hierarchy relat ionships or entityrelationships. For more information about creating hierarchy relationships, see Generating HierarchyRelationships on page 46. For more information about creating entity relationships, see Generating EntityRelationships on page 45.

  • 7/31/2019 Pc 861 XML Guide

    51/152

  • 7/31/2019 Pc 861 XML Guide

    52/152

    42 Chapter 3: Work ing w ith XML Sources

    2. Click Advanced Options.

    The Change XML Views Creation and Naming Options dialog box appears. Select options to specify howthe Designer creates and names XML views.

    The following table describes the XML view options:

    Option Description

    Override all infinite lengths You can specify a default length for components with undefined

    lengths, such as strings. If you do not set a default length, the precision

    for these components sets to infinite. Infinite precision can cause DTM

    buffer size errors when you run a session with large files.

    Analyz e elements/at tributes in

    standalone XML as global

    declarations

    Choose this option to create global declarations of standalone XML

    elements or attributes. You can reuse global elements by referencing

    them in other parts of the schema. When you clear this option, the

    standalone XML is a local declaration.

  • 7/31/2019 Pc 861 XML Guide

    53/152

  • 7/31/2019 Pc 861 XML Guide

    54/152

  • 7/31/2019 Pc 861 XML Guide

    55/152

  • 7/31/2019 Pc 861 XML Guide

    56/152

    46 Chapter 3: Work ing w ith XML Sources

    To genera te en t i t y re la t ionsh ips :

    1. In the Source Analyzer, click Sources > Import XML Definition.

    The XML Wizard opens.

    2. Navigate to the source you want to import and click Open.

    3. Enter a name for the file and click Next.

    4. Select Entity Relationships and click Finish.

    The XML Wizard generates an XML definition that uses entity relationships.

    Generating Hierarchy Relationships

    When you create h ierarchy rela tionships, each reference to a component is expanded under i ts parent element.The XML Wizard selects the default root and uses default settings to create XML groups. For informationabout default settings for XML groups, see Understanding Hierarchical Relationships on page 27.

    To genera te h ie rarc hy re la t ionsh ips :

    1. In the Source Analyzer, click Sources > Import XML Definition.

    The XML Wizard opens.

    2. Navigate to the source you want to import and click Open.

    3. Enter a name for the file and click Next.

    4. Select Hierarchy Relationships.

    5. Select Normalized XML Views or Denormalized XML Views and click F