use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.
the class NS3ToNSXML method parseMethodOrSetter.
private FieldTag parseMethodOrSetter(MapTag parent, XMLElement currentXML) throws Exception {
FieldTag ft = new FieldTag(parent);
ft.setParent(parent);
ft.addParent(parent);
Vector<XMLElement> children = currentXML.getChildren();
for (XMLElement child : children) {
String name = child.getName();
if (name.equals("Conditional")) {
ConditionFragment currentFragment = new ConditionFragment();
consumeContent(currentFragment, child);
ft.setCondition(currentFragment.consumedFragment());
}
if (name.equals("AdapterMethod")) {
parseAdapterMethod(ft, child);
}
if (name.equals("SetterField")) {
parseAdapterField(ft, child);
}
}
return ft;
}
use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.
the class NS3ToNSXML method parseVarArrayElement.
private ParamTag parseVarArrayElement(ParamTag parent, XMLElement currentXML) throws Exception {
ParamTag paramElt = new ParamTag(myNavascript);
paramElt.setType(Message.MSG_TYPE_ARRAY_ELEMENT);
Vector<XMLElement> children = currentXML.getChildren();
for (XMLElement child : children) {
String name = child.getName();
if (name.equals("Var")) {
ParamTag pt = parseVar(paramElt, child);
paramElt.addParam(pt);
}
}
return paramElt;
}
use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.
the class NS3ToNSXML method parseConditionalExpressions.
/**
* parent is ParamTag or PropertyTag or FieldTag
*
* Conditional
* Expression
* Conditional
* TOKEN else
* Expression
*
* @param parent
* @param xe
*/
private List<ExpressionTag> parseConditionalExpressions(NS3Compatible parent, XMLElement currentXML) {
List<ExpressionTag> expressions = new ArrayList<>();
currentXML.setAttribute("PROCESSED", "true");
Vector<XMLElement> children = currentXML.getChildren();
ConditionFragment conditionFragment = null;
for (XMLElement child : children) {
String name = child.getName();
String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
if (name.equals("Conditional")) {
conditionFragment = new ConditionFragment();
consumeContent(conditionFragment, child);
}
if (name.equals("StringConstant")) {
String constant = content.replaceAll("\"", "");
ExpressionTag et = new ExpressionTag(myNavascript);
if (conditionFragment != null) {
et.setCondition(conditionFragment.consumedFragment());
}
et.setConstant(constant);
expressions.add(et);
conditionFragment = null;
}
if (name.equals("Expression")) {
ExpressionFragment ef = new ExpressionFragment();
consumeContent(ef, child);
ExpressionTag et = new ExpressionTag(myNavascript);
if (conditionFragment != null) {
et.setCondition(conditionFragment.consumedFragment());
}
et.setValue(ef.consumedFragment());
expressions.add(et);
conditionFragment = null;
}
if (name.equals("TOKEN") && content.trim().equals("else")) {
conditionFragment = null;
}
}
return expressions;
}
use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.
the class NS3ToNSXML method parseMappedMessage.
private MapTag parseMappedMessage(NS3Compatible parent, XMLElement currentXML) throws Exception {
MapTag mapTag = new MapTag(myNavascript);
mapTag.setOldStyleMap(true);
mapTag.setName("map");
mapTag.setRefAttribute("[/@]");
Vector<XMLElement> children = currentXML.getChildren();
for (XMLElement child : children) {
String name = child.getName();
String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
if (name.equals("InnerBody")) {
List<NS3Compatible> innerBodyElements = parseInnerBody(mapTag, child);
for (NS3Compatible ib : innerBodyElements) {
addChildTag(mapTag, ib);
}
}
}
return mapTag;
}
use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.
the class NS3ToNSXML method parseNavascript.
public InputStream parseNavascript(String fileContent) throws Exception {
navascript parser = new navascript(fileContent, this);
input = fileContent;
parser.parse_Navascript();
String result = xmlString.toString();
// System.err.println(result);
XMLElement xe = new CaseSensitiveXMLElement(true);
xe.parseString(result);
parseXML(myNavascript, xe, 0);
PipedInputStream in = new PipedInputStream();
PipedOutputStream out = new PipedOutputStream(in);
new Thread() {
public void run() {
myNavascript.write(out);
try {
out.close();
} catch (IOException e) {
logger.error(e.getLocalizedMessage(), e);
}
}
}.start();
return in;
}
Aggregations