[xsd-users] RE: parser issue
Rizzuto, Raymond
Raymond.Rizzuto at sig.com
Mon Jul 14 14:53:48 EDT 2008
My apologies!
The first error is also a case of operator error on my part. The newRequest can have either a request or an order, but not both.
I am a bit concerned that it was so easy to generate invalid output, however. Why didn't the serialize call throw an exception indicating this error?
Ray
________________________________
From: Rizzuto, Raymond
Sent: Monday, July 14, 2008 12:31 PM
To: xsd-users at codesynthesis.com
Subject: parser issue
Hi!
I am creating a object and serializing it to XML with xsd-tree. This is the output:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<message xmlns="http://sig.com/sdmp/messages" version="1.2">
<header source="Susex NEW">
<containerId source="SusexToSDMP">SAX.48420080707.562559</containerId>
</header>
<newRequest>
<request communicationMethod="Electronic" sentDateTime="2008-07-07T13:30:05.097699Z" state="Processed" type="NewOrderInstruction">
<id revision="3" source="SusexToSDMP">SAX.48420080707.562559</id>
</request>
<simpleOrder cancelledQuantity="0" createDateTime="2008-07-07T13:30:05.097699Z" executedQuantity="0" expiredQuantity="0" imbalance="false" leavesQuantity="100" originatorActingAsMM="false" originatorCapacity="Principal" perspective="Originator" programTradingIntent="NonAlgorithmicProgramTrading" state="Unconfirmed" totalOutQuantity="0">
<id revision="3" source="SusexToSDMP">SAX.48420080707.562559</id>
<originatorLegalEntity alias="SFG" id="1493"/>
<handlerLegalEntity alias="NASDAQ" id="9999"/>
<originatorAccount id="9999" name="NAE"/>
<settlementType>Tplus3</settlementType>
<executionVenue abbreviation="NasdaqExecVenue" id="9999"/>
<orderHandlingService id="9999" name="NASDAQ"/>
<orderInstruction allOrNone="false" createDateTime="2008-07-07T13:30:05.097699Z" entryMode="Electronic" fillOrKill="false" immediateOrCancel="false" initialOrderOriginatorClass="Firm" interMarketSweepOrder="false" notHeld="false" originatorCapacity="Principal" perspective="Originator" sellAuto="false" sellType="Long" side="Sell" state="PendingInForce" timeInForceType="Day">
<id revision="3" source="SusexToSDMP">SAX.48420080707.562559</id>
<price type="Limit">
<currency id="1"/>
<value>4.61</value>
</price>
<quantity type="Shares">
<value>100</value>
</quantity>
<displayReserveQuantity type="Shares">
<value>0</value>
</displayReserveQuantity>
<originatorId source="Susex CL_ID">SAX.484</originatorId>
<originatorPublicId>SAX.484.0</originatorPublicId>
<directedExecutionVenue abbreviation="NasdaqExecVenue" id="9999"/>
<directedOrderHandlingService id="9999" name="NASDAQ"/>
<originatorLegalEntity alias="SFG" id="1493"/>
<handlerLegalEntity alias="NASDAQ" id="9999"/>
</orderInstruction>
<instrument id="9999">
<symbol>SSCC</symbol>
</instrument>
</simpleOrder>
</newRequest>
</message>
I then try to parse the XML back to an object to validate the round trip. However, I am getting these errors:
:38:26 error: Element 'displayReserveQuantity' is not valid for content model: '(id,,(ticket,originatorLocate,price,contingentPrice,stopPrice,quantity,minQuantity,maxQuantity,((displayQuantity,displayRefreshQuantity),displayReserveQuantity),bookingUnitQuantity,(timeInForceActivationDateTime,timeInForceExpirationDateTime),efpText,rerouteOfOrderInstructionId,beneficiaryLegalEntity,netOrCommFormula,netOrCommAmount,originatorId,handlerId,originatorPublicId,handlerPublicId,directedExecutionVenue,directedOrderHandlingService,originatorDesignatedLegalEntity,originatorTradingPerson,originatorLegalEntity,handlerTradingPerson,handlerLegalEntity),)'
:43:16 error: Element 'simpleOrder' is not valid for content model: '(request|order)'
The first error looks like it is because I didn't fill in a mandatory element of an optional sequence contained within orderInstruction. Unfortunately, that case didn't get detected at compile/run time in the serialization flow, only during parsing. Here is the offending sequence:
<xs:sequence minOccurs="0">
<xs:element name="displayQuantity" type="Quantity">
</xs:element>
<xs:element name="displayRefreshQuantity" type="Quantity" minOccurs="0">
</xs:element>
<xs:element name="displayReserveQuantity" type="Quantity" minOccurs="0">
</xs:element>
</xs:sequence>
The second error appears to be complaining that the message contains a simpleOrder in the order "slot", yet I believe that is allowed by substitution group:
<xs:element name="simpleOrder" type="SimpleOrder" substitutionGroup="order"/>
Is that an xsd-tree bug or some issue with my code/schema?
Ray
________________________________
Ray Rizzuto
raymond.rizzuto at sig.com
Susquehanna International Group
(610)747-2336 (W)
(215)776-3780 (C)
________________________________
IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.
More information about the xsd-users
mailing list