Esempio n. 1
0
        /// <summary>Creates a new element in this document. You'll need to parent it to something.
        /// E.g. with thisDocument.body.appendChild(...). Alternative to innerHTML and appendInnerHTML.</summary>
        /// <param name='tag'>The tag, e.g. <div id='myNewElement' .. ></param>
        public Element createElement(string tag)
        {
            // Note that we ignore a namespace declaration here.

            // Create the element and call its startup methods:
            Element result = TagHandlers.Create(Namespace, tag) as Element;

            result.document_ = this;
            result.OnTagLoaded();
            result.OnChildrenLoaded();

            return(result);
        }
Esempio n. 2
0
        /// <summary>Creates a new element in this document with the given namespace.
        /// You'll need to parent it to something.</summary>
        public Element createElementNS(string namespaceName, string tag)
        {
            // Get the namespace by its URL:
            MLNamespace ns = MLNamespaces.Get(namespaceName);

            if (ns == null)
            {
                ns = Namespace;
            }

            // Create the element and call its startup methods:
            Element result = TagHandlers.Create(ns, tag) as Element;

            result.document_ = this;
            result.OnTagLoaded();
            result.OnChildrenLoaded();

            return(result);
        }