Ejemplo n.º 1
0
 /// <summary>
 /// This method adds a custom action to the entry documents.
 /// </summary>
 /// <param name="xPath">The xpath of the reference node.</param>
 /// <param name="append">This boolean property determines whether the node should be appended or replaced.</param>
 /// <param name="action">The action delegate that writes the node XML.</param>
 /// <returns>Returns true if the node is created successfully.</returns>
 public virtual bool AtomConstructAdd(string xPath, bool append, CreateFragmentAction action)
 {
     XmlDocumentFragment frag = CreateFragment(action);
     return FragmentSet(xPath, append, frag);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is used to create a specific element for the document.
        /// </summary>
        /// <param name="action">The action for the particular element.</param>
        /// <returns>Returns a new element.</returns>
        protected XmlDocumentFragment CreateFragment(CreateFragmentAction action)
        {
            XmlDocumentFragment frag = Payload.CreateDocumentFragment();
            StringBuilder sb = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.OmitXmlDeclaration = true;
            using (XmlWriter writer = XmlWriter.Create(sb, settings))
            {
                action(writer);
            }

            frag.InnerXml = sb.ToString();

            return frag;
        }