Observe the following XML structure.
Listing 3 – Updategram XML structure
We would need to generate a schema in such a way so as to
map the XML structure shown in Listing 3. Notice the attribute at-identity. This denotes that the value for the identity
column which gets generated (when the Publisher row is inserted) shall be
picked up by the Book; notice the attribute PublisherID
in the Book element.
The value of the at-identity and the
PublisherID shall be "NewID."
There are two different namespaces referred to in the above
XML document, one is the "ns0" namespace and another one is the
"ns1" namespace for the updategram.
Creating Schema for the "at-identity"
Listing 4 – Root schema structure for the attribute
Observe the schema in Listing 4, the target namespace for
the attribute is the updategram.
Figure 1 – The completed schema structure for the
This schema references the attribute schema created in
The schema in Figure 1 would generate the XML structure
specified in Listing 3.
Mapping to the datagram
This map is used to map the incoming messages to the
updategram schema. In this case the book and publisher messages are mapped to
the updategram schema.
Figure 2 – Mapping messages to datagram schema