×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

xsd schema for xml

xsd schema for xml

xsd schema for xml

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close