Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. XML Datatype Reference
  10. XPath Query Functions Reference

XML Guide

XML Guide

Abstract Elements

Abstract Elements

Sometimes a schema contains a base type that defines the basic structure of a complex element but does not contain all the components. Derived complex types extend the base type with more components. Since the base type is not a complete definition, you might not want to use the base type in an XML file. You can declare the base type element to be abstract. An abstract element is not valid in an XML file. Only the derived elements are valid.
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, but also includes ISBN and Publisher elements. Since PublicationType is abstract, a PublicationType element is not valid in the XML file. An XML file can contain the derived type, BookType.
The following schema contains the PublicationType and BookType:
<xsd:complexType name="PublicationType"
abstract="true
">    <xsd:sequence>      <xsd:element name="Title" type="xsd:string"/>      <xsd:element name="Author" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>      <xsd:element name="Date" type="xsd:gYear"/>    </xsd:sequence>    </xsd:complexType> <xsd:complexType name="BookType">    <xsd:complexContent>      <xsd:extension base="PublicationType" >        <xsd:sequence>           <xsd:element name="ISBN" type="xsd:string"/>            <xsd:element name="Publisher" type="xsd:string"/>         </xsd:sequence>      </xsd:extension>    </xsd:complexContent> </xsd:complexType>

0 COMMENTS

We’d like to hear from you!