コード例 #1
0
        /// <summary>Creates a new document and sets it to the given namespace.</summary>
        public Document createDocument(string namespaceUri, string qualifiedName, DocumentType doctype)
        {
            MLNamespace ns = null;

            // Get the namespace if there is one:
            if (!string.IsNullOrEmpty(namespaceUri))
            {
                ns = MLNamespaces.Get(namespaceUri);
            }

            // Create the document:
            Document document = (ns == null)? new Document() : ns.CreateDocument();

            // Add the doctype:
            if (doctype != null)
            {
                document.appendChild(doctype);
            }

            if (!string.IsNullOrEmpty(qualifiedName))
            {
                // Create the element:
                Element element = document.createElement(qualifiedName);

                if (element != null)
                {
                    document.appendChild(element);
                }
            }

            // Apply the base URI:
            document.basepath = _owner.basepath;

            return(document);
        }
コード例 #2
0
        public XmlNamespace(string name, string prefix, string mime, Type docType)
        {
            Namespace = MLNamespaces.Get(name, prefix, mime);

            if (docType != null)
            {
                Namespace.DocumentType = docType;
            }
        }
コード例 #3
0
        public XmlNamespace(string name, string prefix, string mime, Type docType, string foreign)
        {
            Namespace = MLNamespaces.Get(name, prefix, mime);

            if (docType != null)
            {
                Namespace.DocumentType = docType;
            }

            if (foreign != null)
            {
                // Foreign elements (such as mathml's 'math' in html) are available.

                // Set:
                Namespace.ForeignNames = foreign;
            }
        }
コード例 #4
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);
        }