Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * 
     * Get a valid xPath string to enable retrieval of an Element by attribute
     * name and its value. note that the full tag path must also be stated
     * 
     * @param tagPath
     *            example: /calls/step
     * @param attrName
     *            example: ReportStepAttributes.STEP_NAME
     * @param attrValue
     *            example: Call failed
     * 
     * @return A valid xPath string
     */
    public static String getXpathBasic(String tagPath, String attrName, String attrValue) {
        StringBuffer buf = new StringBuffer();

        buf.append(tagPath);
        buf.append("[");
        buf.append("@");
        buf.append(attrName.toString());
        buf.append("=");
        buf.append("'");
        buf.append(attrValue);
        buf.append("'");
        buf.append("]");

        // System.out.println("Xpath generated: " + (retStr = buf.toString()));
        return buf.toString();

    }
}