Search in sources :

Example 71 with XMLElement

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

the class TslMetaDataHandler method addIncludes.

/**
 * @param xn
 * @param element
 */
private void addIncludes(XMLElement xn, String element) {
    TreeSet<String> s = includesScriptMap.get(element);
    if (s == null) {
        return;
    }
    for (Iterator<String> iter = s.iterator(); iter.hasNext(); ) {
        String include = iter.next();
        XMLElement xnincl = new CaseSensitiveXMLElement();
        xnincl.setName("include");
        xnincl.setAttribute("name", include);
        xn.addChild(xnincl);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 72 with XMLElement

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

the class TslMetaDataHandler method parse.

public void parse(File f) {
    flushAll();
    FileReader fr = null;
    XMLElement xe = new CaseSensitiveXMLElement();
    try {
        fr = new FileReader(f);
        xe.parseFromReader(fr);
    } catch (IOException e) {
        logger.error("Error: ", e);
    } finally {
        if (fr != null) {
            try {
                fr.close();
            } catch (IOException e) {
            }
        }
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) FileReader(java.io.FileReader) IOException(java.io.IOException) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 73 with XMLElement

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

the class NS3ToNSXML method parseMappedArrayField.

private MapTag parseMappedArrayField(NS3Compatible parent, XMLElement currentXML) throws Exception {
    currentXML.setAttribute("PROCESSED", "true");
    MapTag ft = new MapTag(myNavascript);
    ft.addParent(parent);
    if (parent != null && parent instanceof MapTag) {
        ft.setParent((MapTag) parent);
    }
    ft.setOldStyleMap(true);
    Vector<XMLElement> children = currentXML.getChildren();
    boolean hasFilter = false;
    for (XMLElement child : children) {
        String name = child.getName();
        String content = (child.getContent() != null && !"".equals(child.getContent()) ? child.getContent() : null);
        if (name.equals("MappableIdentifier")) {
            String fieldRef = parseMappableIdentifier(child);
            ft.setRefAttribute(fieldRef);
        }
        if (name.equals("FieldName")) {
            ft.setRefAttribute(content);
        }
        if (name.equals("TOKEN") && content.equals("filter")) {
            hasFilter = true;
        }
        if (hasFilter && name.equals("Expression")) {
            ExpressionFragment ef = new ExpressionFragment();
            consumeContent(ef, child);
            ft.setFilter(ef.consumedFragment());
        }
        if (name.equals("InnerBody") || name.equals("InnerBodySelection")) {
            List<NS3Compatible> innerBodyElements = parseInnerBody(ft, child);
            for (NS3Compatible ib : innerBodyElements) {
                addChildTag(ft, ib);
            }
        }
    }
    return ft;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement) MapTag(com.dexels.navajo.document.navascript.tags.MapTag) NS3Compatible(com.dexels.navajo.document.navascript.tags.NS3Compatible)

Example 74 with XMLElement

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

the class NS3ToNSXML method parseBreak.

private BreakTag parseBreak(NS3Compatible parent, XMLElement currentXML) throws Exception {
    currentXML.setAttribute("PROCESSED", "true");
    BreakTag bt = new BreakTag(myNavascript);
    bt.addParent(parent);
    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("Conditional")) {
            ConditionFragment currentFragment = new ConditionFragment();
            consumeContent(currentFragment, child);
            bt.setCondition(currentFragment.consumedFragment());
        }
        if (name.equals("BreakParameters")) {
            parseBreakParameters(bt, child);
        }
    }
    return bt;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement) BreakTag(com.dexels.navajo.document.navascript.tags.BreakTag)

Example 75 with XMLElement

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

the class NS3ToNSXML method parseMappableIdentifier.

/**
 * Parse
 * <Identifier><Arguments>
 *
 * @param currentXML
 * @return
 */
private String parseMappableIdentifier(XMLElement currentXML) {
    StringBuffer result = new StringBuffer();
    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("Identifier")) {
            result.append("$" + content);
        }
        if (name.equals("Arguments")) {
            ExpressionFragment ef = new ExpressionFragment();
            consumeContent(ef, child);
            result.append(ef.consumedFragment());
        }
    }
    return result.toString();
}
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