Search in sources :

Example 16 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class NS3ToNSXML method parseVarArguments.

private void parseVarArguments(ParamTag p, XMLElement currentXML) {
    currentXML.setAttribute("PROCESSED", "true");
    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("MessageMode")) {
            p.setMode(content);
        }
        if (name.equals("MessageType")) {
            p.setType(content);
        }
        parseVarArguments(p, child);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 17 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class NS3ToNSXML method parseSelectionArrayElements.

private void parseSelectionArrayElements(ParamTag paramtag, MapTag selectionMap, XMLElement currentXML) throws Exception {
    Vector<XMLElement> children = currentXML.getChildren();
    for (XMLElement child : children) {
        String name = child.getName();
        if (name.equals("SelectionArrayElement")) {
            ParamTag pt = new ParamTag(myNavascript);
            pt.setType(Message.MSG_TYPE_ARRAY_ELEMENT);
            pt.setName(paramtag.getName());
            paramtag.addParam(pt);
            parseSelectionArrayElement(pt, child);
        }
    }
}
Also used : ParamTag(com.dexels.navajo.document.navascript.tags.ParamTag) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 18 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class NS3ToNSXML method consumeContent.

private void consumeContent(NavascriptFragment fragment, XMLElement xe) {
    String content = (xe.getContent() != null && !"".equals(xe.getContent()) ? xe.getContent() : null);
    xe.setAttribute("PROCESSED", "TRUE");
    if (content == null) {
    // do nothing
    } else if (content.equals("if")) {
    // do nothing
    } else if (content.equals("then")) {
        // end of condition
        fragment.finalize();
    } else if (content.equals("else")) {
    } else {
        fragment.consumeToken(content);
    }
    Vector<XMLElement> children = xe.getChildren();
    for (XMLElement x : children) {
        consumeContent(fragment, x);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 19 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class NS3ToNSXML method parseStringConstant.

private String parseStringConstant(XMLElement currentXML) {
    currentXML.setAttribute("PROCESSED", "true");
    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("LiteralOrExpression")) {
            return parseStringConstant(child);
        }
        if (name.equals("StringConstant")) {
            return content.replaceAll("\"", "");
        }
    }
    return "";
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 20 with XMLElement

use of com.dexels.navajo.document.nanoimpl.XMLElement in project navajo by Dexels.

the class NS3ToNSXML method parseLog.

private LogTag parseLog(NS3Compatible parent, XMLElement currentXML) throws Exception {
    currentXML.setAttribute("PROCESSED", "true");
    LogTag dt = new LogTag(myNavascript);
    dt.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);
            dt.setCondition(currentFragment.consumedFragment());
        }
        if (name.equals("Expression")) {
            ExpressionFragment ef = new ExpressionFragment();
            consumeContent(ef, child);
            dt.setValue(ef.consumedFragment());
        }
    }
    return dt;
}
Also used : LogTag(com.dexels.navajo.document.navascript.tags.LogTag) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Aggregations

XMLElement (com.dexels.navajo.document.nanoimpl.XMLElement)120 CaseSensitiveXMLElement (com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement)109 MapTag (com.dexels.navajo.document.navascript.tags.MapTag)12 IOException (java.io.IOException)12 NS3Compatible (com.dexels.navajo.document.navascript.tags.NS3Compatible)10 ArrayList (java.util.ArrayList)8 ParamTag (com.dexels.navajo.document.navascript.tags.ParamTag)7 InputStreamReader (java.io.InputStreamReader)7 HashMap (java.util.HashMap)7 APIException (com.dexels.navajo.article.APIException)6 ExpressionTag (com.dexels.navajo.document.navascript.tags.ExpressionTag)5 FieldTag (com.dexels.navajo.document.navascript.tags.FieldTag)5 FileInputStream (java.io.FileInputStream)5 FileReader (java.io.FileReader)5 Property (com.dexels.navajo.document.Property)4 IncludeTag (com.dexels.navajo.document.navascript.tags.IncludeTag)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 File (java.io.File)4 Message (com.dexels.navajo.document.Message)3 BlockTag (com.dexels.navajo.document.navascript.tags.BlockTag)3