コード例 #1
0
        private static IEnumerable <XElement> Reveal_ByAttributes(XElement e, XAttribute a)
        {
            if (a == null)
            {
                yield return(e);
            }
            else
            {
                var vals = a.GetMultiAttributeValues();
                foreach (var v in vals)
                {
                    a.Value = v;

                    var new_e             = new XElement(e.Name, e.Attributes());
                    var before_text_nodes = e.Nodes().TakeWhile(n => n.NodeType == XmlNodeType.Text);
                    new_e.Add(before_text_nodes);

                    var next_a = (a.NextAttribute != null) ? new_e.Attribute(a.NextAttribute.Name) : null;

                    foreach (var _e in Reveal_ByAttributes(new_e, next_a))
                    {
                        yield return(_e);
                    }
                }
            }
        }