.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Which way to go? XMLElement or ConfigurationProperty?

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :.NET Framework
I'm in the process of defining a class to represent an XML file. I've found 2 ways to do this: using XML serialization and associated attributes like XMLElement, XMLAttribute, as well as using custom configuration section. I feel like XML serialization is mainly for business data definition, such as Customer, Order etc, while custom configuration section is mainly for system setting parameters. Having said that, though, looking directly at the XML file per se, I don't have the good ability of choosing which way to go. So, can anyone kindly provide some knowledge on the difference between the two please? When should I choose one against another?   Thanks in advance. - Nico -You Can't Stop Me!

View Complete Post

More Related Resource Links

VB .Net XmlElement selectNodes() XPath

Helo, I tried to use the XmlElement 's selectNodes() method. This method accepts as a parameter the XPath string to select the proper node under that element http://msdn.microsoft.com/library/d...nodestopic2.asp when i tried this with the path "//*" I get all the nodes as I expected but when I used "//Response" which is one of the nodes return ealier I get empty XmlNodeList Why is it that the XPath is not working? rgds. ps : my code Dim nodes As XmlNodeList nodes = myxmlelement.SelectNodes("//Response")

NOT getting the defaultValue for a ConfigurationProperty


I have a very simple Configuration Section.....

public myConfigSection : ConfigurationSection


   [ConfigurationProperty("MyValue", DefaultValue = null)]

   public string MyValue


      get { return (string)base["MyValue"]; }

      set { base["MyValue"] = value; }




My problem is that I never get null returned (as stated in the default value) I get an empty string instead.

An empty string is a valid configuration item that the business can specify for this in the configuration file. I now need to know if the the configuration file has an empty string or if it does not contain this item in the configuration file.


I have seen a few posts for this but nothings appears to provide a solution.




Generated Service References now use XElement not XmlElement since 2010 Upgrade


We've just upgraded from VS2008 to VS2010 and we're having issues with the generated code of service references.

Where previously the generated code used XmlElement classes, it now used the LINQ class XElement. As a result the projects do not compile.

We have a workaround of reverting the Reference.cs files back to the version prior to the upgrade, but this will only work for us until the point at which we need to regenerate the service references, and as we're actively developing the services, that's likely to be very soon.

Is there way to make the service references generate code using XmlElement not XElement?

For reference, the problem is most acute where we're using a SharePoint list, I know that's not going to need regenerating anytime soon, but we do have some of our own services that return XML data.

I know this isn't strictly a "Setup and Installation" question, but I couldn't establish what the correct forum would be.

Can a serviceHander return a String instead of an XmlElement?



I am looking for suggestions to improve performance of my visual basic code.

I am using Visual Studio 2008 to create a Visual Basic application that requests and receives data from a server, using the SOAP interface.  The payload is XML data.

I've created a "Service Reference" to handle these communications using the "Add Service Reference" dialogue,  specifying my  WSDL file in the "Address:" field.

Visual Studio successfully generates a vb file that contains the definitions for the interface, in particular the function  "serviceHandler".

To initiate a transaction I code:

   Dim SoapData  As New  WebService.DelegateClient
   Dim Reply As Xml.XmlElement

   Reply = SoapData.serviceHandler(....)

The "Reply" variable is successfully populated with nodes describing the XML tags and contents.

It is desired to place the  XML payload into a string variable.  This is done like so:

   Dim MyString As String  =  Reply.InnerText

Why the XmlElement's object is null?


Hi, I'm a beginner in web service developing.

I trying to create a C# Client that sends SOAP requests to a web service through HTTP POST method.

My web service's code is the following:

<%@ WebService Language="C#" Class="Demo1"%>

using System.Web.Services;
using System.Xml;
using System.IO;

[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Demo1 : WebService{

 public string ProcessRequest(XmlElement xmlDoc) {
  if(xmlDoc != null){
  return "object is not null";
 return "object is null";


My client's code is the following:

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend