Stuart

Stuart

  • NA
  • 8
  • 0

Does XML Value equal Class Value?

Aug 1 2006 11:25 AM

Hi all,

I am building some data collection pda software where at the end, based on the results the user is told different things from an xml file (fully configureable by the client) but need to find out how to map an xml value to a variable within my class.

I have a class i.e.

public class myClass
{
     string s1 = string.empty;
     string s2 = string.empty;
     .... (200+ vars)
    
     public myClass()
     {

      }
  
      public string StringOne { get { return s1 ; } set { s1 = value ; } };
      public string StringTwo { get { return s2 ; } set { s2 = value ; } };
}

And an xml file:

<Parameters>
  <Param parameter="StringOne" relop="E" value="test" />
  <Param parameter="StingTwo" relop="E" value="test" />
</Parameters>

What I now need to do is loop around each parameter and check to see if parameter1.paramerter (object created from <Param>) = myClass.\paramter\.text.

Has anyone got any idea how to do this?

I would prefer something dynamic so as not to go through having to map 200+ vars myself. but any suggestions are welcomed.

Thanks in advance

Stuart