Package nokogiri.internals

Examples of nokogiri.internals.ReaderNode


        return currentNode().getDepth();
    }

    @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);
View Full Code Here


        ensureNodeClosed(context);
        return stringOrBlank(context.getRuntime(), getOuterXml());
    }

    private String getOuterXml() {
        ReaderNode current = currentNode();
        if (current.depth < 0) return null;

        if (current instanceof ClosingNode) {
          return "<" + current.name + "/>";
        }
View Full Code Here

        throw context.getRuntime().newRuntimeError("Received IOException: " + e.getMessage());
      }
    }

    private void ensureNodeClosed(ThreadContext context) {
      ReaderNode node = currentNode();
      if (node instanceof TextNode) {
        return;
      }
      while (node.endOffset < 1) {
        readMoreData(context);
View Full Code Here

            String uri = element.uri;
            String localName = element.localpart;
            String qName = element.rawname;
            depth--;
            ElementNode startElementNode = elementStack.pop();
            ReaderNode node = ReaderNode.createClosingNode(ruby, uri, localName, qName, depth, langStack, xmlBaseStack);

            startElementNode.endOffset = nodeQueue.size() - 1;

            if (startElementNode.endOffset != startElementNode.startOffset) {
              // this node isn't empty
View Full Code Here

        private void commonElement(QName element, XMLAttributes attrs, boolean isEmpty) {
            String qName = element.rawname;
            String uri = element.uri;
            String localName = element.localpart;
            ReaderNode readerNode = ReaderNode.createElementNode(ruby, uri, localName, qName, attrs, depth, langStack, xmlBaseStack);
            if (!elementStack.isEmpty()) {
              ElementNode parent = elementStack.peek();
              parent.hasChildren = true;
            }
            nodeQueue.add(readerNode);
View Full Code Here

TOP

Related Classes of nokogiri.internals.ReaderNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.