The OutputDocument object is used to represent the root of an XML document. This does not actually represent anything that will be written to the generated document. It is used as a way to create the root document element. Once the root element has been created it can be committed by using this object.
Inheritance: OutputNode
Esempio n. 1
0
        /// <summary>
        /// This is used to acquire the root output node for the document.
        /// This will create an empty node that can be used to generate
        /// the root document element as a child to the document.
        /// <p>
        /// Depending on whether or not an encoding has been specified
        /// this method will write a prolog to the generated XML document.
        /// Each prolog written uses an XML version of "1.0".
        /// </summary>
        /// <returns>
        /// this returns an output element for the document
        /// </returns>
        public OutputNode WriteRoot()
        {
            OutputDocument root = new OutputDocument(this, stack);

            if (stack.IsEmpty())
            {
                writer.WriteProlog();
            }
            return(root);
        }
Esempio n. 2
0
 /// <summary>
 /// This is used to acquire the root output node for the document.
 /// This will create an empty node that can be used to generate
 /// the root document element as a child to the document.
 /// <p>
 /// Depending on whether or not an encoding has been specified
 /// this method will write a prolog to the generated XML document.
 /// Each prolog written uses an XML version of "1.0".
 /// </summary>
 /// <returns>
 /// this returns an output element for the document
 /// </returns>
 public OutputNode WriteRoot() {
    OutputDocument root = new OutputDocument(this, stack);
    if(stack.IsEmpty()) {
       writer.WriteProlog();
    }
    return root;
 }