Content Studio Web Content Management System
SystemObject
ContentStudio.Document.EPTXmlFilterObject
ContentStudio.Document.EPTXmlFilter
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Top
Top
Top
To use this class create an instance of it, add the fields to work with, set any additional properties
whose default values does not match your needs and call the Filter method to get the result.
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.]
This class derives from the XmlFilterObject base class and provides a simplified way of performing
Xml filter query operations against the Content Studio Xml index.
Inheritance Hierarchy
ContentStudio.Document.EPTXmlFilterObject
ContentStudio.Document.EPTXmlFilter
Namespace: ContentStudio.Document.EPT
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
The XmlFilter type exposes the following members.
Constructors
Name | Description | |
---|---|---|
XmlFilter(CategoryId) |
Creates a new instance of the XmlFilter class that is only used when this object is used as argument to a remote filtering method that accepts it.
When using this constructor you cannot call the Filter method unless you are in an HttpContext or the properties for ConnectionId and SessionId are set.
| |
XmlFilter(ConnectionId, SessionId, Int32) |
Creates a new instance of the XmlFilter class that can be used to perform a query against the Content Studio Xml index.
No validation of the parameters against Content Studio is done in this constructor.
|
Properties
Name | Description | |
---|---|---|
Aggregation |
Indicates if and how the query should be aggregated.
(Inherited from XmlFilterObject.) | |
CategoryID | Returns the EPT category where the filtering should be done. (Inherited from XmlFilterObject.) | |
CheckForReadPermission |
Sets or gets a value that specifies whether Content Studio should check for read permission instead of browse permission.
(Inherited from XmlFilterObject.) | |
connectionID |
Gets a value that identifies the web site.
| |
DraftsOnly |
Sets or gets a value that specifies whether the draft should be queried and optionally returned instead of the published content. Pass null (Nothing in Visual Basic) to filter against the draft or the approved content, if draft was not found.
(Inherited from XmlFilterObject.) | |
FieldNames |
Returns an array of fields names defined in the collection.
(Inherited from XmlFilterObject.) | |
FilterCriteria |
Sets or gets the T-SQL argument to filter on.
(Inherited from XmlFilterObject.) | |
IgnorePublishStatus |
Sets or gets a value that specifies whether the published flag should be checked. If this property is turned off performance can be improved. Note that unpublished documents will be included in the result with this property set to true.
(Inherited from XmlFilterObject.) | |
Item |
Returns a XmlFilteringFieldDefinition with the specified name. In C# this is the indexer.
(Inherited from XmlFilterObject.) | |
PageCount |
Gets a value that indicates the number of pages found after the filtering operation.
(Overrides XmlFilterObjectPageCount.) | |
PageNumber | Gets or sets a value that indicates which page to return. This value cannot be less than 1.
(Inherited from XmlFilterObject.) | |
PageSize | Gets or sets the size of each page used. This value cannot be less than 0.
(Inherited from XmlFilterObject.) | |
PreviewDate |
Sets or gets a value that specifies a point in time to filter.
(Inherited from XmlFilterObject.) | |
Random |
Gets or sets a value indicating whether the data returned from this XmlFilter is sorted randomly.
| |
RangeSize | Gets or sets the number of rows to evaluate depending on the range of pages to return.
(Inherited from XmlFilterObject.) | |
RecordCount |
Gets a value that indicates the number of records found after the filtering operation.
(Overrides XmlFilterObjectRecordCount.) | |
ReturnExtendedFields |
Sets or gets a value that specifies whether Content Studio should return datafields with extra information.
(Inherited from XmlFilterObject.) | |
sessionID |
Gets a value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
| |
SortCommand |
Sets or gets the T-SQL clause that defines the sort instruction for the returned data.
(Inherited from XmlFilterObject.) |
Methods
Name | Description | |
---|---|---|
AddField(String) |
Adds a new field to the collection of field to filter. The field does not return data.
(Inherited from XmlFilterObject.) | |
AddField(String, XmlIndexQueryQueryDataTypes) |
Adds a new field to the collection of field to filter on that does not return data and is of a certain data type.
The name of the field must be unique and indexed and the number of fields cannot exceed PARAMETER_COUNT.
(Inherited from XmlFilterObject.) | |
AddField(String, Boolean) |
Adds a new field to the collection of field to filter on,
with the possibility to specify whether to return data or not.
(Inherited from XmlFilterObject.) | |
AddField(String, Boolean, XmlIndexQueryQueryDataTypes) |
Adds a new field to the collection of field to filter on,
with the possibility to specify whether to return data for the field and specify a data type for sorting.
(Inherited from XmlFilterObject.) | |
Equals | (Inherited from Object.) | |
ExistsField |
Determines whether the collection contains the specified field name.
(Inherited from XmlFilterObject.) | |
Filter |
Performs the filter operation against Content Studio and return data as Xml (Overrides XmlFilterObjectFilter.) | |
FilterReader |
Performs the filter operation against Content Studio and returns an object that enables the caller to retrieve the data
in an object oriented way.
| |
FilterScalar |
Performs the filter operation against the Content Studio EPT Xml index and returns the identifier
of the first document that matches the filter condition.
| |
FilterScalar(String, String) |
Performs the filter operation against Content Studio EPT Xml index and returns the first document identifier that matches the filter condition and data from one field of that document.
| |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
RemoveField |
Removes the XmlFilteringFieldDefinition with the specified name from the collection.
(Inherited from XmlFilterObject.) | |
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