Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:49:54+00:00 2026-06-07T21:49:54+00:00

I have a xml as below: <?xml version=1.0 encoding=ISO-8859-1?> <TestCase Name=1.7 Bus01> <Action Word=Login

  • 0

I have a xml as below:

<?xml version="1.0" encoding="ISO-8859-1"?>
<TestCase Name="1.7 Bus01">
 <Action Word="Login" Text="Login" TestCaseId="MPD_QS_06">
    <Parameter Name="userName" Value="user1"/>
    <Parameter Name="userPwd" Value="user1"/>
    <Parameter Name="Tenant" Value="tnt1"/>
    <Parameter Name="expectedResult" Value="Login success"/>
 </Action>
 <Action Word="AddOrganisation" Text="AddOrganisation">
    <Parameter Name="name" Value="MAHNEWX"/>
    <Parameter Name="senderId" Value=""/>
    <Parameter Name="address" Value="77 Westferry Circus"/>
    <Parameter Name="postCode" Value="E77 4 HB"/>
    <Parameter Name="city" Value="London"/>
    <Parameter Name="country" Value="United Kingdom"/>
    <Parameter Name="state" Value=""/>
    <Parameter Name="email" Value=""/>
    <Parameter Name="telCountryCode" Value=""/>
    <Parameter Name="telNumber" Value=""/>
    <Parameter Name="telExtension" Value=""/>
    <Parameter Name="faxCountryCode" Value=""/>
    <Parameter Name="faxNumber" Value=""/>
    <Parameter Name="faxExtension" Value=""/>
    <Parameter Name="roleList" Value="MAH"/>
    <Parameter Name="expectedResult" Value="Organisation is added"/>
  </Action>
  <Action Word="NewValidationRegistration" Text="NewValidationRegistration">
    <Parameter Name="registrationname" Value="FusionUnion"/>
    <Parameter Name="AS2Identifier" Value="MPTVC"/>
    <Parameter Name="expectedResult" Value="Registration is validated"/>
  </Action>
  <Action Word="NewSubmissionRegistration" Text="NewSubmissionRegistration">
     <Parameter Name="registrationname" Value="FusionUnion"/>
     <Parameter Name="AS2Identifier" Value="MPTVC"/>
     <Parameter Name="expectedResult" Value="Registration is submitted"/>
  </Action>
  <Action Word="Logout" Text="Logout">
     <Parameter Name="expectedResult" Value="Logout success"/>
  </Action>
</TestCase> 

For each Action Word I have a method. How can I read this xml and execute the methods dynamically with parameters. The Parameter Name s are actual variables in my methods. The number of parameters differs each time. Precisely, I want to read the xml and get the list of action words and then execute them using the values.
Thanks for ur help in advance.

-Sasi

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:49:55+00:00Added an answer on June 7, 2026 at 9:49 pm
    object obj = this; //your object containing methods
    XDocument xDoc = XDocument.Parse(xml);
    Type type = obj.GetType(); 
    
    foreach (var action in xDoc.Descendants("Action"))
    {
        MethodInfo mi = type.GetMethod(action.Attribute("Word").Value);
    
        var dict =  action.Descendants().ToDictionary(
                                             d=>d.Attribute("Name").Value,
                                             d=>d.Attribute("Value").Value);
    
        object[] parameters = mi.GetParameters()
            .Select(p => Convert.ChangeType(dict[p.Name],p.ParameterType))
            .ToArray();
    
        var expectedResult = mi.Invoke(obj, parameters);
    
        Debug.Assert(expectedResult.Equals(dict["expectedResult"]));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the below XML file <?xml version=1.0 encoding=iso-8859-1?> <DATASET> <TYPE>success</TYPE> <RECORD> <DATA type=email>eeee@eee.net</DATA>
I have a simple xml below: <?xml version=1.0 encoding=utf-8?> <catalogue> <category name=textbook id=100 parent=books>
I have an xml file likes below. <?xml version=1.0 encoding=utf-8 ?> <Book> <Title>Title</Title> <Content>Content</Content>
I have a xml file as below: <?xml version=1.0 encoding=UTF-8 standalone=no?> <RULES> <RULE DESCRIPTION=
I have the xml below that I've pasted here with this rule: /bookstore/book/price/text() <?xml
I have the following XML: <?xml version=1.0 encoding=UTF-8?> <gnm:Workbook xmlns:gnm=http://www.gnumeric.org/v10.dtd xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:schemaLocation=http://www.gnumeric.org/v9.xsd> <office:document-meta xmlns:office=urn:oasis:names:tc:opendocument:xmlns:office:1.0
Below is the XML schema I am trying to conform to: <?xml version=1.0 encoding=UTF-8?>
I have an xml as below < Image>ImageValue1 <Type>png</Type> <Value>ImageValue1</ Value> </ Image> Here
I have an xml string below that I've turned into an object using $content
i have an xml file sitemap.xml as shown below ..i need to add one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.