Hi all,
I am facing the following issue.
I have a XML schema , and following is a XML document which adheres to
that schema.
I don't want my object model to be closely aligned with the structure of
the XML.,, so I selected JIBX.
In my object model, I have a Order abstract class , which contains the
fields relating to following elements
AuditTrail - List type
Client Reference - String
Handling instruction - Enum
Meta Details - List type
Currency - String
Direction - Enum
Size - BigDecimal
Hedge - Boolean
AttachedStop - a object reference
Attached Limit - a object reference
New - Enum type.
I have an abstract class called SingleTradeOrder, which extends Order.
This class contains the field relating to the element 'Account'.
According to difference Order types, I have different sub classes. Like
MarketOrder class which extends SingleTradeOrder, MarketLimitOrder which
extends SingleTradeOrder etc.
These Order types define the name which appears at location (A) in the
XML document given below.
In other words, when we are marshalling a Order of type Market Order,
the element should be Market,
when we are marshalling a Order of type Market Limit Order, the element
should be MarketLimit,
etc
The content inside the 'OrderDetails' element vary depending on whether
the Order is a Market, Market Limit etc. The additional elements which
appear inside the Order details element will come from fields in the
actual type of Order sub class,,, MarketOrder, MarketLimitOrder etc. But
some of these fields should be at the same level as the element
'OrderDetails'.
The object model is mostly done, and it will be hard to make changes to
it,, same is the case for the XML schema.
So, I have to somehow get the bindings file correct, in order to map
the object model to the XML Schema.
I have an understanding on how jibx mappings work, and tried writing a
binding file,, but my main issues were getting the 'New' element mapped,
and getting the different element Market, Market Limit etc mapped.
Note that I don't want to have a class called 'New'. It should be a
Enum, which specifies the action type, ,,, and possible values are New,
Edit, Cancel, Delete etc,, which needs to correspond to the element name
at location (B) in the following XML document. This action type is a
field in the Order abstract class.
Appreciate all feedback on how to get the bindings file correctly done.
<?xml version="1.0" encoding="UTF-8"?>
<p:MainOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="MainOrder.xsd">
<AuditTrail>
<At host="" timestamp="0" type=""/>
</AuditTrail>
<RequestDetails>
<ClientReference>ClientReference</ClientReference>
(B) <New xsi:type="NewOrderType">
<Order>
<HandlingInstruction>xxx</HandlingInstruction>
(A) <Market>
<OrderDetails>
<Currency>Currency</Currency>
<Direction>+</Direction>
<Size>0</Size>
<Hedge>true</Hedge>
</OrderDetails>
<AttachedStop>
<StopLevel>0.0</StopLevel>
</AttachedStop>
<AttachedLimit>
<LimitLevel>0.0</LimitLevel>
</AttachedLimit>
</Market>
</Order>
<Account>
<AccountId>AccountId</AccountId>
<BrokerId>BrokerId</BrokerId>
</Account>
</New>
</RequestDetails>
<MetaDetails>
<MarketName>MarketName</MarketName>
</MetaDetails>
</p:MainOrder>
Thanks
Mahen
The information contained in this email is strictly confidential and for the
use of the addressee only, unless otherwise indicated. If you are not the
intended recipient, please do not read, copy, use or disclose to others this
message or any attachment. Please also notify the sender by replying to this
email or by telephone (+44 (0)20 7896 0011) and then delete the email and any
copies of it. Opinions, conclusions (etc.) that do not relate to the official
business of this company shall be understood as neither given nor endorsed by
it. IG Index plc is a company registered in England and Wales under number
01190902. VAT registration number 761 2978 07. Registered Office: Friars House,
157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by the
Financial Services Authority. FSA Register number 114059.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users