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

[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

SystemObject
  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

public class XmlFilter : XmlFilterObject

The XmlFilter type exposes the following members.

Constructors

  NameDescription
Public methodXmlFilter(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.
Public methodXmlFilter(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.
Top
Properties

  NameDescription
Public propertyAggregation
Indicates if and how the query should be aggregated.
(Inherited from XmlFilterObject.)
Public propertyCategoryID
Returns the EPT category where the filtering should be done.
(Inherited from XmlFilterObject.)
Public propertyCheckForReadPermission
Sets or gets a value that specifies whether Content Studio should check for read permission instead of browse permission.
(Inherited from XmlFilterObject.)
Public propertyconnectionID
Gets a value that identifies the web site.
Public propertyDraftsOnly
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.)
Public propertyFieldNames
Returns an array of fields names defined in the collection.
(Inherited from XmlFilterObject.)
Public propertyCode exampleFilterCriteria
Sets or gets the T-SQL argument to filter on.
(Inherited from XmlFilterObject.)
Public propertyIgnorePublishStatus
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.)
Public propertyItem
Returns a XmlFilteringFieldDefinition with the specified name. In C# this is the indexer.
(Inherited from XmlFilterObject.)
Public propertyPageCount
Gets a value that indicates the number of pages found after the filtering operation.
(Overrides XmlFilterObjectPageCount.)
Public propertyPageNumber
Gets or sets a value that indicates which page to return. This value cannot be less than 1.
(Inherited from XmlFilterObject.)
Public propertyPageSize
Gets or sets the size of each page used. This value cannot be less than 0.
(Inherited from XmlFilterObject.)
Public propertyPreviewDate
Sets or gets a value that specifies a point in time to filter.
(Inherited from XmlFilterObject.)
Public propertyRandom
Gets or sets a value indicating whether the data returned from this XmlFilter is sorted randomly.
Public propertyRangeSize
Gets or sets the number of rows to evaluate depending on the range of pages to return.
(Inherited from XmlFilterObject.)
Public propertyRecordCount
Gets a value that indicates the number of records found after the filtering operation.
(Overrides XmlFilterObjectRecordCount.)
Public propertyReturnExtendedFields
Sets or gets a value that specifies whether Content Studio should return datafields with extra information.
(Inherited from XmlFilterObject.)
Public propertysessionID
Gets a value that identifies the user's session. This value usually originates from a call to OpenSession(ConnectionId).
Public propertyCode exampleSortCommand
Sets or gets the T-SQL clause that defines the sort instruction for the returned data.
(Inherited from XmlFilterObject.)
Top
Methods

  NameDescription
Public methodAddField(String)
Adds a new field to the collection of field to filter. The field does not return data.
(Inherited from XmlFilterObject.)
Public methodAddField(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.)
Public methodAddField(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.)
Public methodAddField(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.)
Public methodEquals (Inherited from Object.)
Public methodExistsField
Determines whether the collection contains the specified field name.
(Inherited from XmlFilterObject.)
Public methodFilter
Performs the filter operation against Content Studio and return data as Xml
(Overrides XmlFilterObjectFilter.)
Public methodFilterReader
Performs the filter operation against Content Studio and returns an object that enables the caller to retrieve the data in an object oriented way.
Public methodFilterScalar
Performs the filter operation against the Content Studio EPT Xml index and returns the identifier of the first document that matches the filter condition.
Public methodCode exampleFilterScalar(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.
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRemoveField
Removes the XmlFilteringFieldDefinition with the specified name from the collection.
(Inherited from XmlFilterObject.)
Public methodToString (Inherited from Object.)
Top
Remarks

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.
Examples

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.
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

Reference