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. Appendix A: XML Datatype Reference
  10. Appendix B: XPath Query Functions Reference

XML Guide

XML Guide

Absolute Cardinality

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 file uses the <minOccurs> and <maxOccurs> attributes to describe the absolute cardinality of an element.
For example, an element has an absolute cardinality of once (1) if the element occurs once within its parent element. However, the element might occur many times within an XML hierarchy if the parent element has a cardinality of one or more (+).
The absolute cardinality of an element determines its null constraint. An element that has an absolute cardinality of one or more (+) cannot have null values, but an element with a cardinality of zero or more (*) can have null values. An attribute marked as fixed or required in an XML schema or DTD file cannot have null values, but an implied attribute can have null values.
The following table describes how DTD and XML schema files represent cardinality:
Absolute Cardinality
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
You can declare a maximum number of occurrences or an unlimited occurrences in a schema.
The following figure shows the absolute cardinality of elements in a sample XML file:
The Element Address occurs more than once within Store. Element City occurs once within its parent element Address. Element Sales occurs zero or more times within its parent element Product.
  1. Element
    Address
    occurs more than once within
    Store
    . Its absolute cardinality is one or more(+).
  2. Element City occurs once within its parent element Address. Its absolute cardinality is once(1).
  3. Element Sales occurs zero or more times within its parent element Product. Its absolute cardinality is zero or more(*).

0 COMMENTS

We’d like to hear from you!