Search in sources :

Example 91 with XMLElement

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

the class ScriptInheritance method findMessagesWithLevel.

private void findMessagesWithLevel(int level, XMLElement tsl, Vector<XMLElement> leveledMessages) {
    Vector<XMLElement> children = tsl.getChildren();
    for (int i = 0; i < children.size(); i++) {
        XMLElement child = children.get(i);
        if (child.getName().equals("message") && child.getAttribute("level").equals(level + "")) {
            leveledMessages.add(child);
        }
        findMessagesWithLevel(level, child, leveledMessages);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 92 with XMLElement

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

the class ScriptInheritance method containsInject.

/**
 * Checks the stream for an inject. WARNING: closes the stream
 * @param fis
 * @return
 * @throws Exception
 */
public static boolean containsInject(InputStream fis) throws Exception {
    XMLElement e = new CaseSensitiveXMLElement();
    // FileInputStream fis = new FileInputStream(scriptPath);
    e.parseFromStream(fis);
    fis.close();
    return hasInject(e);
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 93 with XMLElement

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

the class ScriptInheritance method inherit.

public static InputStream inherit(InputStream raw, String scriptPath, List<String> inheritedScripts) throws Exception {
    ScriptInheritance ti = new ScriptInheritance();
    XMLElement before = new CaseSensitiveXMLElement();
    before.parseFromStream(raw);
    // Remember tsl attributes.
    HashMap<String, String> tslAttributes = new HashMap<String, String>();
    Iterator<String> all = before.enumerateAttributeNames();
    while (all.hasNext()) {
        String name = all.next().toString();
        String value = before.getAttribute(name) + "";
        tslAttributes.put(name, value);
    }
    ti.doInject(before, null, scriptPath, inheritedScripts);
    StringWriter sw = new StringWriter();
    before.write(sw);
    ti.cleanTslFragments(before);
    XMLElement after = before;
    // Reinsert tsl attributes.
    all = tslAttributes.keySet().iterator();
    while (all.hasNext()) {
        String name = all.next().toString();
        String value = tslAttributes.get(name);
        after.setAttribute(name, value);
    }
    StringWriter s = new StringWriter();
    after.write(s);
    return new java.io.ByteArrayInputStream(s.toString().getBytes());
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) StringWriter(java.io.StringWriter) HashMap(java.util.HashMap) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 94 with XMLElement

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

the class GeoPoint method createElement.

public XMLElement createElement(String label) {
    XMLElement c = new CaseSensitiveXMLElement("Point");
    c.addTagKeyValue("extrude", "0");
    c.addTagKeyValue("altitudeMode", "clampToGround");
    c.addTagKeyValue("coordinates", getCoordinates());
    if (label == null) {
        c.addTagKeyValue("name", id);
    } else {
        c.addTagKeyValue("name", label);
    }
    return c;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 95 with XMLElement

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

the class GeoPoint method createPlaceMark.

public XMLElement createPlaceMark(String label) {
    XMLElement c = new CaseSensitiveXMLElement("Placemark");
    c.setAttribute("id", label);
    c.addTagKeyValue("name", label);
    XMLElement point = createElement();
    c.addChild(point);
    return c;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) 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