/** * * @return line and column number */ private String getLineAndColumnText() { return " (line " + input.getLineNumber() + ", column " + input.getColumnNumber() + ")"; }
@Override public final CharSequence getInputFromPositionMarker(final int toPos) { return input.getSubstring(toPos); }
@Override public final void setPositionMarker() { input.setPositionMarker(input.getPosition()); }
if (input.getPosition() >= input.size()) final int openBracketIndex = input.find('<'); if (input.charAt(input.getPosition()) != '<') lastText = input.getSubstring(-1); input.setPosition(input.size()); lastType = BODY; return true; lastText = input.getSubstring(openBracketIndex); input.setPosition(openBracketIndex); lastType = BODY; return true; input.countLinesTo(openBracketIndex); int closeBracketIndex = input.find('>', openBracketIndex + 1); if (closeBracketIndex == -1) input.getPosition()); lastText = input.getSubstring(openBracketIndex, closeBracketIndex + 1); input.getPosition()); lastTag.length = lastText.length(); lastTag.text = lastText;
final int startIndex = input.getPosition(); final int tagNameLen = skipUntilText.length(); int pos = input.getPosition() - 1; String endTagText = null; int lastPos = 0; while (!skipUntilText.equalsIgnoreCase(endTagText)) pos = input.find("</", pos + 1); if ((pos == -1) || ((pos + (tagNameLen + 2)) >= input.size())) input.getLineNumber() + ", column " + input.getColumnNumber() + ")", startIndex); endTagText = input.getSubstring(lastPos, lastPos + tagNameLen).toString(); input.setPosition(pos); lastText = input.getSubstring(startIndex, pos); lastType = BODY; lastPos = input.find('>', lastPos + tagNameLen); if (lastPos == -1) throw new ParseException("Script tag not closed (line " + input.getLineNumber() + ", column " + input.getColumnNumber() + ")", startIndex);
final int startIndex = input.getPosition(); final int tagNameLen = skipUntilText.length(); int pos = input.getPosition() - 1; String endTagText = null; int lastPos = 0; while (!skipUntilText.equalsIgnoreCase(endTagText)) pos = input.find("</", pos + 1); if ((pos == -1) || ((pos + (tagNameLen + 2)) >= input.size())) endTagText = input.getSubstring(lastPos, lastPos + tagNameLen).toString(); input.setPosition(pos); lastText = input.getSubstring(startIndex, pos); lastType = HttpTagType.BODY; lastPos = input.find('>', lastPos + tagNameLen); if (lastPos == -1)
throws ParseException int closeBracketIndex = find(ch, startPos + 1); CharSequence tagCode = getSubstring(startPos, closeBracketIndex + 1); countLinesTo(startPos + i); return findOutOfQuotes(ch, closeBracketIndex + 1, quotationChar); getLineNumber() + ", column " + getColumnNumber() + ")", startPos);
/** * Parse the given string. * <p> * Note: xml character encoding is NOT applied. It is assumed the input provided does have the * correct encoding already. * * @param string * The input string * @throws IOException * Error while reading the resource */ @Override public void parse(final CharSequence string) throws IOException { Args.notNull(string, "string"); this.input = new FullyBufferedReader(new StringReader(string.toString())); this.encoding = null; }
@Override public final void setPositionMarker(final int pos) { input.setPositionMarker(pos); }
if (input.getPosition() >= input.size()) final int openBracketIndex = input.find('<'); if (input.charAt(input.getPosition()) != '<') lastText = input.getSubstring(-1); input.setPosition(input.size()); lastType = BODY; return true; lastText = input.getSubstring(openBracketIndex); input.setPosition(openBracketIndex); lastType = BODY; return true; input.countLinesTo(openBracketIndex); int closeBracketIndex = input.find('>', openBracketIndex + 1); if (closeBracketIndex == -1) input.getPosition()); lastText = input.getSubstring(openBracketIndex, closeBracketIndex + 1); .getPosition()); lastTag.length = lastText.length(); lastTag.text = lastText;
final int startIndex = input.getPosition(); final int tagNameLen = skipUntilText.length(); int pos = input.getPosition() - 1; String endTagText = null; int lastPos = 0; while (!skipUntilText.equalsIgnoreCase(endTagText)) pos = input.find("</", pos + 1); if ((pos == -1) || ((pos + (tagNameLen + 2)) >= input.size())) input.getLineNumber() + ", column " + input.getColumnNumber() + ")", startIndex); endTagText = input.getSubstring(lastPos, lastPos + tagNameLen).toString(); input.setPosition(pos); lastText = input.getSubstring(startIndex, pos); lastType = BODY; lastPos = input.find('>', lastPos + tagNameLen); if (lastPos == -1) throw new ParseException("Script tag not closed (line " + input.getLineNumber() + ", column " + input.getColumnNumber() + ")", startIndex);
final int startIndex = input.getPosition(); final int tagNameLen = skipUntilText.length(); int pos = input.getPosition() - 1; String endTagText = null; int lastPos = 0; while (!skipUntilText.equalsIgnoreCase(endTagText)) pos = input.find("</", pos + 1); if ((pos == -1) || ((pos + (tagNameLen + 2)) >= input.size())) endTagText = input.getSubstring(lastPos, lastPos + tagNameLen).toString(); input.setPosition(pos); lastText = input.getSubstring(startIndex, pos); lastType = HttpTagType.BODY; lastPos = input.find('>', lastPos + tagNameLen); if (lastPos == -1)
/** * * @see org.apache.wicket.markup.parser.IXmlPullParser#setPositionMarker() */ public final void setPositionMarker() { input.setPositionMarker(input.getPosition()); }
/** * Parse the given string. * <p> * Note: xml character encoding is NOT applied. It is assumed the input provided does have the * correct encoding already. * * @param string * The input string * @throws IOException * Error while reading the resource */ @Override public void parse(final CharSequence string) throws IOException { Args.notNull(string, "string"); this.input = new FullyBufferedReader(new StringReader(string.toString())); this.encoding = null; }
/** * * @see org.apache.wicket.markup.parser.IXmlPullParser#setPositionMarker(int) */ public final void setPositionMarker(final int pos) { input.setPositionMarker(pos); }
if (input.getPosition() >= input.size()) final int openBracketIndex = input.find('<'); if (input.charAt(input.getPosition()) != '<') lastText = input.getSubstring(-1); input.setPosition(input.size()); lastType = HttpTagType.BODY; return lastType; lastText = input.getSubstring(openBracketIndex); input.setPosition(openBracketIndex); lastType = HttpTagType.BODY; return lastType; input.countLinesTo(openBracketIndex); if (openBracketIndex != -1 && openBracketIndex < input.size() - 1) char nextChar = input.charAt(openBracketIndex + 1); closeBracketIndex = input.find('>', openBracketIndex); else closeBracketIndex = input.findOutOfQuotes('>', openBracketIndex); input.getPosition()); lastText = input.getSubstring(openBracketIndex, closeBracketIndex + 1);
int pos = input.find("-->", openBracketIndex + 1); if (pos == -1) input.getLineNumber() + " column:" + input.getColumnNumber(), openBracketIndex); lastText = input.getSubstring(openBracketIndex, pos); lastType = COMMENT; input.setPosition(closeBracketIndex + 1); input.setPosition(pos); input.setPosition(closeBracketIndex + 1); return; input.getLineNumber() + " column:" + input.getColumnNumber(), input .getPosition()); tagText = input.getSubstring(openBracketIndex + 1, closeBracketIndex) .toString(); input.setPosition(closeBracketIndex + 1); input.setPosition(closeBracketIndex + 1); return; input.setPosition(closeBracketIndex + 1);