use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement 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);
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement 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) {
}
}
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class MapMetaData method parse.
public void parse(Reader br, String scriptName, Writer sw) throws IOException, MetaCompileException, ClassNotFoundException {
XMLElement in = new CaseSensitiveXMLElement();
in.parseFromReader(br);
br.close();
parse(in, scriptName, sw);
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement 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.CaseSensitiveXMLElement 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());
}
Aggregations