Java Code Examples for org.dom4j.Element.getStringValue()

The following are Jave code examples for showing how to use getStringValue() of the org.dom4j.Element class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: ats-framework   File: SkipXmlNodeMatcher.java   View Source Code Vote up 5 votes
List<Element> getMatchingNodes( String snapshot, XmlNode xmlNode ) {

            // cycle all nodes that come for this XPath
            List<Element> matchedNodes = new ArrayList<>();

            List foundNodeObjects = xmlNode.getnode().selectNodes(this.xpath);
            if (foundNodeObjects != null) {
                for (Object foundNodeObject : foundNodeObjects) {
                    Element node = (Element) foundNodeObject;

                    String message = null;
                    String nodeValue = node.getStringValue();
                    if (matchType == MATCH_TYPE.TEXT && nodeValue.equalsIgnoreCase(value)) {
                        // equals text
                        message = "equals ignoring case '" + value + "'";
                    } else if (matchType == MATCH_TYPE.CONTAINS_TEXT
                               && nodeValue.toLowerCase().contains(this.value.toLowerCase())) {
                        // contains text
                        message = "contains ignoring case '" + value + "'";
                    } else if (nodeValue.matches(value)) {
                        // matches regex
                        message = "matches the '" + value + "' regular expression";
                    }

                    if (message != null) {
                        if (log.isDebugEnabled()) {
                            log.debug("[" + snapshot + "] File " + filePath + ": Removing XML node "
                                      + new XmlNode(xmlNode, node).getSignature("") + " as its value '"
                                      + nodeValue + "' " + message);
                        }
                        matchedNodes.add(node);
                    }
                }
            }

            return matchedNodes;
        }
 
Example 2
Project: urule   File: FlowNodeParser.java   View Source Code Vote up 5 votes
private Connection buildConnection(Element element){
	Connection conn=new Connection();
	conn.setName(element.attributeValue("name"));
	conn.setToName(element.attributeValue("to"));
	conn.setG(element.attributeValue("g"));
	String script=element.getStringValue();
	if(StringUtils.isNotEmpty(script)){
		conn.setScript(script);
	}
	return conn;
}
 
Example 3
Project: urule   File: ScriptNodeParser.java   View Source Code Vote up 5 votes
@Override
public ScriptNode parse(Element element) {
	ScriptNode node =new ScriptNode();
	node.setName(element.attributeValue("name"));
	node.setEventBean(element.attributeValue("event-bean"));
	node.setX(element.attributeValue("x"));
	node.setY(element.attributeValue("y"));
	node.setWidth(element.attributeValue("width"));
	node.setHeight(element.attributeValue("height"));
	node.setConnections(parseConnections(element));
	String script=element.getStringValue();
	node.setScript(script);
	return node;
}
 
Example 4
Project: urule   File: DecisionNodeParser.java   View Source Code Vote up 5 votes
private DecisionItem parseDecisionItem(Element element){
	DecisionItem item=new DecisionItem();
	item.setTo(element.attributeValue("connection"));
	String script=element.getStringValue();
	item.setScript(script);
	String percent=element.attributeValue("percent");
	if(StringUtils.isNotEmpty(percent)){
		item.setPercent(Integer.valueOf(percent));			
	}
	return item;
}
 
Example 5
Project: bulbasaur   File: Delay.java   View Source Code Vote up 5 votes
@Override
public StateLike parse(Element elem) {
    super.parse(elem);
    List<Element> intervalElement = elem.selectNodes(TIME_TAG);
    // 拿 孩子节点
    for (Element intervalNode : intervalElement) {
        this.time = intervalNode.getStringValue();
    }
    return this;
}