Adding Notes to HtmlNode

Topics: Developer Forum
Sep 30, 2008 at 1:23 AM
I'm in a situation where I want to store data associated with the HtmlNode which can be accessed during an XPath query.  In this case I would like to store some markup information related to css and layout.  (Note that webkit or gecko might do full layout, but we don't want full layout, they aren't in c#, and they do way too much work.)  Currently I'm leaning toward adding a virtual class to the agility pack which can be case to the desired data type, along the lines of:

namespace HtmlAgilityPack
{
    public class HtmlNodeMarkup
    {
    }
}

and then adding that as a member of HtmlNode with an accessor and have it default to null.

    public class HtmlNode
    {
    ...
        internal HtmlNodeMarkup _markup;
    ...
        public HtmlNodeMarkup markup
        {
            get
            {
                return _markup;
            }
            set
            {
                _markup = value;
            }
        }
    ...
    }


Does anyone have any thoughts on this idea?

Chris...