473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Controlling order of serialization

Hello,

how can I control the order of which elements are serialized. For example,
my class looks like:

public __gc class Author {
public:
Author();

// get/set methods

[System::Xml::Se rialization::Xm lAttributeAttri bute("createdBy ")]
__property System::String* get_createdBy() ;
__property void set_createdBy(S ystem::String* s);

[System::Xml::Se rialization::Xm lAttributeAttri bute("createdBy Email")]
__property System::String* get_createdByEm ail();
__property void set_createdByEm ail(System::Str ing* s);

protected:

// members

System::String* m_createdBy;
System::String* m_createdByEmai l;
};

And it is serialized like this:
<Author createdByEmail= "so*****@micros oft.com" createdBy="LIDA " />
But I would like it to be serialized like this:
<Author createdBy="LIDA " createdByEmail= "so*****@micros oft.com" />

Thanks!

--
Daniel
Nov 12 '05 #1
1 1663
you wrote
how can I control the order of which elements are serialized?
But really you are asking about the order of ATTRIBUTES, not ELEMENTS.

The order of attributes is not semantically important in XML Schema.

I don't believe this is "officially " controllable from the documented XML
Serialization interfaces (APIs and inline code attributes)

-Dino

"Daniel Lidström" <so*****@micros oft.com> wrote in message
news:f7******** *************** *****@40tude.ne t... Hello,

how can I control the order of which elements are serialized. For example,
my class looks like:

public __gc class Author {
public:
Author();

// get/set methods

[System::Xml::Se rialization::Xm lAttributeAttri bute("createdBy ")]
__property System::String* get_createdBy() ;
__property void set_createdBy(S ystem::String* s);

[System::Xml::Se rialization::Xm lAttributeAttri bute("createdBy Email")]
__property System::String* get_createdByEm ail();
__property void set_createdByEm ail(System::Str ing* s);

protected:

// members

System::String* m_createdBy;
System::String* m_createdByEmai l;
};

And it is serialized like this:
<Author createdByEmail= "so*****@micros oft.com" createdBy="LIDA " />
But I would like it to be serialized like this:
<Author createdBy="LIDA " createdByEmail= "so*****@micros oft.com" />

Thanks!

--
Daniel

Nov 12 '05 #2

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

Similar topics

3
2164
by: yadavindrian01 | last post by:
Hi everybody I am a student of computer engg. I have to make a project - controlling devices through computer using parallel port. I know necessary details of the parallel port. Please guide me. also tell me if can i use VB as front end and C++ as the coding language and how. Regards
10
3642
by: Mark C. Neustadt | last post by:
Okay, okay... from what I can find, I'm gonna be out of luck. I also understand that it *shouldn't* matter but it does. I'm trying to send some XML to Amazon and they're requiring the nodes to be in a specific order. I am supposed to send the elements in the following order:AmazonOrderID, MerchantOrderID, StatusCode and then a collection of Item elements. When I serialize my object, the XML is putting the StatusCode element after the...
2
1978
by: Bob Rundle | last post by:
I can't seem to control the soap formatting. SoapTypeAttribute() doesn't seem to have any affect on the SOAP serialization. Here is my sampe code. What am I doing wrong? Regards, Bob Rundle using System; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Soap;
1
2066
by: Daniel Lidström | last post by:
Hi, is there a way to control the order XmlSerializer serializes attributes? With this class, value is serialized before value. Although it shouldn't matter, I would like it the other way around, just for style. <Property value="" label="name" /> public __gc class Property {
2
2301
by: Daniel Lidström | last post by:
Hi, I would like to know the cleanest way to change the serialization of my Line class from: <Line staStart="2327.02" length="10.00000003390744"> <End>549016.570965 57945.741122</End> <Start>549019.590988 57955.274194</Start> </Line>
0
1124
by: RWC | last post by:
Hi! I'm having some trouble controlling how the XP Packaging Wizard installs my applications. In 97, there were options to replace older, never or always, if there was a file conflict. Now with XP, the user is prompted if they want to keep the file or not. I'd like to bypass this prompt and over write certain files, and NEVER overwrite others (the data file for instance). Right now, the user can choose to run the upgrade set up, but...
1
2457
by: Chris Rumsey via .NET 247 | last post by:
I want to be able to control the order error messages appear in the validation summary. They always seem to appear in reverse order ie not in the same order that the validation controls appear on the page. -------------------------------- From: Chris Rumsey ----------------------- Posted by a user from .NET 247 (http://www.dotnet247.com/) <Id>sOQiQ84IxU2dNojk+tctUw==</Id>
8
2457
by: jamie | last post by:
Here's a class I'm working with public class BatchHeader { public string ScaleSite; public string FromScaleDate;
1
2718
by: Phil Galey | last post by:
I'm using XMLSerializer in VB.NET to serialize class-based objects to XML. It's serializing fine, except that I don't seem to have control over the order in which the various fields (properties) of an object are serialized. If I change the order in which properties are defined in the object, it has no affect on the order in which there are serialized into the XML file. Is there a way of controlling the order in which object properties are...
0
8402
marktang
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...
0
8734
jinu1996
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...
0
8608
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
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...
1
6172
isladogs
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...
0
4164
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...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.