IEptXmlParserEvents Interface Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

The IEPTXmlParserEvents interface defines events implemented by all classes that inherits the EPTXmlParser base class.

Namespace: ContentStudio.Document.EPT
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)

public interface IEptXmlParserEvents

The IEptXmlParserEvents type exposes the following members.


Public eventEptFieldAdded
Occurs when an EPT field is added.
Public eventEptFieldRemoved
Occurs when an EPT field is removed.
Public eventEptFieldValueChanged
Occurs when an EPT field value has been changed.
Public eventEptFieldValueChanging
Occurs when a field value is about to be changed.

This interface is new in Content Studio 5.2

This sample shows a small Winform application that uses a EPTXmlEditableParser to load an Ept document and consumes the events connected to such an object. In order to work Content Studio 5.2 must be installed on the computer and running.

  • Create a new WinForm project and name it TestCSServer
  • Add a Textbox, named textBox1, to the main form (Form1)
  • Add a commandbutton to Form1 and name it btnEptEvents
  • Set a reference to Content Studio server (CSServer5.dll)
  • Set a reference to System.Runtime.Remoting which is a part of .NET 2.0
  • Add a new class name ChannelConfigurator to the project. This class is used to configure the remoting infrastructure and its source code is a part of the Content Studio SDK - just search for ChannelConfigurator and you will find source code for this class.
  • Paste in the code sample into the code source for Form1
  • Set the btnEptEvents_Click method to be the On_Click event handler for the btnEptEvents command button.
  • Replace the value of the ConnectionId with a value that is applicable to your system
  • Replace the value of the EptDocumentIdToWorkWith member to represent an Ept document on your system.
  • You now should be able to run the application and add breakpoints of your choice.
using System;
using System.Text;
using System.Windows.Forms;
using ContentStudio.Document;
using ContentStudio.Document.EPT;

namespace TestCSServer
    public partial class Form1 : Form
        private const int ConnectionId = 52;
        private const string App_Title = "CS Test application";

        private const int EptDocumentIdToWorkWith = 1556;

        public Form1()

            //config the remoting
                ChannelConfigurator config = new ChannelConfigurator(ChannelConfigurator.TransportProtocol.IPC);
            catch (Exception ex)
                MessageBox.Show(String.Concat(ex.Message, "\r\n", ex.GetType().ToString()), 

        #region Helpers
        private void DisplayError(Exception theException)
            if (theException != null)
                string message = String.Concat(theException.Message, Environment.NewLine, theException.GetType().ToString());
                MessageBox.Show(message, App_Title, MessageBoxButtons.OK, MessageBoxIcon.Error);

        private static int OpenSession()
            ContentStudio.Security.SessionManager session = new ContentStudio.Security.SessionManager();
            return session.OpenSession(ConnectionId);


        private void btnEptEvents_Click(object sender, EventArgs e)
            Exception theException = null;
                int session = OpenSession();
                textBox1.Text = "";
                CSDocumentInformation dinf = new CSDocumentInformation(ConnectionId, 

                EPTXmlEditableParser ept = new EPTXmlEditableParser(dinf.Content);
                //add event handlers
                ept.EptFieldAdded += new EptFieldAddedEventHandler(ept_EptFieldAdded);
                ept.EptFieldRemoved += new EptFieldRemovedEventHandler(ept_EptFieldRemoved);
                ept.EptFieldValueChanging += new EptFieldValueChangingEventHandler(ept_EptFieldValueChanging);
                ept.EptFieldValueChanged += new EptFieldValueChangedEventHandler(ept_EptFieldValueChanged);
                //Add a field, this triggers the EptFieldAdded event.
                ept.Add("theNewField", "The value");
                //Change the value to an empty string, this triggers the 
                //EptFieldValueChanging event. The event handler will 
                //cancel the event if the value is empty
                ept["theNewField"] = String.Empty;
                //Change the value to something that is allowed, this triggers
                //the EptFieldValueChanging followed by the PropertyChanged event.
                ept["theNewField"] = "The new value";
                //Remove the field, this triggers the EptFieldRemoved event.
            catch (System.Net.Sockets.SocketException socka)
                theException = socka;
            catch (ContentStudio.CSException cex)
                theException = cex;
            catch (ArgumentException ax)
                theException = ax;

        void ept_EptFieldValueChanged(object sender, EptXmlParserEventArgs e)
            textBox1.Text += String.Format("Event EptFieldValueChanged: FieldName:{0}\r\n", e.FieldName);

        void ept_EptFieldValueChanging(object sender, EptXmlParserOnBeforeEventArgs e)
            textBox1.Text += String.Format("Event EptFieldValueChanging: FieldName:{0}\r\n\tOldValue:\r\n{1}\r\n\tNewValue:\r\n{2}\r\n", 
            if (String.IsNullOrEmpty(e.NewFieldValue))
                e.Cancel = true;
                textBox1.Text += "\t The value is empty, the update operation has been canceled!\r\n";

        void ept_EptFieldRemoved(object sender, EptXmlParserEventArgs e)
            textBox1.Text += String.Format("Event FieldRemoved: FieldName:{0}\r\n", e.FieldName);

        void ept_EptFieldAdded(object sender, EptXmlParserEventArgs e)
            textBox1.Text += String.Format("Event FieldAdded: FieldName:{0}\r\n", e.FieldName);
See Also