Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
NodeType
XMLParser.swift:18enum NodeType
Cases
case none
There’s no node (no file or buffer opened).
case element
An element node type, also known as a tag, e.g.
<title>
.case elementEnd
An end of element node type, e.g.
</title>
.case text
A text node type, i.e. text that is not inside an element. This includes whitespace.
case comment
A comment node type, e.g.
<!--A comment-->
.case cdata
A node type for CDATA (Character Data) sections, e.g.
<![CDATA[CDATA section]]>
.case unknown
An unknown node type.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (18) members.
Type members
Instance members
func getAttributeCount(
) -> Int32 Returns the number of attributes in the currently parsed element.
func getAttributeName(idx: Int32
) -> String Returns the name of an attribute of the currently parsed element, specified by the
idx
index.func getAttributeValue(idx: Int32
) -> String Returns the value of an attribute of the currently parsed element, specified by the
idx
index.func getCurrentLine(
) -> Int32 Returns the current line in the parsed file, counting from 0.
func getNamedAttributeValue(name: String
) -> String Returns the value of an attribute of the currently parsed element, specified by its
name
. This method will raise an error if the element has no such attribute.func getNamedAttributeValueSafe(name: String
) -> String Returns the value of an attribute of the currently parsed element, specified by its
name
. This method will return an empty string if the element has no such attribute.func getNodeData(
) -> String Returns the contents of a text node. This method will raise an error if the current parsed node is of any other type.
func getNodeName(
) -> String Returns the name of an element node. This method will raise an error if the currently parsed node is not of .nodeElement or .nodeElementEnd type.
func getNodeOffset(
) -> UInt Returns the byte offset of the currently parsed node since the beginning of the file or buffer. This is usually equivalent to the number of characters before the read position.
func getNodeType(
) -> XMLParser.NodeType Returns the type of the current node. Compare with
NodeType
constants.func hasAttribute(name: String
) -> Bool Returns
true
if the currently parsed element has an attribute with thename
.func isEmpty(
) -> Bool Returns
true
if the currently parsed element is empty, e.g.<element />
.func open(file: String
) -> GodotError Opens an XML
file
for parsing. This method returns an error code.func openBuffer(PackedByteArray
) -> GodotError Opens an XML raw
buffer
for parsing. This method returns an error code.func read(
) -> GodotError Parses the next node in the file. This method returns an error code.
func seek(position: UInt
) -> GodotError Moves the buffer cursor to a certain offset (since the beginning) and reads the next node there. This method returns an error code.
func skipSection(
) Skips the current section. If the currently parsed node contains more inner nodes, they will be ignored and the cursor will go to the closing of the current element.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.