Hi,
I have existing xml schema which I need to modify to get the following data.
XSD Schema:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="sschema" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="MSG" type="MessageType"/>
<xsd:complexType name="MessageType">
<xsd:choice>
<xsd:element name="TRANSACTIONS" type="TransactionsType" />
<xsd:element name="CLIENTS" type="ClientsType" />
</xsd:choice>
<xsd:attribute name="MessageID" type="xsd:string" use="required"/>
<xsd:attribute name="ApplicationName" type="xsd:string" use="required"/>
<xsd:attribute name="MessageCreationTime" type="xsd:dateTime" use="required"/>
</xsd:complexType>
<xsd:complexType name="TransactionsType">
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element name="Transaction" type="TransactionType"/>
</xsd:sequence>
<xsd:attribute name="ChildCount" type="xsd:int" />
</xsd:complexType>
<xsd:complexType name="ClientsType">
<xsd:sequence minOccurs="1" maxOccurs="unbounded">
<xsd:element name="CLIENT" type="ClientType"/>
</xsd:sequence>
<xsd:attribute name="ChildCount" type="xsd:int" />
</xsd:complexType>
<xsd:complexType name="TransactionType">
<xsd:sequence>
<xsd:element name="ACTION" type="ActionTypes" minOccurs="1" maxOccurs="1" />
<xsd:element name="ACCOUNTS" minOccurs="1" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ACCOUNT" minOccurs="1" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="DEBIT_ACCOUNT" type="xsd:short" />
<xsd:element name="CREDIT_ACCOUNT" type="xsd:short" />
<xsd:element name="AMOUNT" type="xsd:string" />
<xsd:element name="ID" type="xsd:int" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="ActionTypes">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Add"/>
<xsd:enumeration value="Update"/>
<xsd:enumeration value="Delete"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
My xml for above schema for transactions looks likes this:
<TRANSACTIONS ChildCount='1'>
<TRANSACTION>
...........
......
</TRANSACTION>
</TRANSACTIONS>
Now they want me to add another element in transactions element like this:
<TRANSACTIONS ChildCount='1'>
<SOURCE_TRANSACTION>
...........
......
</SOURCE_TRANSACTION>
<DEST_TRANSACTION>
...........
......
</DEST_TRANSACTION>
</TRANSACTIONS>
How can I add another element to 'Transactions' element because Transactions element is defined as type 'TransactionType'.
Dest_Transaction has different data structure. Both Source_transaction and Dest_transaction should be placed under 'Transactions' parent element.
Thank You