473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Serialize to Xml.

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>
Dec 28 '06 #1
7 3263
What data types are the fields of the AllocatedTrade object?

D
Dec 28 '06 #2
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

"David Musgrove" <Da***********@discussions.microsoft.comwrote in message
news:AA**********************************@microsof t.com...
What data types are the fields of the AllocatedTrade object?

D

Dec 28 '06 #3
Is that custom object also set with the [Serializable] attribute?

D
Dec 28 '06 #4
yes, ofcourse, that is serializable.

Regards,
Sugandh
"David Musgrove" <Da***********@discussions.microsoft.comwrote in message
news:73**********************************@microsof t.com...
Is that custom object also set with the [Serializable] attribute?

D

Dec 28 '06 #5
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
Dec 28 '06 #6
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" <su**********@nirvana-sol.comwrote in message
news:ug**************@TK2MSFTNGP06.phx.gbl...
>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>

Dec 28 '06 #7
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" <un**********@nothinks.comwrote in message
news:uz*************@TK2MSFTNGP06.phx.gbl...
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" <su**********@nirvana-sol.comwrote in message
news:ug**************@TK2MSFTNGP06.phx.gbl...
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>


Dec 28 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ian Tompsett | last post by:
H I was wondering if it possible for an object to serialize/deserialize itself from XML. I'd be guessing that it would need to use the XmlSerializer class, but that seems to want to create a...
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
10
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
3
by: MAY | last post by:
Hi, I have a problem about serialize the form controls. I wrote a test program to test serialize a from but fail (->An unhandled exception of type...
2
by: films | last post by:
I understand the concept. Serialization of a class will add all the sub-objects of the class to the stream if there are also serializible. So say I have: class Author {
1
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. ...
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
4
by: =?Utf-8?B?Qnlyb24=?= | last post by:
When I try to serialize an instance of the LocationCell below (note Building field) I get an error in the reflection attempt. If I remove the _Building field it serializes fine. I tried renaming...
9
by: Gillard | last post by:
i get an exeption and i do not know what else to do to continue Dim sdf As New SaveFileDialog With sdf .AddExtension = True .DefaultExt = ".record" .FileName = Now.ToLongDateString .Filter =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.