use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class BaseContextImpl method writeArticleMeta.
@Override
public void writeArticleMeta(String name, ObjectNode w, ObjectMapper mapper, boolean extended) throws APIException {
File in = resolveArticle(name);
try (FileReader fr = new FileReader(in)) {
ObjectNode article = mapper.createObjectNode();
w.set(name, article);
XMLElement x = new CaseSensitiveXMLElement();
x.parseFromReader(fr);
article.put("name", name);
interpretMeta(x, mapper, article, extended);
} catch (FileNotFoundException e) {
throw new APIException("Article " + name + " not found", e, APIErrorCode.ArticleNotFound);
} catch (XMLParseException e) {
throw new APIException("Article " + name + " is not valid XML", e, APIErrorCode.InternalError);
} catch (IOException e) {
throw new APIException("Autoclose on filereader failed", e, APIErrorCode.InternalError);
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class BaseContextImpl method interpretArticle.
@Override
public void interpretArticle(File article, ArticleRuntime ac) throws APIException, NoJSONOutputException {
XMLElement articleXml = new CaseSensitiveXMLElement();
Reader r = null;
try {
r = new FileReader(article);
articleXml.parseFromReader(r);
ac.execute(this);
} catch (IOException e) {
throw new APIException(e.getMessage(), e, APIErrorCode.InternalError);
} finally {
if (r != null) {
try {
r.close();
} catch (IOException e) {
logger.error("Error: ", e);
}
}
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class TslMetaDataHandler method addCalledBy.
/**
* @param xn
* @param element
*/
private void addCalledBy(XMLElement xn, String element) {
TreeSet<String> s = calledByScriptMap.get(element);
if (s == null) {
return;
}
for (Iterator<String> iter = s.iterator(); iter.hasNext(); ) {
String include = iter.next();
XMLElement xnincl = new CaseSensitiveXMLElement();
xnincl.setName("calledby");
xnincl.setAttribute("name", include);
xn.addChild(xnincl);
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class TslMetaDataHandler method createTotalXML.
public XMLElement createTotalXML() {
XMLElement x = new CaseSensitiveXMLElement();
x.setName("metadata");
for (Iterator<String> iter = scriptList.iterator(); iter.hasNext(); ) {
String element = iter.next();
addScriptElement(x, element);
}
return x;
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class TslMetaDataHandler method toXml.
private XMLElement toXml(Map<String, TreeSet<String>> m, String topTagName, String tagname, String elementName, String attribute) {
XMLElement x = new CaseSensitiveXMLElement();
x.setName(topTagName);
Set<Entry<String, TreeSet<String>>> s = m.entrySet();
for (Iterator<Entry<String, TreeSet<String>>> iter = s.iterator(); iter.hasNext(); ) {
Entry<String, TreeSet<String>> e = iter.next();
String element = e.getKey();
TreeSet<String> value = e.getValue();
XMLElement xc = new CaseSensitiveXMLElement();
xc.setName(tagname);
xc.setAttribute("name", element);
x.addChild(xc);
for (Iterator<String> iterator = value.iterator(); iterator.hasNext(); ) {
String ee = iterator.next();
XMLElement xce = new CaseSensitiveXMLElement();
xce.setName(elementName);
xce.setAttribute(attribute, ee);
xc.addChild(xce);
}
}
return x;
}
Aggregations