XML Serialization Using Attributes.. Urgent Help
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server > XML Serialization Using Attributes.. Urgent Help




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    XML Serialization Using Attributes.. Urgent Help  
Vishal


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-25-04 10: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.





[ Post a follow-up to this message ]



    RE: XML Serialization Using Attributes.. Urgent Help  
Alan Smith


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-04 07: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/frlrfsystemxmlseri
alizationxmlignoreattributeclasstopic.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 t
he
> source I do not want those attributes to show up at destination output lev
el.
> 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.





[ Post a follow-up to this message ]



    RE: XML Serialization Using Attributes.. Urgent Help  
Vishal


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-26-04 12:46 PM

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/frlrfsystemxmlse
rializationxmlignoreattributeclasstopic.htm
>
> Regards,
>
> Alan
>
>
>
> "Vishal" wrote:
> 





[ Post a follow-up to this message ]



    RE: XML Serialization Using Attributes.. Urgent Help  
John


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-27-04 10: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:
> 





[ Post a follow-up to this message ]



    RE: XML Serialization Using Attributes.. Urgent Help  
John


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
10-27-04 10: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:
> 





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 12:52 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register