Monday, 15 April 2013

c# - How to load an XML Document to display as specific input format -



c# - How to load an XML Document to display as specific input format -

i trying load xml document c# programme can send soap request.

here xml document trying reference. has potential infinite number of rows.

<?xml version="1.0" encoding="utf-8" ?> <rowset> <row num="1"> <user_id></user_id> <first_name>john</first_name> <middle_name></middle_name> <last_name>doe</last_name> <employee_no>12345</employee_no> <home_phone></home_phone> <employee_status_>a</employee_status_> <hire_date>05/17/2010</hire_date> <department>engineering</department> <position>controls engineer</position> <shift>n</shift> <reports_to>everhart,robert</reports_to> <pay_type>h</pay_type> <employee_type>r</employee_type> <termination_date></termination_date> <pcn_code>company_rv</pcn_code> </row> <row num="2"> <user_id>rv12345</user_id> <first_name>jane</first_name> <middle_name>g</middle_name> <last_name>doe</last_name> <employee_no>123455</employee_no> <home_phone></home_phone> <employee_status_>a</employee_status_> <hire_date>09/15/2008</hire_date> <department>shipping</department> <position>shipping coordinator</position> <shift>2</shift> <reports_to>hajkova,karin</reports_to> <pay_type>h</pay_type> <employee_type>r</employee_type> <termination_date></termination_date> <pcn_code>company_rv</pcn_code>

i need format file into:

<resultset> <rowcount>1</rowcount> <rows> <row> <columns> <column> <value>jdoe</value> <name>user_id</name> </column> <column> <value>john</value> <name>first_name</name> , forth

once xml file has been loaded , massaged right format variable containing xml info placed soap envelope.

try using xsd tool original xml in order create classes serialize xml on memory.

then utilize xmlserializer in order memmory:

xmlserializer serializer = new xmlserializer(xmlclasstypeyoucreatedonxsdtool); xmlreader reader = new xmltextreader(xml); var instance = serializer.deserialize(reader);

use same xsd tool output xml form want create in order form serializable classes.

create functions transform 1 object send object soap webreferences or utilize same xmlserializer , phone call serialize generate xml soap messages.

c# xml soap

No comments:

Post a Comment