/// <summary>
 ///     Initializes a new instance of the DynaXmlContextState class.
 /// </summary>
 /// <param name="document">The xml document.</param>
 /// <param name="currentAncestor">The current ancestor of all new nodes.</param>
 /// <param name="lastCreated">The last node that was created.</param>
 /// <param name="namespaceContext">The current namespace context.</param>
 /// <param name="state">The current state of the state machine.</param>
 public DynaXmlContextState(DynaXmlDocument document,
                            DynaXmlElement currentAncestor,
                            DynaXmlElement lastCreated,
                            DynaXmlNamespaceContext namespaceContext,
                            DynaXmlBuilderState state)
 {
     this.Document = document;
     this.State = state;
     this.CurentAncestorElement = currentAncestor;
     this.CurrentNamespaceContext = namespaceContext;
     this.LastCreated = lastCreated;
 }
Пример #2
0
 /// <summary>
 /// Creates a new instance of the DynaXmlBuilder class.
 /// This override allows the user to specify if a header should or should not be added.
 /// </summary>
 /// <param name="includeHeader">
 /// Specifies if a header (&lt;?xml ... &gt;) should be included.
 /// </param>
 /// <param name="xmlFormatting">
 /// The XmlFormatting style to use when writing the document.
 /// </param>
 /// <returns>
 /// A new DynaXmlBuilder object that can be used to build Xml.
 /// </returns>
 public static dynamic Create(bool includeHeader, Formatting xmlFormatting)
 {
     var document = new DynaXmlDocument();
     return new DynaXmlBuilder(document, includeHeader, xmlFormatting);
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the DynaXmlBuilder class.
 /// </summary>
 /// <param name="document">
 /// The XmlDocument to use for building.
 /// </param>
 /// <param name="includeHeader">
 /// A flag indicating that a header should be included.
 /// </param>
 /// <param name="xmlFormatting">
 /// The XmlFormatting style to use when writing the document.
 /// </param>
 internal DynaXmlBuilder(DynaXmlDocument document, bool includeHeader, Formatting xmlFormatting)
 {
     this.xmlFormatting = xmlFormatting;
     this.includeHeader = includeHeader;
     this.context = new DynaXmlBuilderContext();
     this.document = document;
     // this.context.Push(this.document, DynaXmlBuilderState.ElementBuilder);
     this.context.Push(this.document, DynaXmlBuilderState.ElementListBuilder);
 }
 /// <summary>
 ///     Pushes an initial document onto the stack.
 /// </summary>
 /// <param name="document">
 ///     The XmlDocument object representing the document for building.
 /// </param>
 /// <param name="state">
 ///     The new state.
 /// </param>
 internal void Push(DynaXmlDocument document, DynaXmlBuilderState state)
 {
     this.stack.Push(new DynaXmlContextState(document,
                                             null,
                                             null,
                                             new DynaXmlNamespaceContext(),
                                             state));
 }