use of com.dexels.navajo.document.navascript.tags.NS3Compatible in project navajo by Dexels.
the class NS3ToNSXML method parseMessage.
private MessageTag parseMessage(NS3Compatible parent, XMLElement currentXML) throws Exception {
currentXML.setAttribute("PROCESSED", "true");
Vector<XMLElement> children = currentXML.getChildren();
MessageTag msgTag = new MessageTag(myNavascript);
msgTag.addParent(parent);
for (XMLElement child : children) {
String name = child.getName();
String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
if (name.equals("TOKEN") && content.equals("[")) {
msgTag.setType(Message.MSG_TYPE_ARRAY);
}
if (name.equals("Conditional")) {
ConditionFragment currentFragment = new ConditionFragment();
consumeContent(currentFragment, child);
msgTag.setCondition(currentFragment.consumedFragment());
}
if (name.equals("MappedArrayMessage")) {
// <map ref="[]"
MapTag mt = parsedMappedArrayMessage(null, child);
msgTag.addMap(mt);
}
if (name.equals("MappedArrayField")) {
// <map ref="$"
MapTag maf = parseMappedArrayField(findClosestMapTag(parent, ""), child);
msgTag.addMap(maf);
}
if (name.equals("MsgIdentifier")) {
msgTag.setName(content);
}
if (name.equals("MessageArguments")) {
parseMessageArguments(msgTag, child);
}
if (name.equals("InnerBody")) {
List<NS3Compatible> innerBodyElements = parseInnerBody(msgTag, child);
for (NS3Compatible ib : innerBodyElements) {
addChildTag(msgTag, ib);
}
}
if (name.equals("MessageArray")) {
msgTag.setType(Message.MSG_TYPE_ARRAY);
Vector<XMLElement> messageChildren = child.getChildren();
int count = 0;
for (XMLElement messageChild : messageChildren) {
if (messageChild.getName().equals("MessageArrayElement")) {
MessageTag messageElt = parseMessage(parent, messageChild);
messageElt.setType(Message.MSG_TYPE_ARRAY_ELEMENT);
messageElt.setName(msgTag.getName());
messageElt.setIndex(count);
msgTag.addMessage(messageElt);
count++;
}
}
}
}
return msgTag;
}
Aggregations