Java Code Examples for org.jsoup.helper.Validate#isFalse()

The following examples show how to use org.jsoup.helper.Validate#isFalse() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public XPathEvaluator parse() {

        while (!tq.isEmpty()) {
            Validate.isFalse(noEvalAllow, "XPath error! No operator allowed after attribute or function!" + tq);
            if (tq.matchChomp(OR_COMBINATOR)) {
                tq.consumeWhitespace();
                return combineXPathEvaluator(tq.remainder());
            } else if (tq.matchesAny(HIERARCHY_COMBINATORS)) {
                combinator(tq.consumeAny(HIERARCHY_COMBINATORS));
            } else {
                findElements();
            }
            tq.consumeWhitespace();
        }
        return collectXPathEvaluator();
    }
 
Example 2
Source Project: astor   File: Tokeniser.java    License: GNU General Public License v2.0 6 votes vote down vote up
void emit(Token token) {
    Validate.isFalse(isEmitPending, "There is an unread token pending!");

    emitPending = token;
    isEmitPending = true;

    if (token.type == Token.TokenType.StartTag) {
        Token.StartTag startTag = (Token.StartTag) token;
        lastStartTag = startTag.tagName;
        if (startTag.selfClosing)
            selfClosingFlagAcknowledged = false;
    } else if (token.type == Token.TokenType.EndTag) {
        Token.EndTag endTag = (Token.EndTag) token;
        if (endTag.attributes != null)
            error("Attributes incorrectly present on end tag");
    }
}
 
Example 3
Source Project: jsoup-learning   File: Tokeniser.java    License: MIT License 6 votes vote down vote up
void emit(Token token) {
    Validate.isFalse(isEmitPending, "There is an unread token pending!");

    emitPending = token;
    isEmitPending = true;

    if (token.type == Token.TokenType.StartTag) {
        Token.StartTag startTag = (Token.StartTag) token;
        lastStartTag = startTag;
        if (startTag.selfClosing)
            selfClosingFlagAcknowledged = false;
    } else if (token.type == Token.TokenType.EndTag) {
        Token.EndTag endTag = (Token.EndTag) token;
        if (endTag.attributes != null)
            error("Attributes incorrectly present on end tag");
    }
}
 
Example 4
Source Project: xsoup   File: XPathParser.java    License: MIT License 6 votes vote down vote up
public XPathEvaluator parse() {

        while (!tq.isEmpty()) {
            Validate.isFalse(noEvalAllow, "XPath error! No operator allowed after attribute or function!" + tq);
            if (tq.matchChomp(OR_COMBINATOR)) {
                tq.consumeWhitespace();
                return combineXPathEvaluator(tq.remainder());
            } else if (tq.matchesAny(HIERARCHY_COMBINATORS)) {
                combinator(tq.consumeAny(HIERARCHY_COMBINATORS));
            } else {
                findElements();
            }
            tq.consumeWhitespace();
        }
        return collectXPathEvaluator();
    }
 
Example 5
Source Project: astor   File: Tokeniser.java    License: GNU General Public License v2.0 5 votes vote down vote up
void emit(Token token) {
    Validate.isFalse(isEmitPending, "There is an unread token pending!");

    emitPending = token;
    isEmitPending = true;

    if (token.type == Token.TokenType.StartTag) {
        Token.StartTag startTag = (Token.StartTag) token;
        lastStartTag = startTag.tagName;
    } else if (token.type == Token.TokenType.EndTag) {
        Token.EndTag endTag = (Token.EndTag) token;
        if (endTag.attributes != null)
            error("Attributes incorrectly present on end tag");
    }
}
 
Example 6
Source Project: astor   File: Attributes.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void remove(int index) {
    Validate.isFalse(index >= size);
    int shifted = size - index - 1;
    if (shifted > 0) {
        System.arraycopy(keys, index + 1, keys, index, shifted);
        System.arraycopy(vals, index + 1, vals, index, shifted);
    }
    size--;
    keys[size] = null; // release hold
    vals[size] = null;
}
 
Example 7
Source Project: astor   File: Tokeniser.java    License: GNU General Public License v2.0 5 votes vote down vote up
void emit(Token token) {
    Validate.isFalse(isEmitPending, "There is an unread token pending!");

    emitPending = token;
    isEmitPending = true;

    if (token.type == Token.TokenType.StartTag) {
        Token.StartTag startTag = (Token.StartTag) token;
        lastStartTag = startTag.tagName;
    } else if (token.type == Token.TokenType.EndTag) {
        Token.EndTag endTag = (Token.EndTag) token;
        if (endTag.attributes != null)
            error("Attributes incorrectly present on end tag");
    }
}
 
Example 8
Source Project: astor   File: Attributes.java    License: GNU General Public License v2.0 5 votes vote down vote up
private void remove(int index) {
    Validate.isFalse(index >= size);
    int shifted = size - index - 1;
    if (shifted > 0) {
        System.arraycopy(keys, index + 1, keys, index, shifted);
        System.arraycopy(vals, index + 1, vals, index, shifted);
    }
    size--;
    keys[size] = null; // release hold
    vals[size] = null;
}
 
Example 9
Source Project: jsoup-learning   File: HtmlTreeBuilder.java    License: MIT License 5 votes vote down vote up
Element pop() {
    // todo - dev, remove validation check
    if (stack.peekLast().nodeName().equals("td") && !state.name().equals("InCell"))
        Validate.isFalse(true, "pop td not in cell");
    if (stack.peekLast().nodeName().equals("html"))
        Validate.isFalse(true, "popping html!");
    return stack.pollLast();
}
 
Example 10
Source Project: astor   File: Token.java    License: GNU General Public License v2.0 4 votes vote down vote up
final String name() {
    Validate.isFalse(tagName == null || tagName.length() == 0);
    return tagName;
}
 
Example 11
Source Project: astor   File: Token.java    License: GNU General Public License v2.0 4 votes vote down vote up
final String name() { // preserves case, for input into Tag.valueOf (which may drop case)
    Validate.isFalse(tagName == null || tagName.length() == 0);
    return tagName;
}
 
Example 12
Source Project: astor   File: Token.java    License: GNU General Public License v2.0 4 votes vote down vote up
final String name() { // preserves case, for input into Tag.valueOf (which may drop case)
    Validate.isFalse(tagName == null || tagName.length() == 0);
    return tagName;
}
 
Example 13
Source Project: jsoup-learning   File: Token.java    License: MIT License 4 votes vote down vote up
String name() {
    Validate.isFalse(tagName.length() == 0);
    return tagName;
}