Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

public class Main {
    public static final String XPATH_SEPARATOR = "/";
    public static final String EXPRESSION_SEPARATOR = ".";
    public static final String EXPRESSION_LEFT = "[";
    public static final String EXPRESSION_RIGHT = "]";

    public static String convertToXpath(String expression) {
        if (expression == null) {
            return expression;
        }

        if (expression.startsWith(EXPRESSION_LEFT) && expression.endsWith(EXPRESSION_RIGHT)) {
            return expression.substring(1, expression.length() - 1);
        } else {
            return expression.replace(EXPRESSION_SEPARATOR, XPATH_SEPARATOR);
        }

    }
}