Class | Nokogiri::XML::Reader
In: | lib/nokogiri/ffi/xml/reader.rb lib/nokogiri/xml/reader.rb ext/nokogiri/html_document.c
Parent: | Object

The Reader parser allows you to effectively pull parse an XML document. Once instantiated, call Nokogiri::XML::Reader#each to iterate over each node. Note that you may only iterate over the document once!

### Methods

attribute attribute_at attribute_count attribute_nodes attributes attributes? default? depth each from_io from_memory lang local_name name namespace_uri namespaces prefix read state value value? xml_version

### Included Modules

Enumerable

### Attributes

encoding | [R] | The encoding for the document
errors | [RW] | A list of errors encountered while parsing
source | [R] | The XML source

### Public Class methods

from_io(io, url = nil, encoding = nil, options = 0)

Create a new reader that parses `io`

from_memory(string, url = nil, encoding = nil, options = 0)

Create a new reader that parses `string`

### Public Instance methods

attribute(name)

Get the value of attribute named `name`

attribute_at(index)

Get the value of attribute at `index`

attribute_count

Get the number of attributes for the current node

attribute_nodes

Get a list of attributes for this Node

attributes()

Get a list of attributes for the current node.

attributes?

Does this node have attributes?

default?

Was an attribute generated from the default value in the DTD or schema?

depth

Get the depth of the node

each(&block)

Move the cursor through the document yielding each node to the block

lang

Get the xml:lang scope within which the node resides.

local_name

Get the local name of the node

name

Get the name of the node

namespace_uri

Get the URI defining the namespace associated with the node

namespaces

Get a hash of namespaces for this Node

prefix

Get the shorthand reference to the namespace associated with the node.

read

Move the Reader forward through the XML document.

state

Get the state of the reader

value

Get the text value of the node if present

value?

Does this node have a text value?

xml_version

Get the XML version of the document being read

[Validate]