Search in sources :

Example 21 with XMLElement

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

the class NS3ToNSXML method parseDefine.

private DefineTag parseDefine(NS3Compatible parent, XMLElement xe) {
    DefineTag dt = new DefineTag(myNavascript);
    dt.addParent(parent);
    Vector<XMLElement> children = xe.getChildren();
    for (XMLElement child : children) {
        String name = child.getName();
        String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
        if (name.equals("Identifier")) {
            dt.setName(content);
        }
        if (name.equals("Expression")) {
            ExpressionFragment ef = new ExpressionFragment();
            consumeContent(ef, child);
            dt.setExpression(ef.consumedFragment());
        }
    }
    return dt;
}
Also used : DefineTag(com.dexels.navajo.document.navascript.tags.DefineTag) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 22 with XMLElement

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

the class NS3ToNSXML method parseSynchronizedBlock.

private SynchronizedTag parseSynchronizedBlock(NS3Compatible parent, XMLElement xe) throws Exception {
    SynchronizedTag st = new SynchronizedTag(myNavascript);
    st.addParent(parent);
    Vector<XMLElement> children = xe.getChildren();
    for (XMLElement child : children) {
        String name = child.getName();
        if (name.equals("SynchronizedArguments")) {
            parseSynchronizedArguments(null, st, child);
        }
        if (name.equals("TopLevelStatement")) {
            List<NS3Compatible> innerBodyElements = parseInnerBody(st, child);
            for (NS3Compatible ib : innerBodyElements) {
                addChildTag(st, ib);
            }
        }
    }
    return st;
}
Also used : SynchronizedTag(com.dexels.navajo.document.navascript.tags.SynchronizedTag) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement) NS3Compatible(com.dexels.navajo.document.navascript.tags.NS3Compatible)

Example 23 with XMLElement

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

the class NS3ToNSXML method parseValidations.

private ValidationsTag parseValidations(NS3Compatible parent, XMLElement xe) {
    ValidationsTag vt = new ValidationsTag(myNavascript);
    vt.addParent(parent);
    Vector<XMLElement> children = xe.getChildren();
    CheckTag ct = null;
    for (XMLElement child : children) {
        String name = child.getName();
        String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
        if (name.equals("Checks")) {
            return parseValidations(parent, child);
        }
        if (name.equals("Check")) {
            ct = new CheckTag(myNavascript);
            vt.addCheck(ct);
            parseCheckAttributes(ct, child);
        }
    }
    return vt;
}
Also used : CheckTag(com.dexels.navajo.document.navascript.tags.CheckTag) ValidationsTag(com.dexels.navajo.document.navascript.tags.ValidationsTag) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 24 with XMLElement

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

the class NS3ToNSXML method parseMessageArguments.

private void parseMessageArguments(MessageTag 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")) {
            // Add _ to prevent ignore messages from not being rendered.
            p.setMode(content + "_");
        }
        if (name.equals("MessageType")) {
            p.setType(content);
        }
        parseMessageArguments(p, child);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 25 with XMLElement

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

the class NS3ToNSXML method parseCheckAttributes.

private void parseCheckAttributes(CheckTag ct, XMLElement xe) {
    Vector<XMLElement> children = xe.getChildren();
    String param = null;
    for (XMLElement child : children) {
        String name = child.getName();
        String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
        if (name.endsWith("Conditional")) {
            ConditionFragment conditionFragment = new ConditionFragment();
            consumeContent(conditionFragment, child);
            ct.setCondition(conditionFragment.consumedFragment());
        }
        if (name.equals("CheckAttributes")) {
            parseCheckAttributes(ct, child);
        }
        if (name.equals("CheckAttribute")) {
            parseCheckAttributes(ct, child);
        }
        if (name.equals("TOKEN")) {
            param = content;
        }
        if (name.equals("LiteralOrExpression")) {
            String c = null;
            if (isLiteral(child)) {
                c = parseStringConstant(child);
            } else {
                c = parseExpression(child);
            }
            if (param.equals("code")) {
                ct.setCode(c);
            }
            if (param.equals("description")) {
                ct.setDescription(c);
            }
        }
        if (name.equals("Expression")) {
            ExpressionFragment ef = new ExpressionFragment();
            consumeContent(ef, child);
            ct.setRule(ef.consumedFragment());
        }
    }
}
Also used : 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