Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Appendix C Creating XML Documents : Defining Attribute Relationships

Defining Attribute Relationships
This section shows you how to define attribute relationships with the XML Field Map Attribute Of type.
Consider this XML field map from the Books example:
 
Executing the XML document BOOKS normally produces an XML document, a segment of which looks like this:

 
<book KEY="2">
<genre>Literature and Fiction</genre>
<bktitle>Pride and Prejudice</bktitle>
<author_ln>Austin</author_ln>
<author_fn>Jane</author_fn>
<price>4.80</price>
</book>

 
Follow these steps to learn how to use the Attribute Of type:
1.
 
The resulting XML document entry looks like this:

 
<book KEY="2">
<genre>Literature and Fiction</genre>
<bktitle>Pride and Prejudice</bktitle>
<price>4.80</price>
<Name>
<author_ln>Austin</author_ln>
<author_fn>Jane</author_fn>
</Name>
</book>

 
2.
Make GENRE an attribute of the bktitle element, as illustrated here:
 
The resulting XML document entry looks like this:

 
<book KEY="2">
<bktitle genre="Literature and Fiction">Pride and Prejudice</bktitle>
<price>4.80</price>
<Name>
<author_ln>Austin</author_ln>
<author_fn>Jane</author_fn>
</Name>
</book>

 
Next, create attributes within the groups:
1.
Make the last name an attribute of the group element Name, as illustrated by the following figure.
 
The resulting XML document entry looks like this:

 
<book KEY="2">
<bktitle genre="Literature and Fiction">Pride and Prejudice</bktitle>
<price>4.80</price>
<Name author_ln="Austin">
<author_fn>Jane</author_fn>
</Name>
</book>

 
2.
 
The resulting XML document entry looks like this:

 
<book KEY="2">
<bktitle genre="Literature and Fiction">Pride and Prejudice</bktitle>
<price>4.80</price>
<Name>
<author_fn author_ln="Austin">Jane</author_fn>
</Name>
</book>

 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved