Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML::Reader constants missing #369

Closed
kliuless opened this issue Nov 2, 2010 · 2 comments
Closed

XML::Reader constants missing #369

kliuless opened this issue Nov 2, 2010 · 2 comments

Comments

@kliuless
Copy link

kliuless commented Nov 2, 2010

I'm aware this is a dup of issue #194, but the constants in XML::Node are not those returned by Reader#node_type; rather they appear to be the enum values of xmlReaderTypes defined in xmlreader.h.

Example:
Nokogiri::XML::Reader(' ').tap {|rdr|
while rdr.read
p [rdr.name, rdr.depth, rdr.node_type]
end
}
# ["top", 0, 1]
# ["#text", 1, 14]
# ["top", 0, 15]

The whitespace node is type 14 and the close tag is type 15, which match xmlReaderTypes:
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
XML_READER_TYPE_END_ELEMENT = 15,

Compare with XML::Node constants:
Nokogiri::XML::Node.tap {|n| p [n::DTD_NODE, n::ELEMENT_DECL] }
# => [14, 15]

Thanks for looking into this.

@flavorjones
Copy link
Member

Ah, I am now enlightened. We can do this.

@flavorjones
Copy link
Member

XML::Reader constants. closed by 297214873fb2a5ef14de74e6be924ca0f4641f40.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants