Search in sources :

Example 31 with CaseSensitiveXMLElement

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);
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 32 with CaseSensitiveXMLElement

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) {
            }
        }
    }
}
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 33 with CaseSensitiveXMLElement

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);
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 34 with CaseSensitiveXMLElement

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);
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 35 with CaseSensitiveXMLElement

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

Aggregations

CaseSensitiveXMLElement (com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement)53 XMLElement (com.dexels.navajo.document.nanoimpl.XMLElement)49 IOException (java.io.IOException)10 InputStreamReader (java.io.InputStreamReader)7 FileReader (java.io.FileReader)5 HashMap (java.util.HashMap)5 File (java.io.File)3 FileInputStream (java.io.FileInputStream)3 APIException (com.dexels.navajo.article.APIException)2 Message (com.dexels.navajo.document.Message)2 Property (com.dexels.navajo.document.Property)2 BufferedReader (java.io.BufferedReader)2 InputStream (java.io.InputStream)2 PrintWriter (java.io.PrintWriter)2 Reader (java.io.Reader)2 StringReader (java.io.StringReader)2 StringWriter (java.io.StringWriter)2 ArrayList (java.util.ArrayList)2 XMLParseException (com.dexels.navajo.document.nanoimpl.XMLParseException)1 AdapterFieldDependency (com.dexels.navajo.mapping.compiler.meta.AdapterFieldDependency)1