Users Online
· Guests Online: 58
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
· Members Online: 0
· Total Members: 188
· Newest Member: meenachowdary055
Forum Threads
Newest Threads
No Threads created
Hottest Threads
No Threads created
Latest Articles
Articles Hierarchy
TIBCO BW Development Tutorial: How to create XML Schema Definition (XSD) in TIBCO BusinessWorks
In this tutorial, we are going to discuss the XML Schema Definition (XSD). When we working with XML files as input/output we need to create an XSD or DTD to validate or format the input/output content.
Let’s Discuss on how to create an XML Schema Definition (XSD).
To start creating the XSD, drag and drop the Schema pallet to the root folder and double click on it.
Schema-Pallet
Before creating the XML Schema Definition, we need to understand the input/output XML format like the elements name, attributes etc. For this example, I am going to create an XSD for the below XML format.
<?xml version="1.0"?> <catalog> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight Rain</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-12-16</publish_date> <description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</description> </book> <book id="bk103"> <author>Corets, Eva</author> <title>Maeve Ascendant</title> <genre>Fantasy</genre> <price>5.95</price> <publish_date>2000-11-17</publish_date> <description>After the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society.</description> </book> </catalog>
- As you can see, ‘catalog’ and ‘book’ are the elements. So when we create the XSD we need to set the content type as ‘Elements’ for these two and the rest of them, it will be ‘Typed’.
- Book is the subelement of ‘catalog’ and it’s a repeating one. So in the Content Model section, you need to type ‘book+’. here plus denotes the repeating element.Schema Elements
- For rest of them, you can specify like the below. In the Data Type section, select the appropriate data type for the elements based on your need.
- All these Typed elements are the sub-element of Book. So we need to Mention that in the Content Model section. Type all the sub-elements in the Text Area. Also, we can use the Insert button to select the elements. The ‘?’ mark after ‘author’ element demotes that its an optional value. Like in the book element case, type ‘+’ if any of them are repeating. Also, we can use the wild card (*) character to set optional & repeatable for an element.
- In the XML you can see an id attribute for the book element. We need to mention that as well in the XSD. If we are not sure about the attribute value for the element or if we are not going to use it anywhere select ‘#anyAttribute’. Else just type the element name there. By default, it will be an optional value.
- Now click on Apply button to save the XML Schema Definition. if all the configurations are made accuratley we will get a Pictorial representation of the XSD as shown in the below image.Pictorial representation of XML Schema Definition (XSD)
Read ‘Tibco BW development tutorial how to configure parse XML and render XML activity step by step guide‘ to see how we can use the Schema
Comments
No Comments have been Posted.
Post Comment
Please Login to Post a Comment.