Documentation Language: Swift

Method

xpath(_:namespaces:)

Compiles an XPath expression using explicit namespace registrations.

func xpath(_ path: String, namespaces ns: [(prefix: String, href: String)]) -> XMLPath?

Parameters

path

The XPath expression to compile.

ns

Namespace registrations as (prefix, href) tuples.

Return Value

A compiled XPath result, or nil when context creation or evaluation fails.

Discussion

This overload is convenient when namespace prefixes are known in advance and do not need to be read from the document.