473,320 Members | 1,953 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,320 software developers and data experts.

xml attribute serialization

i need to serialize my class into xml that looks like this:

<dog>
<breed type="large">spaniel</breed>
</dog>

but i'm not sure how to get an attribute into a property of my class, i can
use the xmlattribute tag to make an attribute of my dog class but i want an
attribute on my property, is this possible? if so how do i do it?

many thanks

Giles Morris
Nov 12 '05 #1
1 1122
How about something like:

class Breed
{
[XmlText]
string Name;

[XmlAttribute]
string type;
}

class Dog
{
Breed breed;
}

Type, like the breed's name is a property on its own. Both are kind of
attributes on breed. Only complex types (classes) can have more than one
property.

HTH,
www.sportbootcharter.com
Axel Dahmen

--------------------
"Giles M" <Gi****@discussions.microsoft.com> schrieb im Newsbeitrag
news:78**********************************@microsof t.com...
i need to serialize my class into xml that looks like this:

<dog>
<breed type="large">spaniel</breed>
</dog>

but i'm not sure how to get an attribute into a property of my class, i can use the xmlattribute tag to make an attribute of my dog class but i want an attribute on my property, is this possible? if so how do i do it?

many thanks

Giles Morris

Nov 12 '05 #2

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

Similar topics

2
by: Bill Cohagan | last post by:
In my app I'm validating an XML file against an XSD which contains several attribute default value specifications. I'm performing the validation via an xml document load() using a...
1
by: Julia Beresford | last post by:
Hi I have a c# class defined as follows: public class Registry { /// <remarks/>
0
by: Woody | last post by:
I need to group some attribute for use in different types, but if I nest an attributegroup inside another one I miss the nested attribute in class generated with xsd.exe. For example if I use the...
5
by: Neil Norfolk | last post by:
I am using C# in Visual Studio 2003. I would like to serialize a class that contains, amongst other things, public delegate void DocumentsPreferencesChange(object env, Documents e); public event...
1
by: jhcorey | last post by:
I have a class that I'm serializing to xml. To omit some properties from the xml I use the attribute. Now I'm thinking that sometimes I want to include those properties, so I'm wondering if...
1
by: Eric | last post by:
Hi, I have a WS client. All the code is generated by VS.NET 2003. For me its seems that an attribute is not generated during sending the request in the SOAPHeader. The problem is with...
9
by: Philipp | last post by:
Hello. OK I know this is the most asked question in XML (it says in some tutorial), but still. Please give me your insight on this (as I'm a newbie). I want to store parameters for a programm in...
0
by: Jeremy Chapman | last post by:
I'm building a class with xml serialization attrbutes. Below I've included the class and the xml it serializes to. It pretty much matches what I want except for the Message property of the...
3
by: Kevin Burton | last post by:
I have an XSD that is converted from a DTD that I am trying to clean up. There is a section in the XSD that looks like: <xs:element name="partnerID"> <xs:complexType mixed="true">...
9
by: Mark Olbert | last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c. The problem I'm running into is that the root element needs to be unqualified,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.