public void Method() { // <Snippet1> XmlImplementation imp = new XmlImplementation(); XmlDocument doc1 = imp.CreateDocument(); XmlDocument doc2 = imp.CreateDocument(); // </Snippet1> }
public static void CreateDocument() { var imp = new XmlImplementation(); var doc1 = imp.CreateDocument(); var doc2 = imp.CreateDocument(); Assert.NotNull(doc1); Assert.NotNull(doc2); Assert.NotSame(doc1, doc2); }
public static void CreateDocument() { var imp = new XmlImplementation(); var doc1 = imp.CreateDocument(); var doc2 = imp.CreateDocument(); Assert.NotNull(doc1); Assert.NotNull(doc2); Assert.NotSame(doc1, doc2); }
/// <summary> /// Creates a new <see cref="DOMDocument"/>. /// </summary> /// <param name="namespaceUri">The namespace URI of the root element to create.</param> /// <param name="qualifiedName">The qualified name of the document element.</param> /// <param name="docType">The type of document to be created.</param> /// <returns>The <see cref="DOMDocument"/>.</returns> public DOMDocument createDocument(string namespaceUri = null, string qualifiedName = null, DOMDocumentType docType = null) { XmlDocument doc = XmlImplementation.CreateDocument(); if (docType != null) { if (!docType.IsAssociated) { docType.Associate(doc); } else { DOMException.Throw(ExceptionCode.WrongDocument); return(null); } } doc.AppendChild(docType.XmlNode); doc.AppendChild(doc.CreateElement(qualifiedName, namespaceUri)); return(new DOMDocument(doc)); }
public static object createDocument([This] DOMImplementation instance, string namespaceUri, string qualifiedName, [Nullable] DOMDocumentType docType) { XmlImplementation impl = (instance != null ? instance.XmlImplementation : new XmlImplementation()); XmlDocument doc = impl.CreateDocument(); if (docType != null) { if (!docType.IsAssociated) { docType.Associate(doc); } else { DOMException.Throw(ExceptionCode.WrongDocument); return(false); } } doc.AppendChild(docType.XmlNode); doc.AppendChild(doc.CreateElement(qualifiedName, namespaceUri)); return(new DOMDocument(doc)); }