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"?>
<ArrayOfAllocat edTrade xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
</ArrayOfAllocate dTrade>
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"?>
<CloseTradeInte rface xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<BrokenRulesCol lection />
<CloseTradeFilt er>
<BrokenRulesCol lection />
<CloseTradeDate >2006-12-28T14:59:09.204 5251+05:30</CloseTradeDate>
<Funds>
<Fund>
<BrokenRulesCol lection />
<ID>1</ID>
<ShortName>Fund A</ShortName>
<FullName />
</Fund>
</Funds>
<DataSourceName ID>
<BrokenRulesCol lection />
<ID>1</ID>
<FullName />
<ShortName />
</DataSourceNameI D>
<AUECListValues >
<AUEC>
<BrokenRulesCol lection />
<AUECID>1</AUECID>
<AUECName>Equit y\US\NASDAQ\USD </AUECName>
</AUEC>
<AUEC>
<BrokenRulesCol lection />
<AUECID>11</AUECID>
<AUECName>Equit y\US\ARCA\USD</AUECName>
</AUEC>
</AUECListValues>
<DefaultMethodo logy>0</DefaultMethodol ogy>
<Algorithm>1</Algorithm>
</CloseTradeFilte r>
<NetPositions >
<Position>
<BrokenRulesCol lection />
<ID>39f10d1f-a6f0-4dcc-9193-d1404a27babd</ID>
<ModifiedAt>200 6-12-28T15:01:03.864 0112+05:30</ModifiedAt>
<StartDate>20 06-12-28T15:01:03.848 4049+05:30</StartDate>
<ModifiedBy>0 </ModifiedBy>
<Symbol>GOOG</Symbol>
<FundValue>
<BrokenRulesCol lection />
<ID>1</ID>
<ShortName />
<FullName>FundA </FullName>
</FundValue>
<AveragePrice>2 7.4833333333333 </AveragePrice>
<PositionType>L ong</PositionType>
<AUECID>1</AUECID>
<OpenQty>5500 </OpenQty>
<ClosedQty>5000 </ClosedQty>
<GeneratedPNL>1 18149.761833333 5</GeneratedPNL>
<PositionTaxLot s>
<AllocatedTra de xsi:nil="true" />
</PositionTaxLots >
</Position>
</NetPositions>
</CloseTradeInter face> 7 3283
What data types are the fields of the AllocatedTrade object?
D
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.mic rosoft.comwrote in message
news:AA******** *************** ***********@mic rosoft.com...
What data types are the fields of the AllocatedTrade object?
D
Is that custom object also set with the [Serializable] attribute?
D
yes, ofcourse, that is serializable.
Regards,
Sugandh
"David Musgrove" <Da***********@ discussions.mic rosoft.comwrote in message
news:73******** *************** ***********@mic rosoft.com...
Is that custom object also set with the [Serializable] attribute?
D
OK, so all the basics seem good. Your top level element is named
"ArrayOfAllocat edTrade". 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
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**********@n irvana-sol.comwrote in message
news:ug******** ******@TK2MSFTN GP06.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"?>
<ArrayOfAllocat edTrade
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
</ArrayOfAllocate dTrade>
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"?>
<CloseTradeInte rface xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<BrokenRulesCol lection />
<CloseTradeFilt er>
<BrokenRulesCol lection />
<CloseTradeDate >2006-12-28T14:59:09.204 5251+05:30</CloseTradeDate>
<Funds>
<Fund>
<BrokenRulesCol lection />
<ID>1</ID>
<ShortName>Fund A</ShortName>
<FullName />
</Fund>
</Funds>
<DataSourceName ID>
<BrokenRulesCol lection />
<ID>1</ID>
<FullName />
<ShortName />
</DataSourceNameI D>
<AUECListValues >
<AUEC>
<BrokenRulesCol lection />
<AUECID>1</AUECID>
<AUECName>Equit y\US\NASDAQ\USD </AUECName>
</AUEC>
<AUEC>
<BrokenRulesCol lection />
<AUECID>11</AUECID>
<AUECName>Equit y\US\ARCA\USD</AUECName>
</AUEC>
</AUECListValues>
<DefaultMethodo logy>0</DefaultMethodol ogy>
<Algorithm>1</Algorithm>
</CloseTradeFilte r>
<NetPositions >
<Position>
<BrokenRulesCol lection />
<ID>39f10d1f-a6f0-4dcc-9193-d1404a27babd</ID>
<ModifiedAt>200 6-12-28T15:01:03.864 0112+05:30</ModifiedAt>
<StartDate>20 06-12-28T15:01:03.848 4049+05:30</StartDate>
<ModifiedBy>0 </ModifiedBy>
<Symbol>GOOG</Symbol>
<FundValue>
<BrokenRulesCol lection />
<ID>1</ID>
<ShortName />
<FullName>FundA </FullName>
</FundValue>
<AveragePrice>2 7.4833333333333 </AveragePrice>
<PositionType>L ong</PositionType>
<AUECID>1</AUECID>
<OpenQty>5500 </OpenQty>
<ClosedQty>5000 </ClosedQty>
<GeneratedPNL>1 18149.761833333 5</GeneratedPNL>
<PositionTaxLot s>
<AllocatedTra de xsi:nil="true" />
</PositionTaxLots >
</Position>
</NetPositions>
</CloseTradeInter face>
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**********@n othinks.comwrot e in message
news:uz******** *****@TK2MSFTNG P06.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**********@n irvana-sol.comwrote in message
news:ug******** ******@TK2MSFTN GP06.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"?>
<ArrayOfAllocat edTrade
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
<AllocatedTra de xsi:nil="true" />
</ArrayOfAllocate dTrade>
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"?>
<CloseTradeInte rface
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<BrokenRulesCol lection />
<CloseTradeFilt er>
<BrokenRulesCol lection />
<CloseTradeDate >2006-12-28T14:59:09.204 5251+05:30</CloseTradeDate>
<Funds>
<Fund>
<BrokenRulesCol lection />
<ID>1</ID>
<ShortName>Fund A</ShortName>
<FullName />
</Fund>
</Funds>
<DataSourceName ID>
<BrokenRulesCol lection />
<ID>1</ID>
<FullName />
<ShortName />
</DataSourceNameI D>
<AUECListValues >
<AUEC>
<BrokenRulesCol lection />
<AUECID>1</AUECID>
<AUECName>Equit y\US\NASDAQ\USD </AUECName>
</AUEC>
<AUEC>
<BrokenRulesCol lection />
<AUECID>11</AUECID>
<AUECName>Equit y\US\ARCA\USD</AUECName>
</AUEC>
</AUECListValues>
<DefaultMethodo logy>0</DefaultMethodol ogy>
<Algorithm>1</Algorithm>
</CloseTradeFilte r>
<NetPositions >
<Position>
<BrokenRulesCol lection />
<ID>39f10d1f-a6f0-4dcc-9193-d1404a27babd</ID>
<ModifiedAt>200 6-12-28T15:01:03.864 0112+05:30</ModifiedAt>
<StartDate>20 06-12-28T15:01:03.848 4049+05:30</StartDate>
<ModifiedBy>0 </ModifiedBy>
<Symbol>GOOG</Symbol>
<FundValue>
<BrokenRulesCol lection />
<ID>1</ID>
<ShortName />
<FullName>FundA </FullName>
</FundValue>
<AveragePrice>2 7.4833333333333 </AveragePrice>
<PositionType>L ong</PositionType>
<AUECID>1</AUECID>
<OpenQty>5500 </OpenQty>
<ClosedQty>5000 </ClosedQty>
<GeneratedPNL>1 18149.761833333 5</GeneratedPNL>
<PositionTaxLot s>
<AllocatedTra de xsi:nil="true" />
</PositionTaxLots >
</Position>
</NetPositions>
</CloseTradeInter face>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 brand new object when deserializing. In my case I have an existing object that I'd like to pass some XML to for the object to repopulate its member variables. Similarly I'd like it to be able to populate an XML string from the values of its member...
|
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 s);
public void Deserialize(Stream s);
Within the MyUserControl class, there is a field of type MyInnerClass
|
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;
string s_FinalFileName;
try
|
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
'System.Runtime.Serialization.SerializationException' occurred in
mscorlib.dll) . Thx in advance. Here is the part of the code:
Regards
MAY
|
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
{
| |
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.
Database.cs
DatabaseFactory.cs
DatabaseProviderFactory.cs
DBCommandWrapper.cs
|
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
schema using xsd.exe, which took a while because xsd doesn't handle
recursive elements very well (StackOverFlow exception during generation).
Now that I have the classes I am trying to serialize them to an xml document
to send to ArcIMS to generate...
|
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 'StateServer' and 'SQLServer'
mode, ASP.NET will serialize the session state objects, and as a result
non-serializable objects or MarshalByRef objects are not permitted. The same
|
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 Building._Name to Building._BName
in case the duplicate name was the issue, but that didn't help.
Is there a native way to serialize nested objects, or will I have to write
my own?
public class LocationCell
|
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 = "recorder (*.record)|*.record"
End With
If sdf.ShowDialog = Windows.Forms.DialogResult.OK Then
Dim Serializer As New
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |