AttributeCollection atts = getAttributeList(); if (f.equals("regex")) { regexAtt = atts.getValue(a); regex = makeAttributeValueTemplate(regexAtt, a); select = makeExpression(selectAtt, a); } else if (f.equals("flags")) { flags = makeAttributeValueTemplate(flagsAtt, a); } else { checkUnknownAttribute(atts.getNodeName(a)); reportAbsence("select"); select = makeExpression(".", -1); // for error recovery reportAbsence("regex"); regex = makeAttributeValueTemplate("xxx", -1); // for error recovery flags = makeAttributeValueTemplate("", -1); pattern = getConfiguration().compileRegularExpression( regex, flagstr, getEffectiveVersion() >= 30 ? "XP30" : "XP20", warnings); for (String w : warnings) { issueWarning(w, this); invalidFlags("Error in regular expression flags: " + err.getMessage()); } else { invalidRegex("Error in regular expression: " + err.getMessage());
public void validate(ComponentDeclaration decl) throws XPathException { AxisIterator kids = iterateAxis(AxisInfo.CHILD); boolean foundFallback = false; while (true) { if (b) { if (matching != null || nonMatching != null || foundFallback) { compileError("xsl:matching-substring element must come first", "XTSE0010"); compileError("xsl:non-matching-substring cannot appear here", "XTSE0010"); compileError("Only xsl:matching-substring and xsl:non-matching-substring are allowed here", "XTSE0010"); compileError("At least one xsl:matching-substring or xsl:non-matching-substring element must be present", "XTSE1130"); select = typeCheck("select", select); regex = typeCheck("regex", regex); flags = typeCheck("flags", flags);
private void invalidRegex(String message) throws XPathException { compileErrorInAttribute(message, "XTDE1140", "regex"); // prevent it being reported more than once pattern = getConfiguration().compileRegularExpression("x", "", "XP20", null); }
AttributeCollection atts = getAttributeList(); String f = getNamePool().getClarkName(nc); if (f.equals(StandardNames.REGEX)) { regexAtt = atts.getValue(a); checkUnknownAttribute(nc); reportAbsence("select"); selectAtt = "."; // for error recovery select = makeExpression(selectAtt); reportAbsence("regex"); regexAtt = "xxx"; // for error recovery regex = makeAttributeValueTemplate(regexAtt); flags = makeAttributeValueTemplate(flagsAtt); final CharSequence regex = ((StringLiteral)this.regex).getStringValue(); final CharSequence flagstr = ((StringLiteral)flags).getStringValue(); final int xmlVersion = getConfiguration().getXMLVersion(); pattern = platform.compileRegularExpression( regex, xmlVersion, RegularExpression.XPATH_SYNTAX, flagstr); invalidRegex("The regular expression must not be one that matches a zero-length string", "XTDE1150"); invalidRegex("Error in regular expression flags: " + err, "XTDE1145");
public void validate() throws XPathException { AxisIterator kids = iterateAxis(Axis.CHILD); while(true) { NodeInfo curr = (NodeInfo)kids.next(); if (b) { if (matching!=null) { compileError("xsl:matching-substring element must only appear once", "XTSE0010"); compileError("xsl:non-matching-substring element must only appear once", "XTSE0010"); compileError("Only xsl:matching-substring and xsl:non-matching-substring are allowed here", "XTSE0010"); compileError("At least one xsl:matching-substring or xsl:non-matching-substring element must be present", "XTSE1130"); select = typeCheck("select", select); regex = typeCheck("regex", regex); flags = typeCheck("flags", flags); ExpressionVisitor visitor = makeExpressionVisitor(); compileError(err);
switch (f) { case StandardNames.XSL_ANALYZE_STRING: return new XSLAnalyzeString(); case StandardNames.XSL_APPLY_IMPORTS: return new XSLApplyImports();
public Expression compile(Executable exec) throws XPathException { Expression matchingBlock = null; if (matching != null) { matchingBlock = matching.compileSequenceConstructor(exec, matching.iterateAxis(Axis.CHILD), false); } Expression nonMatchingBlock = null; if (nonMatching != null) { nonMatchingBlock = nonMatching.compileSequenceConstructor(exec, nonMatching.iterateAxis(Axis.CHILD), false); } try { ExpressionVisitor visitor = makeExpressionVisitor(); return new AnalyzeString(select, regex, flags, (matchingBlock==null ? null : matchingBlock.simplify(visitor)), (nonMatchingBlock==null ? null : nonMatchingBlock.simplify(visitor)), pattern ); } catch (XPathException e) { compileError(e); return null; } }
private void invalidRegex(String message, String errorCode) throws XPathException { compileError(message, errorCode); pattern = null; }
AttributeCollection atts = getAttributeList(); String f = getNamePool().getClarkName(nc); if (f.equals(StandardNames.REGEX)) { regexAtt = atts.getValue(a); checkUnknownAttribute(nc); reportAbsence("select"); selectAtt = "."; // for error recovery select = makeExpression(selectAtt); reportAbsence("regex"); regexAtt = "xxx"; // for error recovery regex = makeAttributeValueTemplate(regexAtt); flags = makeAttributeValueTemplate(flagsAtt); final CharSequence regex = ((StringLiteral)this.regex).getStringValue(); final CharSequence flagstr = ((StringLiteral)flags).getStringValue(); final int xmlVersion = getConfiguration().getXMLVersion(); pattern = platform.compileRegularExpression( regex, xmlVersion, RegularExpression.XPATH_SYNTAX, flagstr); invalidRegex("The regular expression must not be one that matches a zero-length string", "XTDE1150"); invalidRegex("Error in regular expression flags: " + err, "XTDE1145");
public void validate() throws XPathException { AxisIterator kids = iterateAxis(Axis.CHILD); while(true) { NodeInfo curr = (NodeInfo)kids.next(); if (b) { if (matching!=null) { compileError("xsl:matching-substring element must only appear once", "XTSE0010"); compileError("xsl:non-matching-substring element must only appear once", "XTSE0010"); compileError("Only xsl:matching-substring and xsl:non-matching-substring are allowed here", "XTSE0010"); compileError("At least one xsl:matching-substring or xsl:non-matching-substring element must be present", "XTSE1130"); select = typeCheck("select", select); regex = typeCheck("regex", regex); flags = typeCheck("flags", flags); ExpressionVisitor visitor = makeExpressionVisitor(); flags = TypeChecker.staticTypeCheck(flags, SequenceType.SINGLE_STRING, false, role, visitor); } catch (XPathException err) { compileError(err);
private void invalidFlags(String message) throws XPathException { compileErrorInAttribute(message, "XTDE1145", "flags"); // prevent it being reported more than once pattern = getConfiguration().compileRegularExpression("x", "", "XP20", null); }
switch (f) { case StandardNames.XSL_ANALYZE_STRING: return new XSLAnalyzeString(); case StandardNames.XSL_APPLY_IMPORTS: return new XSLApplyImports();
public Expression compile(Executable exec) throws XPathException { Expression matchingBlock = null; if (matching != null) { matchingBlock = matching.compileSequenceConstructor(exec, matching.iterateAxis(Axis.CHILD), false); } Expression nonMatchingBlock = null; if (nonMatching != null) { nonMatchingBlock = nonMatching.compileSequenceConstructor(exec, nonMatching.iterateAxis(Axis.CHILD), false); } try { ExpressionVisitor visitor = makeExpressionVisitor(); return new AnalyzeString(select, regex, flags, (matchingBlock==null ? null : matchingBlock.simplify(visitor)), (nonMatchingBlock==null ? null : nonMatchingBlock.simplify(visitor)), pattern ); } catch (XPathException e) { compileError(e); return null; } }
private void invalidRegex(String message, String errorCode) throws XPathException { compileError(message, errorCode); pattern = null; }
AttributeCollection atts = getAttributeList(); if (f.equals("regex")) { regexAtt = atts.getValue(a); regex = makeAttributeValueTemplate(regexAtt, a); select = makeExpression(selectAtt, a); } else if (f.equals("flags")) { flags = makeAttributeValueTemplate(flagsAtt, a); } else { checkUnknownAttribute(atts.getNodeName(a)); reportAbsence("select"); select = makeExpression(".", -1); // for error recovery reportAbsence("regex"); regex = makeAttributeValueTemplate("xxx", -1); // for error recovery flags = makeAttributeValueTemplate("", -1); pattern = getConfiguration().compileRegularExpression( regex, flagstr, getEffectiveVersion() >= 30 ? "XP30" : "XP20", warnings); for (String w : warnings) { issueWarning(w, this); invalidFlags("Error in regular expression flags: " + err.getMessage()); } else { invalidRegex("Error in regular expression: " + err.getMessage());
public void validate(ComponentDeclaration decl) throws XPathException { AxisIterator kids = iterateAxis(AxisInfo.CHILD); boolean foundFallback = false; while (true) { if (b) { if (matching != null || nonMatching != null || foundFallback) { compileError("xsl:matching-substring element must come first", "XTSE0010"); compileError("xsl:non-matching-substring cannot appear here", "XTSE0010"); compileError("Only xsl:matching-substring and xsl:non-matching-substring are allowed here", "XTSE0010"); compileError("At least one xsl:matching-substring or xsl:non-matching-substring element must be present", "XTSE1130"); select = typeCheck("select", select); regex = typeCheck("regex", regex); flags = typeCheck("flags", flags);
private void invalidRegex(String message) throws XPathException { compileErrorInAttribute(message, "XTDE1140", "regex"); // prevent it being reported more than once pattern = getConfiguration().compileRegularExpression("x", "", "XP20", null); }
switch (f) { case StandardNames.XSL_ANALYZE_STRING: return new XSLAnalyzeString(); case StandardNames.XSL_APPLY_IMPORTS: return new XSLApplyImports();
public Expression compile(Compilation exec, ComponentDeclaration decl) throws XPathException { Expression matchingBlock = null; if (matching != null) { matchingBlock = matching.compileSequenceConstructor(exec, decl, false); } Expression nonMatchingBlock = null; if (nonMatching != null) { nonMatchingBlock = nonMatching.compileSequenceConstructor(exec, decl, false); } try { return new AnalyzeString(select, regex, flags, matchingBlock == null ? null : matchingBlock.simplify(), nonMatchingBlock == null ? null : nonMatchingBlock.simplify(), pattern); } catch (XPathException e) { compileError(e); return null; } }
private void invalidFlags(String message) throws XPathException { compileErrorInAttribute(message, "XTDE1145", "flags"); // prevent it being reported more than once pattern = getConfiguration().compileRegularExpression("x", "", "XP20", null); }