Search in sources :

Example 1 with ElementNode

use of nokogiri.internals.ReaderNode.ElementNode in project gocd by gocd.

the class XmlReader method empty_element_p.

@JRubyMethod(name = { "empty_element?", "self_closing?" })
public IRubyObject empty_element_p(ThreadContext context) {
    ReaderNode readerNode = currentNode();
    ensureNodeClosed(context);
    if (readerNode == null)
        return context.getRuntime().getNil();
    if (!(readerNode instanceof ElementNode))
        context.getRuntime().getFalse();
    return RubyBoolean.newBoolean(context.getRuntime(), !readerNode.hasChildren);
}
Also used : ReaderNode(nokogiri.internals.ReaderNode) ElementNode(nokogiri.internals.ReaderNode.ElementNode) JRubyMethod(org.jruby.anno.JRubyMethod)

Example 2 with ElementNode

use of nokogiri.internals.ReaderNode.ElementNode in project nokogiri by sparklemotion.

the class XmlReader method empty_element_p.

@JRubyMethod(name = { "empty_element?", "self_closing?" })
public IRubyObject empty_element_p(ThreadContext context) {
    ReaderNode readerNode = currentNode();
    ensureNodeClosed(context);
    if (readerNode == null) {
        return context.getRuntime().getNil();
    }
    if (!(readerNode instanceof ElementNode)) {
        context.getRuntime().getFalse();
    }
    return RubyBoolean.newBoolean(context.getRuntime(), !readerNode.hasChildren);
}
Also used : ReaderNode(nokogiri.internals.ReaderNode) ElementNode(nokogiri.internals.ReaderNode.ElementNode) JRubyMethod(org.jruby.anno.JRubyMethod)

Aggregations

ReaderNode (nokogiri.internals.ReaderNode)2 ElementNode (nokogiri.internals.ReaderNode.ElementNode)2 JRubyMethod (org.jruby.anno.JRubyMethod)2