RapidXML - Code creates unexpected result - c++

I have the following XML
<ActionMaps version="1" optionsVersion="2" rebindVersion="2" profileName="full_export">
<CustomisationUIHeader label="full_export" description="" image="">
<devices>
<keyboard instance="1"/>
<mouse instance="1"/>
</devices>
<categories>
<category label="#ui_CCSpaceFlight"/>
<category label="#ui_CGLightControllerDesc"/>
<category label="#ui_CCFPS"/>
<category label="#ui_CCEVA"/>
<category label="#ui_CGOpticalTracking"/>
<category label="#ui_CGInteraction"/>
</categories>
</CustomisationUIHeader>
<options type="keyboard" instance="1" Product="Tastatur {6F1D2B61-D5A0-11CF-BFC7-444553540000}">
<flight_move_yaw exponent="1.5"/>
</options>
<modifiers />
<actionmap name="spaceship_general">
<action name="v_close_all_doors">
<rebind input="kb1_0"/>
</action>
<action name="v_cooler_throttle_down">
<rebind input="kb1_6"/>
</action>
<action name="v_cooler_throttle_up">
<rebind input="kb1_5"/>
</action>
<action name="v_eject">
<rebind input="kb1_1"/>
</action>
<action name="v_emergency_exit">
<rebind input="kb1_4"/>
</action>
<action name="v_exit">
<rebind input="kb1_2"/>
</action>
<action name="v_flightready">
<rebind input="kb1_7"/>
</action>
<action name="v_lock_all_doors">
<rebind input="kb1_equals"/>
</action>
<action name="v_open_all_doors">
<rebind input="kb1_9"/>
</action>
<action name="v_self_destruct">
<rebind input="kb1_3"/>
</action>
<action name="v_toggle_all_doorlocks">
<rebind input="kb1_minus"/>
</action>
<action name="v_toggle_all_doors">
<rebind input="kb1_8"/>
</action>
<action name="v_unlock_all_doors">
<rebind input="kb1_q"/>
</action>
</actionmap>
<actionmap name="spaceship_view">
<action name="v_view_cycle_fwd">
<rebind input="kb1_u"/>
</action>
<action name="v_view_dynamic_focus_in">
<rebind input="kb1_rbracket"/>
</action>
<action name="v_view_dynamic_focus_out">
<rebind input="kb1_a"/>
</action>
<action name="v_view_freelook_mode">
<rebind input="kb1_lbracket"/>
</action>
<action name="v_view_look_behind">
<rebind input="kb1_s"/>
</action>
<action name="v_view_mode">
<rebind input="kb1_i"/>
</action>
<action name="v_view_pitch_down">
<rebind input="kb1_t"/>
</action>
<action name="v_view_pitch_mouse">
<rebind input="mo1_ "/>
</action>
<action name="v_view_pitch_up">
<rebind input="kb1_r"/>
</action>
<action name="v_view_yaw_left">
<rebind input="kb1_w"/>
</action>
<action name="v_view_yaw_mouse">
<rebind input="mo1_ "/>
</action>
<action name="v_view_yaw_right">
<rebind input="kb1_e"/>
</action>
<action name="v_view_zoom_in">
<rebind defaultInput="mwheel_up" input="kb1_o"/>
</action>
<action name="v_view_zoom_out">
<rebind defaultInput="mwheel_down" input="kb1_p"/>
</action>
</actionmap>
<actionmap name="spaceship_movement">
<action name="v_accel_range_down">
<rebind input="kb1_v"/>
</action>
<action name="v_accel_range_up">
<rebind input="kb1_c"/>
</action>
<action name="v_afterburner">
<rebind input="kb1_down"/>
</action>
<action name="v_autoland">
<rebind input="kb1_pgup"/>
</action>
<action name="v_brake">
<rebind input="kb1_backslash"/>
</action>
<action name="v_ifcs_toggle_cruise_control">
<rebind input="kb1_left"/>
</action>
<action name="v_ifcs_toggle_esp">
<rebind input="kb1_rctrl"/>
</action>
<action name="v_ifcs_toggle_gforce_safety">
<rebind input="kb1_ralt"/>
</action>
<action name="v_ifcs_toggle_speed_limiter">
<rebind input="kb1_lalt"/>
</action>
<action name="v_ifcs_toggle_vector_decoupling">
<rebind input="kb1_b"/>
</action>
<action name="v_pitch_down">
<rebind input="kb1_f"/>
</action>
<action name="v_pitch_up">
<rebind input="kb1_d"/>
</action>
<action name="v_roll_left">
<rebind input="kb1_k"/>
</action>
<action name="v_roll_right">
<rebind input="kb1_l"/>
</action>
<action name="v_speed_range_down">
<rebind input="kb1_x"/>
</action>
<action name="v_speed_range_up">
<rebind input="kb1_z"/>
</action>
<action name="v_strafe_back">
<rebind input="kb1_rshift"/>
</action>
<action name="v_strafe_down">
<rebind input="kb1_m"/>
</action>
<action name="v_strafe_forward">
<rebind input="kb1_slash"/>
</action>
<action name="v_strafe_left">
<rebind input="kb1_comma"/>
</action>
<action name="v_strafe_longitudinal_invert">
<rebind input="kb1_lctrl"/>
</action>
<action name="v_strafe_right">
<rebind input="kb1_period"/>
</action>
<action name="v_strafe_up">
<rebind input="kb1_n"/>
</action>
<action name="v_target_match_vel">
<rebind input="kb1_apostrophe"/>
</action>
<action name="v_toggle_landing_system">
<rebind input="kb1_up"/>
</action>
<action name="v_toggle_qdrive_engagement">
<rebind input="kb1_insert"/>
</action>
<action name="v_toggle_qdrive_spooling">
<rebind input="kb1_pgdn"/>
</action>
<action name="v_toggle_relative_mouse_mode">
<rebind input="kb1_j"/>
</action>
<action name="v_toggle_vtol">
<rebind input="kb1_right"/>
</action>
<action name="v_toggle_yaw_roll_swap">
<rebind input="kb1_semicolon"/>
</action>
<action name="v_yaw_left">
<rebind input="kb1_g"/>
</action>
<action name="v_yaw_right">
<rebind input="kb1_h"/>
</action>
</actionmap>
<actionmap name="spaceship_targeting">
<action name="v_aim_pitch_down">
<rebind input="kb1_print"/>
</action>
<action name="v_aim_pitch_up">
<rebind input="kb1_home"/>
</action>
<action name="v_aim_yaw_left">
<rebind input="kb1_delete"/>
</action>
<action name="v_aim_yaw_right">
<rebind input="kb1_end"/>
</action>
<action name="v_enter_remote_turret_1">
<rebind input="kb1_lshift+1"/>
</action>
<action name="v_enter_remote_turret_2">
<rebind input="kb1_lshift+2"/>
</action>
<action name="v_enter_remote_turret_3">
<rebind input="kb1_lshift+3"/>
</action>
<action name="v_invoke_ping">
<rebind defaultInput="mouse2" input="kb1_np_enter"/>
</action>
<action name="v_look_ahead_enable">
<rebind input="kb1_scrolllock"/>
</action>
<action name="v_look_ahead_start_target_tracking">
<rebind input="kb1_pause"/>
</action>
<action name="v_target_cycle_all_back">
<rebind input="kb1_np_7"/>
</action>
<action name="v_target_cycle_all_fwd">
<rebind input="kb1_np_subtract"/>
</action>
<action name="v_target_cycle_friendly_fwd">
<rebind input="kb1_np_8"/>
</action>
<action name="v_target_cycle_hostile_back">
<rebind input="kb1_np_6"/>
</action>
<action name="v_target_cycle_hostile_fwd">
<rebind input="kb1_np_5"/>
</action>
<action name="v_target_cycle_pinned_back">
<rebind input="kb1_np_4"/>
</action>
<action name="v_target_cycle_pinned_fwd">
<rebind input="kb1_np_add"/>
</action>
<action name="v_target_cycle_reticle_mode">
<rebind input="kb1_np_period"/>
</action>
<action name="v_target_cycle_subitem_back">
<rebind input="kb1_np_3"/>
</action>
<action name="v_target_cycle_subitem_fwd">
<rebind input="kb1_np_2"/>
</action>
<action name="v_target_deselect_entity">
<rebind input="kb1_np_multiply"/>
</action>
<action name="v_target_focus_root_entity">
<rebind input="kb1_np_0"/>
</action>
<action name="v_target_nearest_hostile">
<rebind input="kb1_np_1"/>
</action>
<action name="v_target_reticle_focus">
<rebind input="kb1_np_divide"/>
</action>
<action name="v_target_toggle_pinned_focused">
<rebind input="kb1_np_9"/>
</action>
<action name="v_toggle_mouse_aim_only">
<rebind input="kb1_numlock"/>
</action>
</actionmap>
<actionmap name="spaceship_target_hailing">
<action name="v_target_hail">
<rebind input="kb1_lshift+8"/>
</action>
</actionmap>
<actionmap name="spaceship_scanning">
<action name="v_scanning_trigger_scan">
<rebind defaultInput="mouse1" input="kb1_lshift+5"/>
</action>
<action name="v_toggle_scan_mode">
<rebind input="kb1_lshift+4"/>
</action>
</actionmap>
<actionmap name="spaceship_ping">
<action name="v_dec_ping_focus_angle">
<rebind defaultInput="mwheel_down" input="kb1_lshift+7"/>
</action>
<action name="v_inc_ping_focus_angle">
<rebind defaultInput="mwheel_up" input="kb1_lshift+6"/>
</action>
</actionmap>
<actionmap name="spaceship_mining">
<action name="v_decrease_mining_throttle">
<rebind defaultInput="mwheel_down" input="kb1_lshift+q"/>
</action>
<action name="v_increase_mining_throttle">
<rebind defaultInput="mwheel_up" input="kb1_lshift+backspace"/>
</action>
<action name="v_toggle_mining_laser_fire">
<rebind defaultInput="mouse1" input="kb1_lshift+0"/>
</action>
<action name="v_toggle_mining_laser_type">
<rebind defaultInput="mouse2" input="kb1_lshift+equals"/>
</action>
<action name="v_toggle_mining_mode">
<rebind input="kb1_lshift+9"/>
</action>
</actionmap>
<actionmap name="spaceship_turret">
<action name="v_aim_pitch_down">
<rebind input="kb1_lshift+t"/>
</action>
<action name="v_aim_pitch_up">
<rebind input="kb1_lshift+r"/>
</action>
<action name="v_aim_yaw_left">
<rebind input="kb1_lshift+w"/>
</action>
<action name="v_aim_yaw_right">
<rebind input="kb1_lshift+e"/>
</action>
<action name="v_target_cycle_all_back">
<rebind input="kb1_lshift+i"/>
</action>
<action name="v_target_cycle_all_fwd">
<rebind input="kb1_lshift+u"/>
</action>
<action name="v_target_cycle_friendly_back">
<rebind input="kb1_lshift+p"/>
</action>
<action name="v_target_cycle_friendly_fwd">
<rebind input="kb1_lshift+o"/>
</action>
<action name="v_target_cycle_hostile_back">
<rebind input="kb1_lshift+a"/>
</action>
<action name="v_target_cycle_hostile_fwd">
<rebind input="kb1_lshift+rbracket"/>
</action>
<action name="v_target_cycle_subitem_back">
<rebind input="kb1_lshift+g"/>
</action>
<action name="v_target_cycle_subitem_fwd">
<rebind input="kb1_lshift+f"/>
</action>
<action name="v_target_focus_root_entity">
<rebind input="kb1_lshift+d"/>
</action>
<action name="v_target_nearest_hostile">
<rebind input="kb1_lshift+s"/>
</action>
<action name="v_target_reticle_focus">
<rebind input="kb1_y"/>
</action>
<action name="v_target_toggle_pinned_focused">
<rebind input="kb1_lshift+lbracket"/>
</action>
</actionmap>
<actionmap name="spaceship_weapons">
<action name="v_attack1_group1">
<rebind defaultInput="mouse1" input="kb1_lshift+h"/>
</action>
<action name="v_attack1_group2">
<rebind defaultInput="mouse2" input="kb1_lshift+j"/>
</action>
<action name="v_turret_gyromode">
<rebind input="kb1_lshift+apostrophe"/>
</action>
<action name="v_weapon_cycle_aimmode">
<rebind input="kb1_lshift+semicolon"/>
</action>
<action name="v_weapon_cycle_ammo_back">
<rebind input="kb1_lshift+l"/>
</action>
<action name="v_weapon_cycle_ammo_fwd">
<rebind input="kb1_lshift+k"/>
</action>
</actionmap>
<actionmap name="spaceship_missiles">
<action name="v_weapon_arm_missile">
<rebind defaultInput="mouse3" input="kb1_lshift+backslash"/>
</action>
<action name="v_weapon_launch_missile">
<rebind defaultInput="mouse3" input="kb1_lshift+oem_102"/>
</action>
</actionmap>
<actionmap name="spaceship_defensive">
<action name="v_shield_raise_level_back">
<rebind input="kb1_lshift+b"/>
</action>
<action name="v_shield_raise_level_down">
<rebind input="kb1_lshift+slash"/>
</action>
<action name="v_shield_raise_level_forward">
<rebind input="kb1_lshift+v"/>
</action>
<action name="v_shield_raise_level_left">
<rebind input="kb1_lshift+m"/>
</action>
<action name="v_shield_raise_level_right">
<rebind input="kb1_lshift+comma"/>
</action>
<action name="v_shield_raise_level_up">
<rebind input="kb1_lshift+period"/>
</action>
<action name="v_shield_reset_level">
<rebind input="kb1_lshift+print"/>
</action>
<action name="v_weapon_cycle_countermeasure_back">
<rebind input="kb1_lshift+c"/>
</action>
<action name="v_weapon_cycle_countermeasure_fwd">
<rebind input="kb1_lshift+x"/>
</action>
<action name="v_weapon_launch_countermeasure">
<rebind input="kb1_lshift+z"/>
</action>
</actionmap>
<actionmap name="spaceship_power">
<action name="v_power_focus_group_1">
<rebind input="kb1_lshift+scrolllock"/>
</action>
<action name="v_power_focus_group_2">
<rebind input="kb1_lshift+pause"/>
</action>
<action name="v_power_focus_group_3">
<rebind input="kb1_lshift+insert"/>
</action>
<action name="v_power_reset_focus">
<rebind input="kb1_lshift+home"/>
</action>
<action name="v_power_throttle_down">
<rebind input="kb1_lshift+delete"/>
</action>
<action name="v_power_throttle_max">
<rebind input="kb1_lshift+pgdn"/>
</action>
<action name="v_power_throttle_min">
<rebind input="kb1_lshift+up"/>
</action>
<action name="v_power_throttle_up">
<rebind input="kb1_lshift+pgup"/>
</action>
<action name="v_power_toggle">
<rebind input="kb1_lshift+numlock"/>
</action>
<action name="v_power_toggle_group_1">
<rebind input="kb1_lshift+left"/>
</action>
<action name="v_power_toggle_group_2">
<rebind input="kb1_lshift+down"/>
</action>
<action name="v_power_toggle_group_3">
<rebind input="kb1_lshift+right"/>
</action>
</actionmap>
<actionmap name="spaceship_radar">
<action name="v_radar_cycle_zoom_fwd">
<rebind input="kb1_lshift+np_multiply"/>
</action>
<action name="v_radar_toggle_active_or_passive">
<rebind input="kb1_lshift+np_divide"/>
</action>
</actionmap>
<actionmap name="spaceship_hud">
<action name="mobiglas">
<rebind input="kb1_lshift+np_subtract"/>
</action>
<action name="v_hud_open_scoreboard">
<rebind input="kb1_lshift+np_7"/>
</action>
<action name="v_starmap">
<rebind input="kb1_lshift+np_8"/>
</action>
</actionmap>
<actionmap name="lights_controller">
<action name="v_lights">
<rebind input="kb1_lshift+np_9"/>
</action>
</actionmap>
<actionmap name="player">
<action name="attack1">
<rebind defaultInput="mouse1" input="kb1_rshift+2"/>
</action>
<action name="combatheal">
<rebind input="kb1_rshift+x"/>
</action>
<action name="crouch">
<rebind input="kb1_lshift+np_2"/>
</action>
<action name="drop">
<rebind input="kb1_rshift+j"/>
</action>
<action name="fixed_speed_decrement">
<rebind defaultInput="mwheel_down" input="kb1_rshift+oem_102"/>
</action>
<action name="fixed_speed_increment">
<rebind defaultInput="mwheel_up" input="kb1_rshift+backslash"/>
</action>
<action name="force_respawn">
<rebind input="kb1_rshift+slash"/>
</action>
<action name="free_thirdperson_camera">
<rebind input="kb1_rshift+b"/>
</action>
<action name="grenade">
<rebind input="kb1_rshift+equals"/>
</action>
<action name="holster">
<rebind input="kb1_rshift+h"/>
</action>
<action name="inspect">
<rebind input="kb1_rshift+k"/>
</action>
<action name="jump">
<rebind input="kb1_lshift+np_1"/>
</action>
<action name="leanleft">
<rebind input="kb1_lshift+np_period"/>
</action>
<action name="leanright">
<rebind input="kb1_rshift+1"/>
</action>
<action name="melee_AttackHeavyLeft">
<rebind defaultInput="mouse1" input="kb1_rshift+5"/>
</action>
<action name="melee_AttackHeavyRight">
<rebind defaultInput="mouse2" input="kb1_rshift+6"/>
</action>
<action name="melee_AttackLightLeft">
<rebind defaultInput="mouse1" input="kb1_rshift+3"/>
</action>
<action name="melee_AttackLightRight">
<rebind defaultInput="mouse2" input="kb1_rshift+4"/>
</action>
<action name="melee_block">
<rebind defaultInput="mouse1_2" input="kb1_rshift+7"/>
</action>
<action name="melee_dodgeBack">
<rebind input="kb1_rshift+0"/>
</action>
<action name="melee_dodgeLeft">
<rebind input="kb1_rshift+8"/>
</action>
<action name="melee_dodgeRight">
<rebind input="kb1_rshift+9"/>
</action>
<action name="mobiglas">
<rebind input="kb1_rshift+n"/>
</action>
<action name="moveback">
<rebind input="kb1_lshift+np_6"/>
</action>
<action name="moveforward">
<rebind input="kb1_lshift+np_5"/>
</action>
<action name="moveleft">
<rebind input="kb1_lshift+np_add"/>
</action>
<action name="moveright">
<rebind input="kb1_lshift+np_4"/>
</action>
<action name="nextweapon">
<rebind input="kb1_rshift+d"/>
</action>
<action name="pl_hud_open_scoreboard">
<rebind input="kb1_rshift+m"/>
</action>
<action name="port_modification_select">
<rebind defaultInput="mouse1" input="kb1_rshift+comma"/>
</action>
<action name="prevweapon">
<rebind input="kb1_rshift+f"/>
</action>
<action name="prone">
<rebind input="kb1_lshift+np_3"/>
</action>
<action name="refillgastank">
<rebind input="kb1_rshift+c"/>
</action>
<action name="reload">
<rebind input="kb1_rshift+g"/>
</action>
<action name="selectMeleeWeapon">
<rebind input="kb1_rshift+rbracket"/>
</action>
<action name="selectUnarmedCombat">
<rebind input="kb1_rshift+s"/>
</action>
<action name="selectUtilityItem">
<rebind input="kb1_rshift+a"/>
</action>
<action name="selectgadget">
<rebind input="kb1_rshift+lbracket"/>
</action>
SOME DELETED FOR DISPLAY PURPOSES
</action>
<action name="eva_view_yaw_left">
<rebind input="kb1_rshift+pause"/>
</action>
<action name="eva_view_yaw_right">
<rebind input="kb1_rshift+insert"/>
</action>
<action name="eva_yaw_left">
<rebind input="kb1_rshift+pgdn"/>
</action>
<action name="eva_yaw_right">
<rebind input="kb1_rshift+up"/>
</action>
</actionmap>
<actionmap name="player_input_optical_tracking">
<action name="foip_cyclechannel">
<rebind input="kb1_rshift+np_0"/>
</action>
<action name="foip_pushtotalk">
<rebind input="kb1_rshift+np_1"/>
</action>
<action name="foip_pushtotalk_proximity">
<rebind input="kb1_rshift+np_2"/>
</action>
<action name="foip_recalibrate">
<rebind input="kb1_rshift+np_enter"/>
</action>
<action name="foip_viewownplayer">
<rebind input="kb1_rshift+np_3"/>
</action>
<action name="headtrack_enabled">
<rebind input="kb1_rshift+np_4"/>
</action>
<action name="headtrack_hold">
<rebind input="kb1_rshift+np_5"/>
</action>
<action name="headtrack_recalibrate">
<rebind input="kb1_rshift+np_6"/>
</action>
</actionmap>
<actionmap name="player_choice">
<action name="pc_interaction_mode">
<rebind input="kb1_rshift+np_period"/>
</action>
</actionmap>
</ActionMaps>
I am trying to get the names for action and the input for rebind with the following code:
// Create XML document
xml_document<> doc;
xml_node<> * root_node;
// Read the xml file into a vector
ifstream theFile (fqn_file);
vector<char> buffer((istreambuf_iterator<char>(theFile)), istreambuf_iterator<char>());
buffer.push_back('\0');
// Parse the buffer using the xml file parsing library into doc
doc.parse<0>(&buffer[0]);
// Find root node
root_node = doc.first_node("ActionMaps");
// Iterate over 'ActionMaps' subtree
for (xml_node<> * actionmap_node = root_node->first_node("actionmap"); actionmap_node; actionmap_node = actionmap_node->next_sibling())
{
wxLogMessage("I found name subsection %s ",
actionmap_node->first_attribute("name")->value());
// Iterate over 'action' subtree
for(xml_node<> * action_node = actionmap_node->first_node("action"); action_node; action_node = action_node->next_sibling())
{
wxLogMessage("I found action name %s ",
action_node->first_attribute("name")->value());
// Iterate over 'rebind' subtree
for(xml_node<> * rebind_node = action_node->first_node("rebind"); rebind_node; rebind_node = rebind_node->next_sibling())
{
wxLogMessage("I found key %s ",
rebind_node->first_attribute("input")->value());
}
}
}
The code basically works and create the following output:
20:19:17: I found name subsection spaceship_general
20:19:17: I found action name v_toggle_all_doorlocks
20:19:17: I found key kb1_lshift+l
20:19:17: I found name subsection spaceship_view
20:19:17: I found action name v_view_dynamic_focus
20:19:17: I found key js1_slider1
20:19:17: I found action name v_view_look_behind
20:19:17: I found key js1_button8
20:19:17: I found name subsection spaceship_movement
20:19:17: I found action name v_accel_range_rel
20:19:17: I found key js1_rotx
20:19:17: I found action name v_afterburner
20:19:17: I found key js1_button30
20:19:17: I found action name v_autoland
20:19:17: I found key js1_button14
20:19:17: I found action name v_brake
20:19:17: I found key js1_button7
20:19:17: I found action name v_ifcs_toggle_cruise_control
20:19:17: I found key js1_button12
20:19:17: I found action name v_ifcs_toggle_esp
20:19:17: I found key js1_button11
20:19:17: I found action name v_ifcs_toggle_gforce_safety
20:19:17: I found key js1_button10
20:19:17: I found action name v_ifcs_toggle_speed_limiter
20:19:17: I found key js1_button9
20:19:17: I found action name v_ifcs_toggle_vector_decoupling
20:19:17: I found key js1_button6
20:19:17: I found action name v_roll
20:19:17: I found key js1_x
20:19:17: I found action name v_speed_range_rel
20:19:17: I found key js1_roty
20:19:17: I found action name v_strafe_back
20:19:17: I found key js1_
20:19:17: I found action name v_strafe_down
20:19:17: I found key js1_button22
20:19:17: I found action name v_strafe_forward
20:19:17: I found key js1_
20:19:17: I found action name v_strafe_left
20:19:17: I found key js1_button23
20:19:17: I found action name v_strafe_longitudinal
20:19:17: I found key js1_z
20:19:17: I found action name v_strafe_right
20:19:17: I found key js1_button21
20:19:17: I found action name v_strafe_up
20:19:17: I found key js1_button20
20:19:17: I found action name v_target_match_vel
20:19:17: I found key js1_button28
20:19:17: I found action name v_toggle_landing_system
20:19:17: I found key js1_button13
20:19:17: I found action name v_toggle_vtol
20:19:17: I found key js1_button14
20:19:17: I found action name v_yaw
20:19:17: I found key js1_rotz
20:19:17: I found name subsection spaceship_targeting
20:19:17: I found action name v_target_cycle_all_back
20:19:17: I found key js1_hat1_down
20:19:17: I found action name v_target_cycle_all_fwd
20:19:17: I found key js1_hat1_up
20:19:17: I found action name v_target_cycle_friendly_back
20:19:17: I found key js1_button19
20:19:17: I found action name v_target_cycle_friendly_fwd
20:19:17: I found key js1_button17
20:19:17: I found action name v_target_cycle_hostile_back
20:19:17: I found key js1_hat1_left
20:19:17: I found action name v_target_cycle_hostile_fwd
20:19:17: I found key js1_hat1_right
20:19:17: I found action name v_target_cycle_subitem_back
20:19:17: I found key js1_button18
20:19:17: I found action name v_target_cycle_subitem_fwd
20:19:17: I found key js1_button16
20:19:17: I found name subsection spaceship_weapons
20:19:17: I found action name v_attack1_group2
20:19:17: I found key js1_button5
20:19:17: I found name subsection spaceship_missiles
20:19:17: I found action name v_weapon_arm_missile
20:19:17: I found key js1_button2
20:19:17: I found action name v_weapon_launch_missile
20:19:17: I found key js1_button2
20:19:17: I found name subsection spaceship_defensive
20:19:17: I found action name v_weapon_cycle_countermeasure_fwd
20:19:17: I found key js1_button3
20:19:17: I found action name v_weapon_launch_countermeasure
20:19:17: I found key js1_button4
But the result is not as expected:
Random action names in the tree are selected
The keys does not fit to the previous selected action name but are chosen from somewhere
I do not understand the reason behind it. This is from my perspective a simple recursion.
Anyone who can bring me back onto the right path?

The above code is not the problem and runs flawless when compiling it without wxWidgets. So I am closing this and dig further into wxWidgets direction.

Related

How to Create Variable Definitions from Phrases using Regexes (Notepad++)

Suppose we have a list of phrases - words separated by spaces. And suppose we want to define a bunch of variables based on these phrases such that the following hold:
Phrases already exist and are surrounded by quotes (if not, you can easily use a regex to achieve this)
Phrases only contain letters (this actually isn't true for me in practice, but I can handle those cases manually)
Variable name, followed by an equals sign, should precede the phrase
Variable name should be a lowerCamelCase version of the phrase
Example
Input
"hello World"
"foo bAr"
Expected Output
helloWorld = "hello World"
fooBar = "foo bAr"
Use Case
Often in my line of work I am presented with a bunch of constants which come from an Excel spreadsheet and I need to define a bunch of variables in code for them. The phrases have spaces in them, but the variables can't. I'd usually like to keep the variable names as close to the phrases as I can. I'd like a way to do it in bulk, without having to individually type out each variable name.
Notes
I have come up with a way to do this, which I want to record here in case I need it in future and in case others might need it. I also want to post it here because I have a feeling there are optimizations that can be made to my process, or at least alternatives.
I haven't found a single find/replace step that'll do everything for you, but I have managed to do it using a sequence of regexes, applied one after another. The first pulls out the content for the variable name and inserts the "=". The next one does the main heavy lifting and removes spaces and applies the correct casing. The final one ensures all variables begin with lowercase letters. Apply them in sequence to achieve the desired result.
Regex #1
All we're doing here is pulling content out of the quotes and inserting it on the left hand side.
Note: here and below, I need to use this character for whitespace because SO doesn't render it correctly: ␣. So replace that with a space when you use this or other regexes in this answer.
Find: "(.+)"
Replace: ␣\1 = "\1" (note the leading space)
In our example, after this step, we end up with:
hello World = "hello World"
foo bAr = "foo bAr"
Regex #2
Here, we want to match each word on the left hand side, with the goal of removing the whitespace and simultaneously fixing the casing.
Find: ␣(\S)(\S+)(?=.*=) (note the leading space)
Replace: \u\1\L\2 (absence of space in replacement pattern achieves the removal of the space)
After this step, we end up with:
HelloWorld = "hello World"
FooBar = "foo bAr"
Correct, except for the first letter of each variable name.
Regex #3
This fixes the leading characters to be lowercase:
Find: ^(.)
Replace: \l\1
After this step, our output is as desired:
helloWorld = "hello World"
fooBar = "foo bAr"
Optional Regex #4 (Remove Invalid Characters)
Though the requirement assumed all letters, this is often not the case. First, you may want some numbers in there. Second, there may be junk like parentheses. In this case, just do a find/replace with the replace expression empty for the following find expression:
[^\w\r\n](?!=)(?=.*=)
What that does is first matches negatively to anything that's not a letter, a digit, an underscore or an end of line character. It then ensures that the match is followed by an = down the line but not immediately followed by an =, meaning the space before the = is preserved.
As a Macro
Rather than manually do all 4 steps above, you can record them as a macro and save it to your Notepad++. Or just paste the XML below inside the <Macros> XML element in the file shortcuts.xml inside %appdata%\Notepad++. If you do paste, the shortcut is ctrl+alt+shift+V, but you can change that to whatever you want:
<Macro name="DefineVariables" Ctrl="yes" Alt="yes" Shift="yes" Key="86">
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="(.+)" />
<Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam=' \1 = "\1"' />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam=" (\S)(\S+)(?=.*=)" />
<Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\u\1\L\2" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="^(.)" />
<Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="\l\1" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="[^\w\r\n](?!=)(?=.*=)" />
<Action type="3" message="1625" wParam="0" lParam="2" sParam="" />
<Action type="3" message="1602" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />
</Macro>

url rewriting of IIS

with some hit and trail, i managed to remove the extention of the pages which i view for my website, now i want to replace all the ? and = and the & signs with backslash /, I am really Lost now, how do i write that rule in my web config
My Web.Config File:
<rewrite>
<rules>
<rule name="Redirect .cfm extension" stopProcessing="false">
<match url="^(.*).cfm$" ignoreCase="true" />
<conditions logicalGrouping="MatchAny">
<add input="{URL}" pattern="(.*).cfm$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="{R:1}" redirectType="Permanent" />
</rule>
<rule name="hide .cfm extension" stopProcessing="true">
<match url="^(.*)$" ignoreCase="true" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}.cfm" matchType="IsFile" />
</conditions>
<action type="Rewrite" url="{R:0}.cfm" />
</rule>
</rules>
</rewrite>
with the above, i managed to get a page like this
http://website.ca/graphics?mode=Graphics%20Design%20%C2%BB%20Business%20cards&catID=35&section=graphics
the graphics? is the one which was before graphics.cfm?

Regexp recursive find/replace in Notepad++

I am wondering if it is possible to write a Regular Expression in Notepad++, allowing me to modify an SQL INSERT script into DELETE.
Below is an example of what I am trying to do.
Input:
INSERT INTO table1 (xxxx, yyyy, zzzz, ....) VALUES (blah1111, foo2222, 3333333, ....);
Output:
DELETE FROM
table1
WHERE
AND xxxx = 'blah1111'
AND yyyy = 'foo2222'
AND zzzz = '3333333'
AND ....;
I have tried to use recursion, but i don't know how to properly make references for each recursion step.
My actual RegEx:
Find script: ((\w+)(?R)?, )
Replace script: (?1) =
I don't know how to do write recursive regular expressions in Notepad++, but you can use macros to automate at least part of the conversion. First you can run the RegEx
Find what: insert into (\w+) (\([^)]*\)) values (\([^)]*\));
Replace with: \2\n\3\nDELETE FROM\n\1\nWHERE\n
to get the basic structure of the DELETE script with two buffer lines above. Then you click Macro -> Start Recording and press Ctrl-Home, right arrow, Ctrl-Shift-right arrow, Ctrl-x, delete, delete, Ctrl-End, Tab, Ctrl-V, =, ', to move the first table column's name in the right position and continue until you have the
WHERE
AND xxxx = 'blah1111'
correctly. Then you click on Stop Recording and playback the macro until all the lines are generated correctly.
You can also try to add my recorded macro to %APPDATA%\Notepad++\shortcuts.xml directly:
<Macro name="ReorderSQL" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2442" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2177" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2318" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2327" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="=" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam=" " />
<Action type="0" message="2316" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2300" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2442" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2177" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2180" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2318" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="&apos;" />
<Action type="0" message="2179" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="&apos;" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="
" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="
" />
</Macro>

Freeswitch call intercerpt configuration

I am trying to configure call intercept groups and I am having a hard time finding what is wrong with my config. When I dial the feature code to intercept *110(interceptgroup no) (in this case *110101) the dialplan doesn't match and fails. The hash is inserted successfully, I can see it in the cli via hash select/intercept_2/101. What am I missing here?
Here is my user config from directory/default.xml:
<user bluebox_id="3" id="1001">
<variables>
<variable name="internal_caller_id_number" value="1001"/>
<variable name="user_context" value="context_4"/>
<variable name="force_transfer_context" value="context_4"/>
<variable name="user_originated" value="true"/>
<variable name="toll_allow" value="domestic"/>
<variable name="accountcode" value="1001"/>
<variable name="callrecord_inbound" value="1"/>
<variable name="callrecord_outbound" value="1"/>
<variable name="interceptgroup" value="101"/>
</variables>
<params>
<param name="password" value="removed"/>
<param name="dial-string" value="{presence_id=${dialed_user}#${dialed_domain}}${sofia_contact(${dialed_user}#${dialed_domain})}"/>
</params>
</user>
<user bluebox_id="5" id="1238">
<variables>
<variable name="internal_caller_id_number" value="1238"/>
<variable name="user_context" value="context_4"/>
<variable name="force_transfer_context" value="context_4"/>
<variable name="user_originated" value="true"/>
<variable name="toll_allow" value="domestic"/>
<variable name="accountcode" value="1238"/>
<variable name="callrecord_inbound" value="1"/>
<variable name="callrecord_outbound" value="1"/>
<variable name="interceptgroup" value="101"/>
</variables>
<params>
<param name="password" value="removed"/>
<param name="dial-string" value="{presence_id=${dialed_user}#${dialed_domain}}${sofia_contact(${dialed_user}#${dialed_domain})}"/>
</params>
</user>
Here is my dialplan config from dialplan.xml:
<extension name="main_number_43" continue="true">
<condition field="destination_number" expression="^1238$">
<action application="hash" data="insert/intercept_2/101/${uuid}"/>
<action application="set" bluebox="settingTimeout" data="call_timeout=30"/>
<action application="set" bluebox="settingRing" data="ringback=${us-ring}"/>
<action application="set" bluebox="settingRingXfer" data="transfer_ringback=${us-ring}"/>
<action application="export" bluebox="sipCalleeIdName" data="sip_callee_id_name=linksys"/>
<action application="export" bluebox="sipCalleeIdNumber" data="sip_callee_id_number=1238"/>
<action application="bridge" data="user/1238#$${location_4}"/>
<action application="hangup"/>
</condition>
</extension>
<extension name="main_number_45" continue="true">
<condition field="${regex(m:/${destination_number}/^\*110([0-9]+)$/$1)}" expression="^${interceptgroup}$"/>
<condition field="destination_number" expression="^\*110([0-9]+)$">
<action application="answer"/>
<action application="set" data="intercept_unanswered_only=true"/>
<action application="intercept" data="${hash(select/intercept_2/$1)}"/>
<action application="sleep" data="2000"/>
<action application="hangup"/>
</condition>
</extension>
After some headache I discovered that you cannot prepend this particular feature code with a *, it causes freeswitch to parse the digits differently by separating the feature code itself (*110 in this case) from the digits you enter as an argument, which in this case is the intercept group number. Removing the * fixed it.
<extension name="main_number_45" continue="true">
<condition field="${regex(m:/${destination_number}/^\110([0-9]+)$/$1)}" expression="^${interceptgroup}$"/>
<condition field="destination_number" expression="^\110([0-9]+)$">
<action application="answer"/>
<action application="set" data="intercept_unanswered_only=true"/>
<action application="intercept" data="${hash(select/intercept_2/$1)}"/>
<action application="sleep" data="2000"/>
<action application="hangup"/>
</condition>
</extension>

Merging two lines into one - Notepad++

I have a line like this
assignee: Akebono Brake Industry Co. Ltd. ,
Fujitsu Limited application_no: 06/946,825
I want the output to be
assignee: Akebono Brake Industry Co. Ltd. , Fujitsu Limited
application_no: 06/946,825
To bring the application_no: 06/946,825 to the next line, I can find application_no: and replace it with \napplication_no: in my NOTEPAD++
But, how can I bring that string that spans to next line back to the first line? I mean what should I do to get the Fujitsu Limited to the line starting with assignee:
Any guidance please?
Since Extended is the only mode that handles the newlines correctly but you need to match with regular expressions, you will need to do this in two steps.
First, use a regex find and replace to add some recognizable token to the beginning of each line you want to move up, I used 'MATCH' but you could definitely change this.
Then, switch to Extended to search for a newline followed by the token, and replace it with an empty string to delete both the line break and the token.
Here is another solution. One step:
Search:
(^.*,.*$)\r\n([ A-Z]*[ ])
Replace:
\1\2\r\n
I am unfamiliar with notepad++, but surely there is a "/n" after the comma? Could you not just remove the char that creates the new line segment? ie: the inverse of what you are doing to application_no:
You can't do that with regular expressions due to a flaw in the Scintilla engine which Notepad++ uses. However, it works in "extended" find mode, so use that. Search for ,\r\n and replace with ,.
Change the \r\n to only \n on Linux, or to only \r on Mac OS.
I've just wrote that macro and works with your example.
Add this macro into shortcuts.xml, if you are using win7 file is located at C:\Users\{username}\AppData\Roaming\Notepad++
Just open your text file and get cursor to firts line, then run this macro.
<Macro name="stackoverflow" Ctrl="no" Alt="no" Shift="no" Key="0">
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="application_no" />
<Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
<Action type="0" message="2302" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2451" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2306" wParam="0" lParam="0" sParam="" />
<Action type="0" message="2326" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1700" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1601" wParam="0" lParam="0" sParam="application_no" />
<Action type="3" message="1625" wParam="0" lParam="0" sParam="" />
<Action type="3" message="1702" wParam="0" lParam="768" sParam="" />
<Action type="3" message="1701" wParam="0" lParam="1" sParam="" />
<Action type="0" message="2308" wParam="0" lParam="0" sParam="" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="
" />
<Action type="1" message="2170" wParam="0" lParam="0" sParam="
" />
</Macro>