EPTXmlTextParser Class Content Studio 5.7 SDK
Content Studio Web Content Management System

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

Provides a read-only implementation of the EPTXmlParser class that enables the caller to read EPT field names and values in an efficient way.
Inheritance Hierarchy

SystemObject
  ContentStudio.Document.EPTEPTXmlParser
    ContentStudio.Document.EPTEPTXmlTextParser
      ContentStudio.Document.EPTEPTXmlEditableParser

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

[SerializableAttribute]
public class EPTXmlTextParser : EPTXmlParser

The EPTXmlTextParser type exposes the following members.

Constructors

  NameDescription
Protected methodEPTXmlTextParser
Creates an empty EPTXmlTextParser collection of EPT field names
Protected methodEPTXmlTextParser(Int32)
Creates an empty EPTXmlTextParser collection of EPT field names
Public methodEPTXmlTextParser(Stream)
Creates a new EPTXmlTextParser from a stream of xml content
Public methodEPTXmlTextParser(String)
Creates a new EPTXmlTextParser from a string of xml content
Public methodEPTXmlTextParser(XmlReader)
Creates a new EPT field collection object
Protected methodEPTXmlTextParser(Int32, Int32)
Creates an empty EPTXmlTextParser collection of EPT field names
Public methodEPTXmlTextParser(Int32, Stream)
Creates a new EPTXmlTextParser from a stream of xml content
Public methodEPTXmlTextParser(Int32, String)
Creates a new EPTXmlTextParser from a string of xml content
Public methodEPTXmlTextParser(Int32, XmlReader)
Creates a new EPT field collection object
Protected methodEPTXmlTextParser(Int32, Int32, Int32)
Creates an empty EPTXmlTextParser collection of EPT field names
Public methodEPTXmlTextParser(Stream, Int32, Int32)
Creates a new EPTXmlTextParser from a stream of xml content
Public methodEPTXmlTextParser(String, Int32, Int32)
Creates a new EPTXmlTextParser from a string of xml content
Public methodEPTXmlTextParser(XmlReader, Int32, Int32)
Creates a new EPT field collection object
Public methodEPTXmlTextParser(Int32, Stream, Int32, Int32)
Creates a new EPTXmlTextParser from a stream of xml content
Public methodEPTXmlTextParser(Int32, String, Int32, Int32)
Creates a new EPTXmlTextParser from a string of xml content
Public methodEPTXmlTextParser(Int32, XmlReader, Int32, Int32)
Creates a new EPT field collection object
Top
Properties

  NameDescription
Public propertyCategoryID
Gets a value that indicates the category where the document belongs.
Public propertyCount
Gets the number of unique field names in the EPT field collection.
(Inherited from EPTXmlParser.)
Public propertyDocumentID
Gets a value that identifies the document loaded.
Public propertyDocumentName
Sets or gets the name of the document.
Public propertyFields
Returns an array of all field names
(Inherited from EPTXmlParser.)
Public propertyHasFields
Gets a value that indicates whether the EPT collection has any fields or not.
(Inherited from EPTXmlParser.)
Public propertyItemInt32
Gets the entry at the specified index of the the fields collection.
(Overrides EPTXmlParserItemInt32.)
Public propertyItemString
Gets the entry with the specified key in the fields collection.
(Overrides EPTXmlParserItemString.)
Public propertyReadOnly
Returns whether the EPT field collection is read-only or not.
(Overrides EPTXmlParserReadOnly.)
Top
Methods

  NameDescription
Protected methodBaseAdd
Adds an entry with the specified name and value to the EPT field collection
(Inherited from EPTXmlParser.)
Protected methodBaseClear
Removes all the fields and their values
(Inherited from EPTXmlParser.)
Protected methodBaseRemove
Removes a field in the EPT field collection
(Inherited from EPTXmlParser.)
Protected methodBaseSet
Sets the value of an entry in the collection of EPT fields
(Inherited from EPTXmlParser.)
Public methodEquals(Object)
Determines whether the specified Object is an EPTXmlParser that has the same content as the current EPTXmlParser.
(Inherited from EPTXmlParser.)
Public methodEquals(EPTXmlParser)
Determines whether the specified EPTXmlParser has the same content as the current EPTXmlParser.
(Inherited from EPTXmlParser.)
Public methodExistsField
Determines whether a field exists or not
(Inherited from EPTXmlParser.)
Protected methodFinalize (Inherited from Object.)
Public methodGet(Int32)
Gets the values at the specified index of the EPT field collection combined into one comma-separated list.
(Inherited from EPTXmlParser.)
Public methodGet(String)
Gets the values associated with the specified field from the the EPT field collection combined into one comma-separated list.
(Inherited from EPTXmlParser.)
Public methodGetAsDateTime
Returns the value as a DateTime of a specified Content Studio EPT field.
Public methodGetAsInt32
Returns the value as an Int32 of a specified Content Studio EPT field.
Public methodGetAsString(String)
Returns the value, as as String of a specified Content Studio EPT field.
Public methodGetAsString(String, Boolean)
Returns the value, as as String of a specified Content Studio EPT field with option to remove any embedded html markup.
Public methodGetEnumerator
Returns an enumerator that iterates through a collection.
(Inherited from EPTXmlParser.)
Public methodGetField
Returns the field name at a specific location
(Inherited from EPTXmlParser.)
Public methodGetFieldIndex
Gets the zero-based index of a field.
(Inherited from EPTXmlParser.)
Public methodGetHashCode
Gets the hash code for this EPTXmlParser.

A developer can use this value to compare the content of two different instances of an EPTXmlParser.

(Inherited from EPTXmlParser.)
Public methodGetHashCodeForField(Int32)
Gets the hash code for a specific field based on its ordinal number.
(Inherited from EPTXmlParser.)
Public methodGetHashCodeForField(String)
Gets the hash code for a specific field.
(Inherited from EPTXmlParser.)
Public methodGetType (Inherited from Object.)
Public methodGetValues(Int32)
Returns an array of all values that exists for a field
(Inherited from EPTXmlParser.)
Public methodGetValues(String)
Gets the values at the specified field of the EPT field collection.
(Inherited from EPTXmlParser.)
Public methodIsEmptyField
Determines if a field is non-existing or has a value that is empty or null.
(Inherited from EPTXmlParser.)
Protected methodLoad
Loads the storage with new EPT data.
(Inherited from EPTXmlParser.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodSetCategory
Sets the category id of this instance. This value can only be set if the CategoryID property is zero.
Protected methodSetDocument
Sets the document id of this instance. This value can only be set if the DocumentID property is zero.
Public methodToPlainText
This method gets the EPT data as plain text with all Xml markup removed and using the specified options.
Public methodToString
Returns the EPT xml using the default UTF-8 encoding
(Overrides ObjectToString.)
Public methodToString(Encoding)
Returns the EPT xml as a string encoded with the specified encoding.
Public methodCode exampleTryGetValue(String, String)
Gets the value associated with the specified field name.
(Inherited from EPTXmlParser.)
Public methodCode exampleTryGetValue(String, String, Boolean)
Gets the value associated with the specified field name.
(Inherited from EPTXmlParser.)
Public methodCode exampleWrite(Stream)
Writes the full Xml content of the Ept document to the supplied System.IO.Stream using the default UTF-8 encoding.
Public methodCode exampleWrite(Stream, Encoding)
Writes the full Xml content of the Ept document to the supplied System.IO.Stream using the supplied encoding.
Public methodWritePlainText(Stream, String, Boolean)
Writes the content of the document as plain text to a Stream using specified options and the Unicode encoding
Public methodWritePlainText(TextWriter, String, Boolean)
Writes the content of the document as plain using the supplied a TextWriter, with the specified options.
Public methodWritePlainText(StringBuilder, String, Boolean)
Writes the content of the document as plain text to a StringBuilder using specified options.
Public methodWritePlainText(Stream, String, Boolean, Encoding)
Writes the content of the document as plain text to a Stream using the specified options and a specific encoding
Top
Events

  NameDescription
Public eventEptFieldAdded
Occurs when an EPT field is added.
(Inherited from EPTXmlParser.)
Public eventEptFieldRemoved
Occurs when an EPT field is removed.
(Inherited from EPTXmlParser.)
Public eventEptFieldValueChanged
Occurs when a the value of a field changes.
(Inherited from EPTXmlParser.)
Public eventEptFieldValueChanging
Occurs when a field value is about to be changed.
(Inherited from EPTXmlParser.)
Top
Fields

  NameDescription
Public fieldStatic memberINITIALSIZE
Defines the number of fields that the object initially can hold.
Top
Examples

The following example shows how to read the Draft content of an arbitrary EPT document by using the CSDocumentInformation class and then loading the document's content into an EPTXmlTextParser which enables you to efficiently extract each one of the fields and their values.
On a web site, where the caller normally has only the BROWSE permission you can use the CSApprovedDocumentInformation class that is similar to the CSDocumentInformation class but requires less permissions. This example works within Content Studio only.

try
{
    //Load the draft content of the document, this requires READ permission for the caller.
   CSDocumentInformation docInfo = 
           new CSDocumentInformation(CS_ConnectionID, 
                                     CS_UserSessionID, 
                                     3769, 
                                     CSDocumentInformation.ContentToLoad.Draft);
   EPTXmlTextParser ept = new EPTXmlTextParser(docInfo.Content);
   //Enumerate each one of the fields using a foreach loop
   foreach (string s in ept)
   {
      Response.Write ("Field: " + s + "\t" + ept[s] + "<br />");
   }
}
catch(Exception ex)
{
   Response.Write ("<b>Error reading document: " + ex.Message + "</b>");
}
To do the same thing but with the Approved content of an EPT document you can use the CS_GetAnyEPTDocument method available on any Content Studio web page or the more powerful CSApprovedDocumentInformation class that is similar to the CSDocumentInformation class but requires only BROWSE permission for the caller.

Note
When reading the current EPT-document from a Presentation template you use the CS_DataFields property that returns an EPTXmlTextParser representing the EPT document.

try
{
   //Load the approved content of the document, this requires BROWSE permission for the caller.
   EPTXmlTextParser ept = CS_GetAnyEPTDocument(3769);
   foreach (string s in ept)
   {
      Response.Write ("Field: " + s + "\t" + ept[s] + "<br />");
   }
}
catch(Exception ex)
{
   Response.Write ("<b>Error reading document: " + ex.Message + "</b>");
}
See Also

Reference