XPath.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:XPathBuilder 作者:
public String getXPath() {
    String xpath = "";
    if (xpathListMap.entries() != null) {
        for (Map.Entry<LinkedListMultimap<XPathElement, LinkedList<ACTIONS>>, LinkedListMultimap<ATTRIBUTES, XPathValues>> mapEntry : xpathListMap.entries()) {
            for (Map.Entry<XPathElement, LinkedList<ACTIONS>> elementActionsMapEntry : mapEntry.getKey().entries()) {
                for (Map.Entry<PREFIX, ELEMENTS> elementEntry : elementActionsMapEntry.getKey().entries()) {
                    /** Adding into Xpath '// + element' or '/ + element' */
                    xpath = xpath + XPathBuilder.getElementXpath(elementEntry.getKey(), elementEntry.getValue());
                    /** Adding into Xpath '// + element' or '/ + element' */
                    LinkedList<ACTIONS> actions = elementActionsMapEntry.getValue();
                    for (ACTIONS action : actions) {
                        for (Map.Entry<ATTRIBUTES, XPathValues> attributesValuesMapEntry : mapEntry.getValue().entries()) {
                            ATTRIBUTES attributes = attributesValuesMapEntry.getKey();
                            XPathValues list = attributesValuesMapEntry.getValue();
                            /** Adding into Xpath based on action [contains|equals etc...] an [@attribute='value']  */
                            xpath = xpath + XPathBuilder.getXPath(action, attributes, list);
                            /** Adding into Xpath based on action [contains|equals etc...] an [@attribute='value']  */
                        }
                    }
                }
            }
        }
        return xpath;
    }
    return "//div[@id='ERROR IN XPath Generation']";
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号