WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIXULTemplateResult

IID:ebea0230-36fa-41b7-8e31-760806057965
Inherits From:nsISupports

A single result generated from a template query. Each result is identified by an id, which must be unique within the set of results produced from a query. The result may optionally be identified by an RDF resource.

Generally, the result and its id will be able to uniquely identify a node in the source data, such as an RDF or XML node. In other contexts, such as a database query, a result would represent a particular record.

A result is expected to only be created by a query processor.

Each result also contains a set of variable bindings. The value for a particular variable may be retrieved using the getBindingFor and getBindingObjectFor methods.


Properties

readonly AString id

ID of the result. The DOM element created for this result, if any, will have its id attribute set to this value. The id must be unique for a query.

readonly PRBool isContainer

True if the result represents a container.

readonly PRBool isEmpty

True if the result represents an empty container.

readonly PRBool mayProcessChildren

True if the template builder may use this result as the reference point for additional recursive processing of the template. The template builder will reprocess the template using this result as the reference point and generate output content that is expected to be inserted as children of the output generated for this result. If false, child content is not processed. This property identifies only the default handling and may be overriden by syntax used in the template.

readonly nsIRDFResource resource

Resource for the result, which may be null. If set, the resource uri must be the same as the ID property.

readonly AString type

The type of the object. The predefined value 'separator' may be used for separators. Other values may be used for application specific purposes.


Methods

AString getBindingFor ( nsIAtom var ) nsISupports getBindingObjectFor ( nsIAtom var ) void hasBeenRemoved ( ) void ruleMatched ( nsISupports query , nsIDOMNode ruleNode )

AString getBindingFor ( nsIAtom var )

Get the string representation of the value of a variable for this result. This string will be used in the action body from a template as the replacement text. For instance, if the text ?name appears in an attribute within the action body, it will be replaced with the result of this method. The question mark is considered part of the variable name, thus var should be ?name and not simply name.

Arguments:
var: the variable to look up
Returns:
the value for the variable or a null string if it has no value

nsISupports getBindingObjectFor ( nsIAtom var )

Get an object value for a variable such as ?name for this result.

This method may return null for a variable, even if getBindingFor returns a non-null value for the same variable. This method is provided as a convenience when sorting results.

Arguments:
var: the variable to look up
Returns:
the value for the variable or null if it has no value

void hasBeenRemoved ( )

Indicate that the output for a result has beeen removed and that the result is no longer being used by the builder.


void ruleMatched ( nsISupports query , nsIDOMNode ruleNode )

Indicate that a particular rule of a query has matched and that output will be generated for it. Both the query as compiled by the query processor's compileQuery method and the XUL element are supplied. The query must always be one that was compiled by the query processor that created this result. The element must always be a child of the element that was used to compile the query.

Arguments:
query: the query that matched
ruleNode: the rule node that matched

References

This interface is the type of the following properties:

nsIXULTemplateBuilder.rootResult

This interface is passed as an argument to the following methods:

nsIXULTemplateBuilder.addResult, nsIXULTemplateBuilder.removeResult, nsIXULTemplateBuilder.replaceResult, nsIXULTemplateBuilder.resultBindingChanged, nsIXULTemplateQueryProcessor.compareResults, nsIXULTemplateQueryProcessor.generateResults, nsIXULTemplateRuleFilter.match

This interface is returned from the following methods:

nsIXULTemplateBuilder.getResultForContent, nsIXULTemplateBuilder.getResultForId, nsIXULTemplateQueryProcessor.translateRef

Reference documentation is generated from Mozilla's source.

Copyright © 1999-2006 XULPlanet.com