while (r.hasNext()) {
XMLEvent event = r.nextEvent();
if (event.isStartElement()) {
StartElement start = event.asStartElement();
String tag = start.getName().getLocalPart();
if (tag.equalsIgnoreCase("domain")) {
if (start.getAttributeByName(new QName("", "value")) != null) {
domain = start.getAttributeByName(
new QName("", "value")).getValue();
rule.setDomain(domain);
}
continue;
}
if (tag.equalsIgnoreCase("alias")) {
Alias alias = new Alias();
alias.setName(start.getAttributeByName(
new QName("", "name")).getValue());
alias.setKey(Integer.valueOf(start.getAttributeByName(
new QName("", "key")).getValue()));
rule.getAliasPool().put(alias.getName(), alias);
continue;
}
if (tag.equalsIgnoreCase("inner-key")){
InnerKey innerKey = new InnerKey();
innerKey.setKey(Integer.parseInt(start.getAttributeByName(
new QName("", "key")).getValue()));
boolean isExist = false;
for(InnerKey ik : rule.getInnerKeyPool())
{
if (ik.getKey() == innerKey.getKey())
{
logger.error("duplicate innerkey define, key :" + innerKey.getKey());
isExist = true;
break;
}
}
if (!isExist)
{
if (innerKey.setFile(start.getAttributeByName(
new QName("", "file")).getValue()))
rule.getInnerKeyPool().add(innerKey);
else
logger.error("inner-key set error, file : " + innerKey.getFile());
}
continue;
}
if (tag.equalsIgnoreCase("global-condition")) {
if (start.getAttributeByName(new QName("", "value")) != null) {
if (globalConditions.length() > 0) {
globalConditions.append("&"
+ start.getAttributeByName(
new QName("", "value"))
.getValue());
} else {
globalConditions.append(start
.getAttributeByName(
new QName("", "value"))
.getValue());
}
}
continue;
}
if (tag.equalsIgnoreCase("global-mapClass")) {
if (start.getAttributeByName(new QName("", "value")) != null) {
globalMapClass.add(start.getAttributeByName(
new QName("", "value")).getValue());
}
continue;
}
if (tag.equalsIgnoreCase("global-valuefilter")) {
if (start.getAttributeByName(new QName("", "value")) != null) {
globalValuefilter.append(
start.getAttributeByName(
new QName("", "value")).getValue())
.append("&");
}
continue;