Serialize to Xml.

S

Sugandh Jain

I am using a method to serialize objects to xml.
this method is working fine to serialize most of the objects to Xml.

For one collection object, it is not doing so. The Collection and its
containing object are marked [Serilizable].

What could be the reasons for the object not getting serialize, and this is
what i get.

<?xml version="1.0"?>
<ArrayOfAllocatedTrade xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
</ArrayOfAllocatedTrade>

Allocated trade is an object with around 10-12 properties.


This is working fine for all other objects, sample right serialization,

<?xml version="1.0"?>
<CloseTradeInterface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<BrokenRulesCollection />
<CloseTradeFilter>
<BrokenRulesCollection />
<CloseTradeDate>2006-12-28T14:59:09.2045251+05:30</CloseTradeDate>
<Funds>
<Fund>
<BrokenRulesCollection />
<ID>1</ID>
<ShortName>FundA</ShortName>
<FullName />
</Fund>
</Funds>
<DataSourceNameID>
<BrokenRulesCollection />
<ID>1</ID>
<FullName />
<ShortName />
</DataSourceNameID>
<AUECListValues>
<AUEC>
<BrokenRulesCollection />
<AUECID>1</AUECID>
<AUECName>Equity\US\NASDAQ\USD</AUECName>
</AUEC>
<AUEC>
<BrokenRulesCollection />
<AUECID>11</AUECID>
<AUECName>Equity\US\ARCA\USD</AUECName>
</AUEC>
</AUECListValues>
<DefaultMethodology>0</DefaultMethodology>
<Algorithm>1</Algorithm>
</CloseTradeFilter>
<NetPositions>
<Position>
<BrokenRulesCollection />
<ID>39f10d1f-a6f0-4dcc-9193-d1404a27babd</ID>
<ModifiedAt>2006-12-28T15:01:03.8640112+05:30</ModifiedAt>
<StartDate>2006-12-28T15:01:03.8484049+05:30</StartDate>
<ModifiedBy>0</ModifiedBy>
<Symbol>GOOG</Symbol>
<FundValue>
<BrokenRulesCollection />
<ID>1</ID>
<ShortName />
<FullName>FundA</FullName>
</FundValue>
<AveragePrice>27.4833333333333</AveragePrice>
<PositionType>Long</PositionType>
<AUECID>1</AUECID>
<OpenQty>5500</OpenQty>
<ClosedQty>5000</ClosedQty>
<GeneratedPNL>118149.7618333335</GeneratedPNL>
<PositionTaxLots>
<AllocatedTrade xsi:nil="true" />
</PositionTaxLots>
</Position>
</NetPositions>
</CloseTradeInterface>
 
S

Sugandh Jain

they are basic datatypes,
int, string, datetime, and one one custom object for which the internal
properties are again basic, int, string and datetime types only.
no property in the allocated trade object is null.

Regards,
Sugandh
 
G

Guest

OK, so all the basics seem good. Your top level element is named
"ArrayOfAllocatedTrade". Is this an actual array? If so, is it possible you
have declared and instantiated the array, but not yet instantiated each
element within it? If so, this would produce the result you have.

D
 
K

Kevin Spencer

I answered this question in the other newsgroup you posted it to.

--
HTH,

Kevin Spencer
Microsoft MVP
Bit Player
http://unclechutney.blogspot.com

A pea rants as candy be sieving.

Sugandh Jain said:
I am using a method to serialize objects to xml.
this method is working fine to serialize most of the objects to Xml.

For one collection object, it is not doing so. The Collection and its
containing object are marked [Serilizable].

What could be the reasons for the object not getting serialize, and this
is what i get.

<?xml version="1.0"?>
<ArrayOfAllocatedTrade
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
</ArrayOfAllocatedTrade>

Allocated trade is an object with around 10-12 properties.


This is working fine for all other objects, sample right serialization,

<?xml version="1.0"?>
<CloseTradeInterface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<BrokenRulesCollection />
<CloseTradeFilter>
<BrokenRulesCollection />
<CloseTradeDate>2006-12-28T14:59:09.2045251+05:30</CloseTradeDate>
<Funds>
<Fund>
<BrokenRulesCollection />
<ID>1</ID>
<ShortName>FundA</ShortName>
<FullName />
</Fund>
</Funds>
<DataSourceNameID>
<BrokenRulesCollection />
<ID>1</ID>
<FullName />
<ShortName />
</DataSourceNameID>
<AUECListValues>
<AUEC>
<BrokenRulesCollection />
<AUECID>1</AUECID>
<AUECName>Equity\US\NASDAQ\USD</AUECName>
</AUEC>
<AUEC>
<BrokenRulesCollection />
<AUECID>11</AUECID>
<AUECName>Equity\US\ARCA\USD</AUECName>
</AUEC>
</AUECListValues>
<DefaultMethodology>0</DefaultMethodology>
<Algorithm>1</Algorithm>
</CloseTradeFilter>
<NetPositions>
<Position>
<BrokenRulesCollection />
<ID>39f10d1f-a6f0-4dcc-9193-d1404a27babd</ID>
<ModifiedAt>2006-12-28T15:01:03.8640112+05:30</ModifiedAt>
<StartDate>2006-12-28T15:01:03.8484049+05:30</StartDate>
<ModifiedBy>0</ModifiedBy>
<Symbol>GOOG</Symbol>
<FundValue>
<BrokenRulesCollection />
<ID>1</ID>
<ShortName />
<FullName>FundA</FullName>
</FundValue>
<AveragePrice>27.4833333333333</AveragePrice>
<PositionType>Long</PositionType>
<AUECID>1</AUECID>
<OpenQty>5500</OpenQty>
<ClosedQty>5000</ClosedQty>
<GeneratedPNL>118149.7618333335</GeneratedPNL>
<PositionTaxLots>
<AllocatedTrade xsi:nil="true" />
</PositionTaxLots>
</Position>
</NetPositions>
</CloseTradeInterface>
 
S

sloan

Sugandh Jain,

If you list the other group where you posted, I will provide a url with
examples for you.

Posting seperate messages to different groups ... ends up wasting people's
time because the question may have already been answered somewhere else.

...




Kevin Spencer said:
I answered this question in the other newsgroup you posted it to.

--
HTH,

Kevin Spencer
Microsoft MVP
Bit Player
http://unclechutney.blogspot.com

A pea rants as candy be sieving.

Sugandh Jain said:
I am using a method to serialize objects to xml.
this method is working fine to serialize most of the objects to Xml.

For one collection object, it is not doing so. The Collection and its
containing object are marked [Serilizable].

What could be the reasons for the object not getting serialize, and this
is what i get.

<?xml version="1.0"?>
<ArrayOfAllocatedTrade
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
<AllocatedTrade xsi:nil="true" />
</ArrayOfAllocatedTrade>

Allocated trade is an object with around 10-12 properties.


This is working fine for all other objects, sample right serialization,

<?xml version="1.0"?>
<CloseTradeInterface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<BrokenRulesCollection />
<CloseTradeFilter>
<BrokenRulesCollection />
<CloseTradeDate>2006-12-28T14:59:09.2045251+05:30</CloseTradeDate>
<Funds>
<Fund>
<BrokenRulesCollection />
<ID>1</ID>
<ShortName>FundA</ShortName>
<FullName />
</Fund>
</Funds>
<DataSourceNameID>
<BrokenRulesCollection />
<ID>1</ID>
<FullName />
<ShortName />
</DataSourceNameID>
<AUECListValues>
<AUEC>
<BrokenRulesCollection />
<AUECID>1</AUECID>
<AUECName>Equity\US\NASDAQ\USD</AUECName>
</AUEC>
<AUEC>
<BrokenRulesCollection />
<AUECID>11</AUECID>
<AUECName>Equity\US\ARCA\USD</AUECName>
</AUEC>
</AUECListValues>
<DefaultMethodology>0</DefaultMethodology>
<Algorithm>1</Algorithm>
</CloseTradeFilter>
<NetPositions>
<Position>
<BrokenRulesCollection />
<ID>39f10d1f-a6f0-4dcc-9193-d1404a27babd</ID>
<ModifiedAt>2006-12-28T15:01:03.8640112+05:30</ModifiedAt>
<StartDate>2006-12-28T15:01:03.8484049+05:30</StartDate>
<ModifiedBy>0</ModifiedBy>
<Symbol>GOOG</Symbol>
<FundValue>
<BrokenRulesCollection />
<ID>1</ID>
<ShortName />
<FullName>FundA</FullName>
</FundValue>
<AveragePrice>27.4833333333333</AveragePrice>
<PositionType>Long</PositionType>
<AUECID>1</AUECID>
<OpenQty>5500</OpenQty>
<ClosedQty>5000</ClosedQty>
<GeneratedPNL>118149.7618333335</GeneratedPNL>
<PositionTaxLots>
<AllocatedTrade xsi:nil="true" />
</PositionTaxLots>
</Position>
</NetPositions>
</CloseTradeInterface>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top