hellbender212
New Member
I have the following Setting information i created.\[code\] <Settings><key name="MSH" pars_at="MSH" build_order="asc"><value name="field_separator" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="encoding_characters" always_full="1" child_count="4" child="1" child_key="ENCODING" index="1" /><value name="sending_application" always_full="1" child_count="0" child="0" child_key="" index="2" /><value name="sending_facility" always_full="1" child_count="0" child="0" child_key="" index="3" /><value name="receiving_application" always_full="0" child_count="0" child="0" child_key="" index="4" /><value name="receiving_facility" always_full="0" child_count="0" child="0" child_key="" index="5" /><value name="date_time_of_message" always_full="1" child_count="0" child="0" child_key="" index="6" /><value name="security" always_full="0" child_count="0" child="0" child_key="" index="7" /><value name="message_type" always_full="1" child_count="0" child="0" child_key="" index="8" /><value name="message_control_id" always_full="1" child_count="0" child="0" child_key="" index="9" /><value name="processing_id" always_full="1" child_count="0" child="0" child_key="" index="10" /><value name="version_id" always_full="1" child_count="0" child="0" child_key="" index="11" /></key><key name="MSA" pars_at="MSA" build_order="asc"><value name="acknowledgment_code" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="message_control_id" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="text_message" always_full="1" child_count="0" child="0" child_key="" index="2" /></key><key name="PID" pars_at="PID" build_order="asc"><value name="set_id" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="patient_id" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="Patient_identifier_list" always_full="1" child_count="1" child="1" child_key="PIL" index="2" /><value name="alternate_patient_id" always_full="1" child_count="0" child="0" child_key="" index="3" /><value name="patient_name" always_full="0" child_count="0" child="1" child_key="PNM" index="4" /><value name="mothers_maiden_name" always_full="0" child_count="0" child="0" child_key="" index="5" /><value name="date_time_of_birth" always_full="1" child_count="0" child="0" child_key="" index="6" /><value name="administrative_sex" always_full="0" child_count="0" child="0" child_key="" index="7" /><value name="patinet_alias" always_full="1" child_count="0" child="0" child_key="" index="8" /><value name="race" always_full="1" child_count="0" child="0" child_key="" index="9" /><value name="patient_address" always_full="1" child_count="0" child="1" child_key="PAD" index="10" /><value name="country_code" always_full="1" child_count="0" child="0" child_key="" index="11" /><value name="phone_number_home" always_full="1" child_count="0" child="0" child_key="" index="12" /><value name="phone_number_business" always_full="1" child_count="0" child="0" child_key="" index="13" /><value name="primary_language" always_full="1" child_count="0" child="1" child_key="PRL" index="14" /><value name="marital_status" always_full="1" child_count="0" child="0" child_key="" index="15" /><value name="religion" always_full="1" child_count="0" child="0" child_key="" index="16" /><value name="patient_account_number" always_full="1" child_count="0" child="0" child_key="PAN" index="17" /><value name="ssn_number_patient" always_full="1" child_count="0" child="0" child_key="" index="18" /><value name="drivers_license_number_patient" always_full="1" child_count="0" child="0" child_key="" index="19" /><value name="mothers_identifier" always_full="1" child_count="0" child="0" child_key="" index="20" /><value name="etnic_group" always_full="1" child_count="0" child="0" child_key="" index="21" /></key><key name="QRD" pars_at="QRD" build_order="asc"><value name="query_date_time" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="query_format_code" always_full="1" child_count="" child="0" child_key="" index="1" /><value name="query_priority" always_full="1" child_count="0" child="0" child_key="" index="2" /><value name="deferred_response_type" always_full="1" child_count="0" child="0" child_key="" index="3" /><value name="deferred_response_date_time" always_full="0" child_count="0" child="0" child_key="" index="4" /><value name="quantity_limited_request" always_full="0" child_count="0" child="1" child_key="QLR" index="5" /><value name="who_subject_filter" always_full="1" child_count="0" child="1" child_key="WSF" index="6" /><value name="what_subject_filter" always_full="0" child_count="0" child="0" child_key="" index="7" /></key><key name="QRF" pars_at="QRF" build_order="asc"><value name="where_subject_filter" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="when_data_start_date_time" always_full="1" child_count="" child="0" child_key="" index="1" /><value name="when_data_end_date_time" always_full="1" child_count="0" child="0" child_key="" index="2" /><value name="what_user_qualifier" always_full="1" child_count="0" child="0" child_key="" index="3" /></key><key name="DSC" pars_at="DSC" build_order="asc"><value name="continuation_counter" always_full="1" child_count="0" child="0" child_key="" index="0" /></key><key name="QLR" pars_at="" build_order="asc"><value name="quantity_limited_request_quantity" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="quantity_limited_request_units" always_full="1" child_count="0" child="0" child_key="" index="1" /></key><key name="WSF" pars_at="" build_order="asc"><value name="who_subject_filter_id_number" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="who_subject_filter_name" always_full="1" child_count="0" child="0" child_key="" index="1" /></key><key name="PIL" pars_at="" build_order="asc"><value name="patient_identifier_list_id" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="patient_identifier_list_check_digit" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="patient_identifier_list_scheam_code_id" always_full="1" child_count="0" child="0" child_key="" index="2" /></key><key name="PIL" pars_at="" build_order="asc"><value name="patient_identifier_list_id" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="patient_identifier_list_check_digit" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="patient_identifier_list_scheam_code_id" always_full="1" child_count="0" child="0" child_key="" index="2" /></key><key name="PNM" pars_at="" build_order="asc"><value name="mothers_maiden_name" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="patient_name_given" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="patient_name_middle" always_full="1" child_count="0" child="0" child_key="" index="2" /><value name="patient_name_suffix" always_full="1" child_count="0" child="0" child_key="" index="3" /><value name="patient_name_prefix" always_full="1" child_count="0" child="0" child_key="" index="4" /><value name="patient_name_degree" always_full="1" child_count="0" child="0" child_key="" index="5" /></key><key name="PAD" pars_at="" build_order="asc"><value name="patient_address_street" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="patient_address_other_designation" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="patient_address_city" always_full="1" child_count="0" child="0" child_key="" index="2" /><value name="patient_address_state" always_full="1" child_count="0" child="0" child_key="" index="3" /><value name="patient_address_zip" always_full="1" child_count="0" child="0" child_key="" index="4" /><value name="patient_address_country" always_full="1" child_count="0" child="0" child_key="" index="5" /></key><key name="PRL" pars_at="" build_order="asc"><value name="primary_language_identifier" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="primary_language_text" always_full="1" child_count="0" child="0" child_key="" index="1" /></key><key name="PAN" pars_at="" build_order="asc"><value name="patient_account_number_id" always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="patient_account_number_check_digit" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="patient_account_number_scheam_code_id" always_full="1" child_count="0" child="0" child_key="" index="2" /></key><key name="ENCODING" pars_at="" build_order="asc"><value name="component_separator " always_full="1" child_count="0" child="0" child_key="" index="0" /><value name="subcomponent_separator" always_full="1" child_count="0" child="0" child_key="" index="1" /><value name="field_repeat_separator" always_full="1" child_count="0" child="0" child_key="" index="2" /><value name="escape_character" always_full="1" child_count="0" child="0" child_key="" index="3" /></key></Settings>\[/code\]I want to basically read this into the following code:\[code\]_values = new List<values>();_map = new Dictionary<string, List<value>>();\[/code\]the key for the dictionary will be the key name from the xml and the value object has fields that can hold the attributes.what is the best way to read it?here is what i tried to do:\[code\]public void loadXml() { _values = new List<values>(); _map = new Dictionary<string, List<values>>(); XmlReader reader = XmlReader.Create(@"name"); while (reader.Read() && !(reader.NodeType == XmlNodeType.EndElement&& reader.LocalName.Length>0)) { if (reader.LocalName.ToLower() == "key") { for (int i = 0; i < reader.AttributeCount; i++) { string val = reader; } } if (reader.LocalName.ToLower() == "value") { for (int i = 0; i < reader.AttributeCount; i++) { string val = reader; } } } }\[/code\]