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);
}
}
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);
}
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());
}
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;
}
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;
}
Aggregations