BizTalk Server - XML Serialization Using Attributes.. Urgent Help

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server > October 2004 > XML Serialization Using Attributes.. Urgent Help





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author XML Serialization Using Attributes.. Urgent Help
Vishal

2004-10-25, 5:48 pm

Hello All,
I am using properties to create an xsd file at runtime for my destination
schema.
The output is consumed by a webservice and the databases are affected.
But i have a problem, in case some of the attributes are not passed from the
source I do not want those attributes to show up at destination output level.
I want that the property shall not get initialized and the attribute shall
not get included in the destination xsd.
Followwing is the example for the property:

public string ProductKey
{
get { return _ProductKey; }
set { _ProductKey = value; }
}

Kindly help.... its urgent..
Vishal.
Alan Smith

2004-10-26, 2:46 am

Hi Vizsal,

..net povides a bunch of attributes that you can use to specify how the
public fields are serialised. You could use the XmlIgnore attribute to
specify this:

public class Group
{
// The XmlSerializer ignores this field.
[XmlIgnore]
public string Comment;

// The XmlSerializer serializes this field.
public string GroupName;
}


More info in the Visual Stidio help file:

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/ frlrfsystemxmlserializationxmlignoreattr
ibuteclasstopic.htm

Regards,

Alan



"Vishal" wrote:

> Hello All,
> I am using properties to create an xsd file at runtime for my destination
> schema.
> The output is consumed by a webservice and the databases are affected.
> But i have a problem, in case some of the attributes are not passed from the
> source I do not want those attributes to show up at destination output level.
> I want that the property shall not get initialized and the attribute shall
> not get included in the destination xsd.
> Followwing is the example for the property:
>
> public string ProductKey
> {
> get { return _ProductKey; }
> set { _ProductKey = value; }
> }
>
> Kindly help.... its urgent..
> Vishal.

Vishal

2004-10-26, 7:46 am

Thanks Alan,
But the problem is that I do not want to ignore the attribute all the time
rather then if it is not send by source then ignore it. Hope you have
understood,
Let me know,
Vishal.

"Alan Smith" wrote:
[vbcol=seagreen]
> Hi Vizsal,
>
> .net povides a bunch of attributes that you can use to specify how the
> public fields are serialised. You could use the XmlIgnore attribute to
> specify this:
>
> public class Group
> {
> // The XmlSerializer ignores this field.
> [XmlIgnore]
> public string Comment;
>
> // The XmlSerializer serializes this field.
> public string GroupName;
> }
>
>
> More info in the Visual Stidio help file:
>
> ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/ frlrfsystemxmlserializationxmlignoreattr
ibuteclasstopic.htm
>
> Regards,
>
> Alan
>
>
>
> "Vishal" wrote:
>
John

2004-10-27, 5:49 pm

Hi Vishal,

You have three options

1. Write your own custom attribute
2. Override the serialization and do it yourself
3. Cry and go for a drink

The decision is yours!

John

"Vishal" wrote:
[vbcol=seagreen]
> Thanks Alan,
> But the problem is that I do not want to ignore the attribute all the time
> rather then if it is not send by source then ignore it. Hope you have
> understood,
> Let me know,
> Vishal.
>
> "Alan Smith" wrote:
>
John

2004-10-27, 5:49 pm

Hi Vishal,

You have three options

1. Write your own custom attribute
2. Override the serialization and do it yourself
3. Cry and go for a drink

The decision is yours!

John

"Vishal" wrote:
[vbcol=seagreen]
> Thanks Alan,
> But the problem is that I do not want to ignore the attribute all the time
> rather then if it is not send by source then ignore it. Hope you have
> understood,
> Let me know,
> Vishal.
>
> "Alan Smith" wrote:
>
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com