Documentation Language: Swift

Class

XMLDocument

A Swift wrapper around a libxml2 document.

class XMLDocument

Topics

Initializers

?
init(buffer:options:parser:)

Parses a document from an in-memory character buffer.

?
init(data:options:parser:)

Parses a document from in-memory data.

?
init(fromFile:)

Parses a document from a file on disk.

?
init(xmlDocument:)

Wraps an existing libxml2 document pointer.

Instance Properties

V
rootElement

The root element of the parsed document tree.

V
tree

A tree view that yields each node together with its level and parent.

Instance Methods

F
valueFor(attribute:)

Resolves the string value stored in a libxml2 attribute node.

F
valueFor(attribute:inElement:)

Resolves the value of a named attribute on an element.

F
xpath(_:context:)

Evaluates an XPath expression in an existing libxml2 XPath context.

F
xpath(_:namespaces:)

Compiles an XPath expression using explicit namespace registrations.

F
xpath(_:namespaces:defaultPrefix:)

Compiles an XPath expression using namespace declarations from the document.

Type Aliases

T
XMLDocument.ParserOptions

Parser option flags understood by libxml2.

Default Implementations

Relationships

Conforms To

See Also

Parsing Documents

V
xmlMemoryParser

In-memory XML parser.

V
htmlMemoryParser

In-memory HTML parser.