XPathResult
public enum XPathResult
This enum represents a result of a search by an XPath.
- none: The result value is undefined
- nodeSet: The result value is a node set
- bool: The result value is a boolean
- number: The result value is a number
- string: The result value is a string
-
The result value is undefined
Declaration
Swift
case none
-
The result value is a node set
Declaration
Swift
case nodeSet(XMLNodeSet)
-
The result value is a boolean
Declaration
Swift
case bool(Bool)
-
The result value is a number
Declaration
Swift
case number(Double)
-
The result value is a string
Declaration
Swift
case string(String)
-
The position of the first element in a nonempty collection.
If the collection is empty,
startIndex
is equal toendIndex
.Declaration
Swift
public var startIndex: Int
-
Accesses the element at the specified position.
The following example accesses an element of an array through its subscript to print its value:
var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"] print(streets[1]) // Prints "Bryant"
You can subscript a collection with any valid index other than the collection’s end index. The end index refers to the position one past the last element of a collection, so it doesn’t correspond with an element.
Parameter
Parameter position: The position of the element to access.position
must be a valid index of the collection that is not equal to theendIndex
property.Declaration
Swift
public subscript(index: Int) -> XMLElement
Parameters
position
The position of the element to access.
position
must be a valid index of the collection that is not equal to theendIndex
property. -
The collection’s
past the end
position—that is, the position one greater than the last valid subscript argument.When you need a range that includes the last element of a collection, use the half-open range operator (
..<
) withendIndex
. The..<
operator creates a range that doesn’t include the upper bound, so it’s always safe to use withendIndex
. For example:let numbers = [10, 20, 30, 40, 50] if let index = numbers.index(of: 30) { print(numbers[index ..< numbers.endIndex]) } // Prints "[30, 40, 50]"
If the collection is empty,
endIndex
is equal tostartIndex
.Declaration
Swift
public var endIndex: Int
-
Returns the position immediately after the given index.
Returns
The index value immediately afteri
.Declaration
Swift
public func index(after i: Int) -> Int
Parameters
i
A valid index of the collection.
i
must be less thanendIndex
.Return Value
The index value immediately after
i
.
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
a
andb
,a == b
implies thata != b
isfalse
.- Parameters:
- lhs: A value to compare.
- rhs: Another value to compare.
Declaration
Swift
public static func ==(lhs: XPathResult, rhs: XPathResult) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
- Parameters: