private void GetStringInstructions()
 {
     if (string.IsNullOrEmpty(instructions))
     {
         return;
     }
     stringInstructions = OnlineMapsUtils.StrReplace(instructions,
                                                     new[] { "<", ">", " ", "&", " " },
                                                     new[] { "<", ">", " ", "&", " " });
     stringInstructions = Regex.Replace(stringInstructions, "<div.*?>", "\n");
     stringInstructions = Regex.Replace(stringInstructions, "<.*?>", string.Empty);
 }
        public Step(OnlineMapsXML node)
        {
            List <Step> steps = new List <Step>();

            foreach (OnlineMapsXML n in node)
            {
                if (n.name == "travel_mode")
                {
                    travel_mode = n.Value();
                }
                else if (n.name == "start_location")
                {
                    start_location = OnlineMapsXML.GetVector2dFromNode(n);
                }
                else if (n.name == "end_location")
                {
                    end_location = OnlineMapsXML.GetVector2dFromNode(n);
                }
                else if (n.name == "polyline")
                {
                    polylineD = OnlineMapsUtils.DecodePolylinePointsD(n["points"].Value()).ToArray();
                    polyline  = polylineD.Select(p => (Vector2)p).ToArray();
                }
                else if (n.name == "duration")
                {
                    duration = new TextValue <int>(n);
                }
                else if (n.name == "distance")
                {
                    distance = new TextValue <int>(n);
                }
                else if (n.name == "step")
                {
                    steps.Add(new Step(n));
                }
                else if (n.name == "html_instructions")
                {
                    html_instructions = n.Value();
                    if (string.IsNullOrEmpty(html_instructions))
                    {
                        return;
                    }
                    string_instructions = OnlineMapsUtils.StrReplace(html_instructions,
                                                                     new[] { "&lt;", "&gt;", "&nbsp;", "&amp;", "&amp;nbsp;" },
                                                                     new[] { "<", ">", " ", "&", " " });
                    string_instructions = Regex.Replace(string_instructions, "<div.*?>", "\n");
                    string_instructions = Regex.Replace(string_instructions, "<.*?>", string.Empty);
                }
                else if (n.name == "maneuver")
                {
                    maneuver = n.Value();
                }
                else if (n.name == "transit_details")
                {
                    transit_details = new TransitDetails(n);
                }
                else
                {
                    Debug.Log("Step: " + n.name + "\n" + n.outerXml);
                }
            }

            this.steps = steps.ToArray();
        }