GetXmlAttribute(){super("getxmlattribute");}
@Override
public void execute(DTState state) throws RulesException {
String attribute = state.datapop().stringValue();
XMLNode xmlNode = state.datapop().xmlTagValue();
if(xmlNode == null) {
state.datapush(RNull.getRNull());
state.traceInfo("GetXmlAttribute","tag",xmlNode.getTag(),"attribute",attribute,"value","null",null);
return;
}
String value = (String) xmlNode.getAttribs().get(attribute);
if(value != null ){
state.datapush(RString.newRString(value));
state.traceInfo("GetXmlAttribute","tag",xmlNode.getTag(),"attribute",attribute,"value",value,null);
}else{
state.datapush(RNull.getRNull());
state.traceInfo("GetXmlAttribute","tag",xmlNode.getTag(),"attribute",attribute,"null","true",null);
}
}