Content Studio Web Content Management System
SystemObject
ContentStudio.Document.EPTXmlFilterReader
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Top
Top
The XmlFilterReader can only be used as a return value from a filter operation with XmlFilter class.
When loaded XmlFilterReader contains all the fields specified by the caller and the documentid id field that always is present if
any records were found.
The following sample code shows how you can use the XmlFilter class to perform an Xml filter query in Content Studio.
In this code two fields return data (Head and Intro) and two additional fields (Area and CS_PublishDate) is used for filtering and sorting only.
The data is returned as an XmlFilterReader object that we can use to navigate through the returned data.
Notice the pattern used to be able to read the data in pages. The reader can only read the rows contained
on one page, so in order to read multiple data pages you need close and reopen the reader using another data page.
Also notice the usage of the using construction to ensure that each reader instance is properly closed.
[This is preliminary documentation and is subject to change.]
Provides a way of reading a forward-only stream of rows from an XmlFilter query. This class cannot be inherited.
Inheritance Hierarchy
ContentStudio.Document.EPTXmlFilterReader
Namespace: ContentStudio.Document.EPT
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
The XmlFilterReader type exposes the following members.
Properties
Name | Description | |
---|---|---|
FieldCount |
Gets the number of columns in the current row.
| |
IsClosed |
Gets a value that indicates whether the object is closed or not
| |
ItemInt32 |
Gets the value of a column given the column ordinal.
| |
ItemString |
Gets the value of a column given the column name.
| |
RecordsRead |
Returns the number of records read so far.
|
Methods
Name | Description | |
---|---|---|
Close |
Closes the object and frees its underlying resources.
| |
Equals | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
GetValueAsDateTime(Int32) |
Gets the value of a column as an DateTime given the column ordinal.
| |
GetValueAsDateTime(String) |
Gets the value of a column as an DateTime given the column name.
| |
GetValueAsInt(Int32) |
Gets the value of a column as an Int32 given the column ordinal.
| |
GetValueAsInt(String) |
Gets the value of a column as an Int32 given the column name.
| |
Read |
Advances the XmlFilterReader to the next record.
| |
ToString | (Inherited from Object.) |
Remarks
Examples
Also notice the usage of the using construction to ensure that each reader instance is properly closed.
int CategoryID = 168; //Create a new instance of the XmlFilter object ContentStudio.Document.EPT.XmlFilter xfi = new ContentStudio.Document.EPT.XmlFilter(CS_ConnectionId, CS_UserSessionId, CategoryID); //Add the two fields that return data first the default String datatype xfi.AddField("Head", true); xfi.AddField("Intro", true); //Add fields to filter and sort on that does not return data xfi.AddField("Area", ContentStudio.Document.EPT.XmlIndexQuery.QueryDataTypes.Integer); xfi.AddField("CS_PublishDate", ContentStudio.Document.EPT.XmlIndexQuery.QueryDataTypes.DateTime); //Define a criteria and a sort command xfi.FilterCriteria = "[Area] > 1173"; xfi.SortCommand = "[CS_PublishDate] DESC"; //Limit the number of records xfi.PageSize = 10; Response.Write("<table>" + Environment.NewLine); //perform the filter operation and read the data using an XmlFilterReader //until the last page has been reached do { using (XmlFilterReader xre = xfi.FilterReader()) { //Get the data while (xre.Read()) { Response.Write("<tr>" + Environment.NewLine); Response.Write("<td>" + Server.HtmlEncode(xre["Head"]) + "</td>"); Response.Write("<td>" + Server.HtmlEncode(xre["Intro"]) + "</td>"); Response.Write("</tr>" + Environment.NewLine); } } //Move to the next data page xfi.PageNumber++; }(while xfi.PageNumber <= xfi.PageCount); Response.Write("</table>" + Environment.NewLine);
See Also