A sudden spasm of violence jolted the government center of Canada’s capital on Wednesday morning, as a gunman killed an honor guard soldier at a war memorial and then opened fire inside the nearby Parliament building, triggering a lockdown and hours of confusion in Ottawa. The assault shocked a country that rarely sees gun violence but has witnessed two attacks on members of its armed forces in recent days.