1.1 --- a/java/alt2xml-out-xpath/src/cz/frantovo/alt2xml/out/xpath/XPathAction.java Sat Sep 06 18:29:44 2014 +0200
1.2 +++ b/java/alt2xml-out-xpath/src/cz/frantovo/alt2xml/out/xpath/XPathAction.java Sat Sep 06 18:37:24 2014 +0200
1.3 @@ -38,6 +38,9 @@
1.4 public class XPathAction extends AbstractDOMAction {
1.5
1.6 public static final String PARAMETER_TYPED_PARAMETERS = "typed-parameters";
1.7 + public static final String PARAMETER_LINE_BREAK = "line-break";
1.8 + private final boolean typedParameters;
1.9 + private final boolean lineBreak;
1.10 private final XPathFactory xpathFactory;
1.11 private final XPath xpath;
1.12 private final String expressionString;
1.13 @@ -54,7 +57,8 @@
1.14 throw new OutputActionException("Please specify the XPath expression as action data");
1.15 } else {
1.16
1.17 - boolean typedParameters = Boolean.parseBoolean(actionContext.getActionProperties().getProperty(PARAMETER_TYPED_PARAMETERS));
1.18 + typedParameters = Boolean.parseBoolean(actionContext.getActionProperties().getProperty(PARAMETER_TYPED_PARAMETERS));
1.19 + lineBreak = Boolean.parseBoolean(actionContext.getActionProperties().getProperty(PARAMETER_LINE_BREAK, Boolean.TRUE.toString()));
1.20
1.21 Map<String, Object> xpathParameters = new HashMap<>();
1.22
1.23 @@ -139,7 +143,10 @@
1.24 try {
1.25 String result = xpathExpression.evaluate(domResult.getNode());
1.26 try (PrintWriter out = new PrintWriter(getActionContext().getOutputStream())) {
1.27 - out.println(result);
1.28 + out.print(result);
1.29 + if (lineBreak) {
1.30 + out.println();
1.31 + }
1.32 }
1.33 } catch (XPathExpressionException e) {
1.34 throw new OutputActionException("Unable to evaluate XPath: " + xpathExpression, e);