Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2007

Tip: Looking for answers? Try searching our database.

Do Not Show Property?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lucius - 10 Jul 2007 20:12 GMT
I have a public property with this attribute decorating it:

 [System.Xml.Serialization.SoapIgnoreAttribute]

but when I convert an object to XML (it inherits from
System.Data.DataTable), it still shows as a Property in the raw XML.

Why does it do this and how can I make it stop? I don't want any
properties to exist in the XML, just the rows from the DataTable.

Thanks.
Steven Cheng[MSFT] - 11 Jul 2007 05:52 GMT
Hi Lucius,

I think the problem you met here is due to the attribute you used.
"SoapIgnoreAttribute" is designed for decorating classes that will be
serialized through SoapFormatter:

#SoapFormatter Class
http://msdn2.microsoft.com/en-us/library/system.runtime.serialization.format
ters.soap.soapformatter(VS.71).aspx

actually, both SoapFormatter and BinaryFormatter are used for binary
serialization. For XML serialization, you should use "XmlIgnoreAttribute"
to exclude property/fields that you do not want to serialize:

#XmlIgnoreAttribute Class
http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlignorea
ttribute.aspx

e.g.

   [XmlIgnore()]
       public int Property2
       {
           get { return _prop2; }
           set {
               _prop2 = value;
               }
       }
<<<<<<<<<<<<<<<<<<<<<<

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Steven Cheng[MSFT] - 13 Jul 2007 08:11 GMT
Hi Lucius,

Does this helps you or have you any further questions on this? Please feel
free to let me know if there is anything else we can help.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
   

This posting is provided "AS IS" with no warranties, and confers no rights.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.