public static List<String> splitXpath(String xpath) {

        return Arrays.stream(xpath.split("/")).filter(s -> !s.isEmpty()).collect(Collectors.toList());

    }
public static List < String > splitXpath ( String xpath ) { return Arrays . stream ( xpath . split ( "/" ) ) . filter ( s -> ! s . isEmpty ( ) ) . collect ( Collectors . toList ( ) ) ; }
Splits a content value path into its components, ignoring leading or trailing slashes.<p>

Note: this does not work for XPaths in general, only for the paths used to identify values in OpenCms contents.<p>

@param xpath the xpath

@return the path components