Esempio n. 1
0
        /// <summary>
        /// Allow the visitor to 'visit' each attribute in the input XmlNode.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="result"></param>
        /// <returns>true if any Visit call returns true</returns>
        public static bool VisitAttributes(XmlNode input, IAttributeVisitor visitor)
        {
            bool fSuccessfulVisit = false;

            if (input.Attributes != null)             // can be, e.g, if Input is a XmlTextNode
            {
                foreach (XmlAttribute xa in input.Attributes)
                {
                    if (visitor.Visit(xa))
                    {
                        fSuccessfulVisit = true;
                    }
                }
            }
            if (input.ChildNodes != null)             // not sure whether this can happen.
            {
                foreach (XmlNode child in input.ChildNodes)
                {
                    if (VisitAttributes(child, visitor))
                    {
                        fSuccessfulVisit = true;
                    }
                }
            }
            return(fSuccessfulVisit);
        }
Esempio n. 2
0
        /// <summary>
        /// Allow the visitor to 'visit' each attribute in the input XmlNode.
        /// </summary>
        /// <param name="input"></param>
        /// <param name="visitor"></param>
        /// <returns>true if any Visit call returns true</returns>
        public static bool VisitAttributes(XElement input, IAttributeVisitor visitor)
        {
            bool fSuccessfulVisit = false;

            if (input.HasAttributes)             // can be, e.g, if Input is a XmlTextNode
            {
                foreach (XAttribute xa in input.Attributes())
                {
                    if (visitor.Visit(xa))
                    {
                        fSuccessfulVisit = true;
                    }
                }
            }
            if (input.Elements().Any())             // not sure whether this can happen.
            {
                foreach (var child in input.Elements())
                {
                    if (VisitAttributes(child, visitor))
                    {
                        fSuccessfulVisit = true;
                    }
                }
            }
            return(fSuccessfulVisit);
        }
Esempio n. 3
0
		/// <summary>
		/// Allow the visitor to 'visit' each attribute in the input XmlNode.
		/// </summary>
		/// <param name="input"></param>
		/// <param name="result"></param>
		/// <returns>true if any Visit call returns true</returns>
		public static bool VisitAttributes(XmlNode input, IAttributeVisitor visitor)
		{
			bool fSuccessfulVisit = false;
			if (input.Attributes != null) // can be, e.g, if Input is a XmlTextNode
			{
				foreach (XmlAttribute xa in input.Attributes)
				{
					if (visitor.Visit(xa))
						fSuccessfulVisit = true;
				}
			}
			if (input.ChildNodes != null) // not sure whether this can happen.
			{
				foreach (XmlNode child in input.ChildNodes)
				{
					if (VisitAttributes(child, visitor))
						fSuccessfulVisit = true;
				}
			}
			return fSuccessfulVisit;
		}