Content Studio Web Content Management System
SystemObject
ContentStudio.Document.EPTEPTXmlParser
ContentStudio.Document.EPTEPTXmlTextParser
ContentStudio.Document.EPTEPTXmlEditableParser
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Top
Top
Top
Top
Top
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.
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.
[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
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
The EPTXmlTextParser type exposes the following members.
Constructors
Name | Description | |
---|---|---|
EPTXmlTextParser |
Creates an empty EPTXmlTextParser collection of EPT field names
| |
EPTXmlTextParser(Int32) |
Creates an empty EPTXmlTextParser collection of EPT field names
| |
EPTXmlTextParser(Stream) |
Creates a new EPTXmlTextParser from a stream of xml content
| |
EPTXmlTextParser(String) |
Creates a new EPTXmlTextParser from a string of xml content
| |
EPTXmlTextParser(XmlReader) |
Creates a new EPT field collection object
| |
EPTXmlTextParser(Int32, Int32) |
Creates an empty EPTXmlTextParser collection of EPT field names
| |
EPTXmlTextParser(Int32, Stream) |
Creates a new EPTXmlTextParser from a stream of xml content
| |
EPTXmlTextParser(Int32, String) |
Creates a new EPTXmlTextParser from a string of xml content
| |
EPTXmlTextParser(Int32, XmlReader) |
Creates a new EPT field collection object
| |
EPTXmlTextParser(Int32, Int32, Int32) |
Creates an empty EPTXmlTextParser collection of EPT field names
| |
EPTXmlTextParser(Stream, Int32, Int32) |
Creates a new EPTXmlTextParser from a stream of xml content
| |
EPTXmlTextParser(String, Int32, Int32) |
Creates a new EPTXmlTextParser from a string of xml content
| |
EPTXmlTextParser(XmlReader, Int32, Int32) |
Creates a new EPT field collection object
| |
EPTXmlTextParser(Int32, Stream, Int32, Int32) |
Creates a new EPTXmlTextParser from a stream of xml content
| |
EPTXmlTextParser(Int32, String, Int32, Int32) |
Creates a new EPTXmlTextParser from a string of xml content
| |
EPTXmlTextParser(Int32, XmlReader, Int32, Int32) |
Creates a new EPT field collection object
|
Properties
Name | Description | |
---|---|---|
CategoryID |
Gets a value that indicates the category where the document belongs.
| |
Count |
Gets the number of unique field names in the EPT field collection.
(Inherited from EPTXmlParser.) | |
DocumentID |
Gets a value that identifies the document loaded.
| |
DocumentName |
Sets or gets the name of the document.
| |
Fields |
Returns an array of all field names
(Inherited from EPTXmlParser.) | |
HasFields |
Gets a value that indicates whether the EPT collection has any fields or not.
(Inherited from EPTXmlParser.) | |
ItemInt32 |
Gets the entry at the specified index of the the fields collection.
(Overrides EPTXmlParserItemInt32.) | |
ItemString |
Gets the entry with the specified key in the fields collection.
(Overrides EPTXmlParserItemString.) | |
ReadOnly |
Returns whether the EPT field collection is read-only or not.
(Overrides EPTXmlParserReadOnly.) |
Methods
Name | Description | |
---|---|---|
BaseAdd |
Adds an entry with the specified name and value to the EPT field collection
(Inherited from EPTXmlParser.) | |
BaseClear |
Removes all the fields and their values
(Inherited from EPTXmlParser.) | |
BaseRemove |
Removes a field in the EPT field collection
(Inherited from EPTXmlParser.) | |
BaseSet |
Sets the value of an entry in the collection of EPT fields
(Inherited from EPTXmlParser.) | |
Equals(Object) |
Determines whether the specified Object is an EPTXmlParser that has
the same content as the current EPTXmlParser.
(Inherited from EPTXmlParser.) | |
Equals(EPTXmlParser) |
Determines whether the specified EPTXmlParser
has the same content as the current EPTXmlParser.
(Inherited from EPTXmlParser.) | |
ExistsField |
Determines whether a field exists or not
(Inherited from EPTXmlParser.) | |
Finalize | (Inherited from Object.) | |
Get(Int32) |
Gets the values at the specified index of the EPT field collection combined into one comma-separated list.
(Inherited from EPTXmlParser.) | |
Get(String) |
Gets the values associated with the specified field from the the EPT field collection combined into one comma-separated list.
(Inherited from EPTXmlParser.) | |
GetAsDateTime |
Returns the value as a DateTime of a specified Content Studio EPT field.
| |
GetAsInt32 |
Returns the value as an Int32 of a specified Content Studio EPT field.
| |
GetAsString(String) |
Returns the value, as as String of a specified Content Studio EPT field.
| |
GetAsString(String, Boolean) |
Returns the value, as as String of a specified Content Studio EPT field with option to remove any embedded html markup.
| |
GetEnumerator |
Returns an enumerator that iterates through a collection.
(Inherited from EPTXmlParser.) | |
GetField |
Returns the field name at a specific location
(Inherited from EPTXmlParser.) | |
GetFieldIndex |
Gets the zero-based index of a field.
(Inherited from EPTXmlParser.) | |
GetHashCode |
Gets the hash code for this EPTXmlParser.
(Inherited from EPTXmlParser.)A developer can use this value to compare the content of two different instances of an EPTXmlParser. | |
GetHashCodeForField(Int32) |
Gets the hash code for a specific field based on its ordinal number.
(Inherited from EPTXmlParser.) | |
GetHashCodeForField(String) |
Gets the hash code for a specific field.
(Inherited from EPTXmlParser.) | |
GetType | (Inherited from Object.) | |
GetValues(Int32) |
Returns an array of all values that exists for a field
(Inherited from EPTXmlParser.) | |
GetValues(String) |
Gets the values at the specified field of the EPT field collection.
(Inherited from EPTXmlParser.) | |
IsEmptyField |
Determines if a field is non-existing or has a value that is empty or null.
(Inherited from EPTXmlParser.) | |
Load |
Loads the storage with new EPT data.
(Inherited from EPTXmlParser.) | |
MemberwiseClone | (Inherited from Object.) | |
SetCategory |
Sets the category id of this instance. This value can only be set if the CategoryID property is zero.
| |
SetDocument |
Sets the document id of this instance. This value can only be set if the DocumentID property is zero.
| |
ToPlainText |
This method gets the EPT data as plain text with all Xml markup removed and using the specified options.
| |
ToString |
Returns the EPT xml using the default UTF-8 encoding
(Overrides ObjectToString.) | |
ToString(Encoding) |
Returns the EPT xml as a string encoded with the specified encoding.
| |
TryGetValue(String, String) |
Gets the value associated with the specified field name.
(Inherited from EPTXmlParser.) | |
TryGetValue(String, String, Boolean) |
Gets the value associated with the specified field name.
(Inherited from EPTXmlParser.) | |
Write(Stream) |
Writes the full Xml content of the Ept document to the supplied System.IO.Stream using the default UTF-8 encoding.
| |
Write(Stream, Encoding) |
Writes the full Xml content of the Ept document to the supplied System.IO.Stream using the supplied encoding.
| |
WritePlainText(Stream, String, Boolean) |
Writes the content of the document as plain text to a Stream using specified options and the Unicode encoding
| |
WritePlainText(TextWriter, String, Boolean) |
Writes the content of the document as plain using the supplied a TextWriter, with the specified options.
| |
WritePlainText(StringBuilder, String, Boolean) |
Writes the content of the document as plain text to a StringBuilder using specified options.
| |
WritePlainText(Stream, String, Boolean, Encoding) |
Writes the content of the document as plain text to a Stream using the specified options and a specific encoding
|
Events
Name | Description | |
---|---|---|
EptFieldAdded |
Occurs when an EPT field is added.
(Inherited from EPTXmlParser.) | |
EptFieldRemoved |
Occurs when an EPT field is removed.
(Inherited from EPTXmlParser.) | |
EptFieldValueChanged |
Occurs when a the value of a field changes.
(Inherited from EPTXmlParser.) | |
EptFieldValueChanging |
Occurs when a field value is about to be changed.
(Inherited from EPTXmlParser.) |
Fields
Name | Description | |
---|---|---|
INITIALSIZE |
Defines the number of fields that the object initially can hold.
|
Examples
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>"); }
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