Instance Method

objects(forXQuery:constants:)

Returns the objects resulting from executing an XQuery query upon the receiver.

Declaration

func objects(forXQuery xquery: String, constants: [String : Any]?) throws -> [Any]

Parameters

xquery

A string that expresses an XQuery query.

constants

A dictionary containing externally declared constants where the name of each constant variable is a key.

error

If query errors occur, indirectly returns an NSError object describing the errors.

Discussion

The receiver acts as the context item for the query (“.”). If the receiver has been changed after parsing to have multiple adjacent text nodes, you should invoke the NSXMLElement method normalizeAdjacentTextNodesPreservingCDATA(_:) (with an argument of false) to coalesce the text nodes before querying.

See Also

Executing Queries

func nodes(forXPath: String) -> [XMLNode]

Returns the nodes resulting from executing an XPath query upon the receiver.

func objects(forXQuery: String) -> [Any]

Returns the objects resulting from executing an XQuery query upon the receiver.

var xPath: String?

Returns the XPath expression identifying the receiver’s location in the document tree.