Rhino.Xmlimpl.XmlProcessor.NewDocument C# (CSharp) Method

NewDocument() private method

private NewDocument ( ) : XmlDocument
return System.Xml.XmlDocument
		internal virtual XmlDocument NewDocument()
		{
			DocumentBuilder builder = null;
			try
			{
				//    TODO    Should this use XML settings?
				builder = GetDocumentBuilderFromPool();
				return builder.NewDocument();
			}
			catch (ParserConfigurationException ex)
			{
				//    TODO    How to handle these runtime errors?
				throw new Exception(ex);
			}
			finally
			{
				if (builder != null)
				{
					ReturnDocumentBuilderToPool(builder);
				}
			}
		}

Usage Example

Example #1
0
		internal static Rhino.Xmlimpl.XmlNode NewElementWithText(XmlProcessor processor, Rhino.Xmlimpl.XmlNode reference, Rhino.Xmlimpl.XmlNode.QName qname, string value)
		{
			if (reference is XmlDocument)
			{
				throw new ArgumentException("Cannot use Document node as reference");
			}
			XmlDocument document = null;
			if (reference != null)
			{
				document = reference.dom.OwnerDocument;
			}
			else
			{
				document = processor.NewDocument();
			}
			System.Xml.XmlNode referenceDom = (reference != null) ? reference.dom : null;
			Rhino.Xmlimpl.XmlNode.Namespace ns = qname.GetNamespace();
			XmlElement e = (ns == null || ns.GetUri().Length == 0) ? document.CreateElementNS(null, qname.GetLocalName()) : document.CreateElementNS(ns.GetUri(), qname.Qualify(referenceDom));
			if (value != null)
			{
				e.AppendChild(document.CreateTextNode(value));
			}
			return Rhino.Xmlimpl.XmlNode.CreateImpl(e);
		}
All Usage Examples Of Rhino.Xmlimpl.XmlProcessor::NewDocument