Content Studio Web Content Management System
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Returns the published content of any XML document as an EPTXmlTextParser.
Browse permission on the document is required and anonymous calls are
supported.
Note: Do not use this method to open the EPT-document to
be presented in a presentation template, in this case use the CS_DataFields
property that returns the same object type but that already is
instantiated.
The returned EPTXmlTextParser
makes it easy to get field values of any EPT document that is published
and accessible to the visitor.
Security warning!
It is up to you as a programmer to wisely judge what information is acceptible to display on a public web page. For example: An EPT document might contain fields with classified data that are filtered out by using carefully crafted presentation templates. But, with the CS_GetAnyEPTDocument method, you can easily bypass any business rules specified in presentation templates thus causing unwanted information leaks.
The following example shows how the CS_GetAnyEPTDocument method can be
used to enumerate all fields in an arbitrary EPT document and write the
field names and their values to the HTML stream. The code also checks,
by using the IsEmptyField(String)
method, if a field value is empty or null and writes a note about this.
A second example shows how to open an EPT document and get the value of a single named field.
[This is preliminary documentation and is subject to change.]
Returns the published content of any XML document as an EPTXmlTextParser.
Namespace: ContentStudio.Site
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
Parameters
- documentId
- Type: ContentStudio.DocumentDocumentId
The XML document to get content for. The document must be published, must be an EPT document and must have browse permissions for the caller.
Return Value
Type: EPTXmlTextParserReturns the published content of any XML document as an EPTXmlTextParser.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | The document is not a valid EPT document |
CSException | A business rule was violated in the underlying Content Studio database
|
FileNotFoundException | The file on disc representing the document does not exist. |
SqlException | An error occurred when executing the command against the Content Studio database |
Remarks
Security warning!
It is up to you as a programmer to wisely judge what information is acceptible to display on a public web page. For example: An EPT document might contain fields with classified data that are filtered out by using carefully crafted presentation templates. But, with the CS_GetAnyEPTDocument method, you can easily bypass any business rules specified in presentation templates thus causing unwanted information leaks.
Examples
int documentId = 4372; ContentStudio.Document.EPT.EPTXmlTextParser ept; try { ept = CS_GetAnyEPTDocument(DocumentID); Response.Write("<table>\r\n"); Response.Write(" <tr style=\"text-align:left;\"><th>Field name</th><th>Field value</th></tr>\r\n"); foreach(string s in ept) { Response.Write(" <tr>"); Response.Write("<td>"); Response.Write(Server.HtmlEncode(s)); Response.Write("</td>"); Response.Write("<td>"); //Check if the field value is empty or null if(!ept.IsEmptyField(s)) Response.Write(Server.HtmlEncode(ept[s])); else Response.Write("<i>The value is empty or unspecified</i>"); Response.Write("</td>"); Response.Write("</tr>\r\n"); } Response.Write("</table>\r\n"); } catch(ContentStudio.CSException ex) { Response.Write("<b>" + Server.HtmlEncode(CS_TranslateMessage(ex)) + "</b>"); } catch(Exception ex) { Response.Write("<b>" + Server.HtmlEncode(ex.Message) + "</b>"); }
int documentId = 4372; string FieldName = "Header"; ContentStudio.Document.EPT.EPTXmlTextParser ept; try { ept = CS_GetAnyEPTDocument(DocumentID); Response.Write(Server.HtmlEncode("Fieldvalue: " + ept[FieldName])); } catch (ContentStudio.CSException ex) { Response.Write("<b>" + Server.HtmlEncode(CS_TranslateMessage(ex)) + "</b>"); } catch (Exception ex) { Response.Write("<b>" + Server.HtmlEncode(ex.Message) + "</b>"); }
See Also