/** * Parse Attributes for a reader, provided for external use */ public static Attributes parseAttributes(ParserController pc, JspReader reader) throws JasperException { Parser tmpParser = new Parser(pc, reader, false, false, null); return tmpParser.parseAttributes(true); }
parseElementsScriptless(parent); return; parseComment(parent); } else if (reader.matches("<%@")) { parseDirective(parent); } else if (reader.matches("<jsp:directive.")) { parseXMLDirective(parent); } else if (reader.matches("<%!")) { parseDeclaration(parent); } else if (reader.matches("<jsp:declaration")) { parseXMLDeclaration(parent); } else if (reader.matches("<%=")) { parseExpression(parent); } else if (reader.matches("<jsp:expression")) { parseXMLExpression(parent); } else if (reader.matches("<%")) { parseScriptlet(parent); } else if (reader.matches("<jsp:scriptlet")) { parseXMLScriptlet(parent); } else if (reader.matches("<jsp:text")) { parseXMLTemplateText(parent); } else if (!pageInfo.isELIgnored() && reader.matches("${")) { parseELExpression(parent, '$'); } else if (!pageInfo.isELIgnored() && reader.matches("#{")) { parseELExpression(parent, '#'); } else if (reader.matches("<jsp:")) { parseStandardAction(parent); } else if (!parseCustomTag(parent)) {
/** * Attributes ::= (S Attribute)* S? */ Attributes parseAttributes() throws JasperException { AttributesImpl attrs = new AttributesImpl(); reader.skipSpaces(); while (parseAttribute(attrs)) reader.skipSpaces(); return attrs; }
private void parseGetProperty(Node parent) throws JasperException { Attributes attrs = parseAttributes(); reader.skipSpaces(); Node getPropertyNode = new Node.GetProperty(attrs, start, parent); parseOptionalBody(getPropertyNode, "jsp:getProperty", TagInfo.BODY_CONTENT_EMPTY); }
parseComment(parent); } else if (reader.matches("<%@")) { parseDirective(parent); } else if (reader.matches("<jsp:directive.")) { parseXMLDirective(parent); } else if (reader.matches("<%!")) { err.jspError( reader.mark(), "jsp.error.no.scriptlets" ); err.jspError( reader.mark(), "jsp.error.no.scriptlets" ); } else if (reader.matches("<jsp:text")) { parseXMLTemplateText(parent); } else if (reader.matches("${")) { parseELExpression(parent, "${"); } else if (reader.matches("#{")) { parseELExpression(parent, "#{"); } else if (reader.matches("<jsp:")) { parseStandardAction(parent); } else if (!parseCustomTag(parent)) { checkUnbalancedEndTag(); parseTemplateText(parent);
directive); parsePageDirective(parent); } else if (reader.matches("include")) { directive = "<%@ include"; parseIncludeDirective(parent); } else if (reader.matches("taglib")) { if (directivesOnly) { parseTaglibDirective(parent); } else if (reader.matches("tag")) { directive = "<%@ tag"; directive); parseTagDirective(parent); } else if (reader.matches("attribute")) { directive = "<%@ attribute"; directive); parseAttributeDirective(parent); } else if (reader.matches("variable")) { directive = "<%@ variable"; parseVariableDirective(parent); } else { err.jspError(reader.mark(), "jsp.error.invalid.directive");
private void parseNamedAttributes(Node parent) throws JasperException { do { Mark start = reader.mark(); Attributes attrs = parseAttributes(); Node.NamedAttribute namedAttributeNode = new Node.NamedAttribute( attrs, start, parent); reader.skipSpaces(); if (!reader.matches("/>")) { if (!reader.matches(">")) { err.jspError(start, "jsp.error.unterminated", "<jsp:attribute"); } if (namedAttributeNode.isTrim()) { reader.skipSpaces(); } parseBody(namedAttributeNode, "jsp:attribute", getAttributeBodyType(parent, attrs.getValue("name"))); if (namedAttributeNode.isTrim()) { Node.Nodes subElems = namedAttributeNode.getBody(); if (subElems != null) { Node lastNode = subElems.getNode(subElems.size() - 1); if (lastNode instanceof Node.TemplateText) { ((Node.TemplateText) lastNode).rtrim(); } } } } reader.skipSpaces(); } while (reader.matches("<jsp:attribute")); }
throws JasperException { Parser parser = new Parser(pc, reader, isTagFile, directivesOnly, jar); parser.addInclude(root, pageInfo.getIncludePrelude()); parser.parseFileDirectives(root); } else { while (reader.hasMoreInput()) { parser.parseElements(root); parser.addInclude(root, pageInfo.getIncludeCoda());
private void parseElementsTemplateText(Node parent) throws JasperException { start = reader.mark(); if (reader.matches("<%--")) { parseComment(parent); } else if (reader.matches("<%@")) { parseDirective(parent); } else if (reader.matches("<jsp:directive.")) { parseXMLDirective(parent); } else if (reader.matches("<%!")) { err.jspError(reader.mark(), MESSAGES.invalidTemplateTextBody("<%!")); } else if (reader.matches("<jsp:")) { err.jspError(reader.mark(), MESSAGES.invalidTemplateTextBody("<jsp:")); } else if (parseCustomTag(parent)) { err.jspError(reader.mark(), MESSAGES.invalidTagInTemplateTextBody()); } else { checkUnbalancedEndTag(); parseTemplateText(parent);
throws JasperException { Parser parser = new Parser(pc, reader, isTagFile, directivesOnly, jarFileUrl, hasBom); parser.parseTagFileDirectives(root); return new Node.Nodes(root); parser.addInclude(root, pageInfo.getIncludePrelude()); parser.parseElements(root); parser.addInclude(root, pageInfo.getIncludeCoda()); parser.pageInfo.setRootPath(path);
String qName = parseName(); if (qName == null) return false; watchString = watchString + quote; String attrValue = parseAttributeValue(watchString); attrs.addAttribute(uri, localName, qName, "CDATA", attrValue); return true;
private void parseJspBody(Node parent, String bodyType) throws JasperException { Mark start = reader.mark(); Node bodyNode = new Node.JspBody(start, parent); reader.skipSpaces(); if (!reader.matches("/>")) { if (!reader.matches(">")) { err.jspError(start, "jsp.error.unterminated", "<jsp:body"); } parseBody(bodyNode, "jsp:body", bodyType); } }
/** * Attributes ::= (S Attribute)* S? */ Attributes parseAttributes() throws JasperException { return parseAttributes(false); } Attributes parseAttributes(boolean pageDirective) throws JasperException {
parseComment(parent); } else if (reader.matches("<%@")) { parseDirective(parent); } else if (reader.matches("<jsp:directive.")) { parseXMLDirective(parent); } else if (reader.matches("<%!")) { err.jspError( reader.mark(), "jsp.error.no.scriptlets" ); err.jspError( reader.mark(), "jsp.error.no.scriptlets" ); } else if (reader.matches("<jsp:text")) { parseXMLTemplateText(parent); } else if (reader.matches("${")) { parseELExpression(parent, "${"); } else if (reader.matches("#{")) { parseELExpression(parent, "#{"); } else if (reader.matches("<jsp:")) { parseStandardAction(parent); } else if (!parseCustomTag(parent)) { checkUnbalancedEndTag(); parseTemplateText(parent);
err.jspError(reader.mark(), MESSAGES.invalidDirectiveInTagFile(directive)); parsePageDirective(parent); } else if (reader.matches("include")) { directive = "<%@ include"; parseIncludeDirective(parent); } else if (reader.matches("taglib")) { if (directivesOnly) { parseTaglibDirective(parent); } else if (reader.matches("tag")) { directive = "<%@ tag"; err.jspError(reader.mark(), MESSAGES.invalidDirectiveInPage(directive)); parseTagDirective(parent); } else if (reader.matches("attribute")) { directive = "<%@ attribute"; err.jspError(reader.mark(), MESSAGES.invalidDirectiveInPage(directive)); parseAttributeDirective(parent); } else if (reader.matches("variable")) { directive = "<%@ variable"; parseVariableDirective(parent); } else { err.jspError(reader.mark(), MESSAGES.invalidDirective());
private void parseNamedAttributes(Node parent) throws JasperException { do { Mark start = reader.mark(); Attributes attrs = parseAttributes(); Node.NamedAttribute namedAttributeNode = new Node.NamedAttribute( attrs, start, parent); reader.skipSpaces(); if (!reader.matches("/>")) { if (!reader.matches(">")) { err.jspError(start, "jsp.error.unterminated", "<jsp:attribute"); } if (namedAttributeNode.isTrim()) { reader.skipSpaces(); } parseBody(namedAttributeNode, "jsp:attribute", getAttributeBodyType(parent, attrs.getValue("name"))); if (namedAttributeNode.isTrim()) { Node.Nodes subElems = namedAttributeNode.getBody(); if (subElems != null) { Node lastNode = subElems.getNode(subElems.size() - 1); if (lastNode instanceof Node.TemplateText) { ((Node.TemplateText) lastNode).rtrim(); } } } } reader.skipSpaces(); } while (reader.matches("<jsp:attribute")); }
boolean isDefaultPageEncoding, boolean isBomPresent) throws JasperException { Parser parser = new Parser(pc, reader, isTagFile, directivesOnly, jarFileUrl); parser.addInclude(root, pageInfo.getIncludePrelude()); parser.parseFileDirectives(root); } else { while (reader.hasMoreInput()) { parser.parseElements(root); parser.addInclude(root, pageInfo.getIncludeCoda());
private void parseElementsTemplateText(Node parent) throws JasperException { start = reader.mark(); if (reader.matches("<%--")) { parseComment(parent); } else if (reader.matches("<%@")) { parseDirective(parent); } else if (reader.matches("<jsp:directive.")) { parseXMLDirective(parent); } else if (reader.matches("<%!")) { err.jspError(reader.mark(), MESSAGES.invalidTemplateTextBody("<%!")); } else if (reader.matches("<jsp:")) { err.jspError(reader.mark(), MESSAGES.invalidTemplateTextBody("<jsp:")); } else if (parseCustomTag(parent)) { err.jspError(reader.mark(), MESSAGES.invalidTagInTemplateTextBody()); } else { checkUnbalancedEndTag(); parseTemplateText(parent);
throws JasperException { Parser parser = new Parser(pc, reader, isTagFile, directivesOnly, jarFileUrl, hasBom); parser.parseTagFileDirectives(root); return new Node.Nodes(root); parser.addInclude(root, pageInfo.getIncludePrelude()); parser.parseElements(root); parser.addInclude(root, pageInfo.getIncludeCoda()); parser.pageInfo.setRootPath(path);
String qName = parseName(); if (qName == null) return false; watchString = watchString + quote; String attrValue = parseAttributeValue(watchString); attrs.addAttribute(uri, localName, qName, "CDATA", attrValue); return true;