use of com.dexels.navajo.document.nanoimpl.XMLParseException 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.XMLParseException in project navajo by Dexels.
the class KMLMap method getKmlData.
/**
* TODO: Make thread safe
* @return
*/
public Binary getKmlData() {
try {
if (!isPointFile()) {
File kmz = createKmlFile(inMessage);
myKmzData = new Binary(kmz, false);
kmz.delete();
FormatDescription fd = new FormatDescription();
fd.addFileExtension("kmz");
fd.addMimeType("application/vnd.google-earth.kmz");
myKmzData.setMimeType("application/vnd.google-earth.kmz");
myKmzData.setFormatDescriptor(fd);
return myKmzData;
} else {
File kml = createPointKmlFile(inMessage, messagePath);
myKmzData = new Binary(kml, false);
kml.delete();
FormatDescription fd = new FormatDescription();
fd.addFileExtension("kml");
fd.addMimeType("application/vnd.google-earth.kml");
myKmzData.setMimeType("application/vnd.google-earth.kml");
myKmzData.setFormatDescriptor(fd);
return myKmzData;
}
} catch (XMLParseException e) {
logger.error("Error: ", e);
} catch (IOException e) {
logger.error("Error: ", e);
}
return null;
}
use of com.dexels.navajo.document.nanoimpl.XMLParseException in project navajo by Dexels.
the class KMLMap method main.
public static void main(String[] args) {
KMLMap hm = new KMLMap();
hm.setColorizer("whiteorange");
hm.setLegendHeight(250);
hm.setLegendSteps(7);
hm.setTitle("Aantal mannekes (Per 1000)");
// hm.setMin(0.05);
// hm.setMax(0.11);
hm.setMinLegend(0);
hm.setMaxLegend(1000);
Gemeente2Population.init();
try {
// Test t = new Test();
// hm.inMessage = t.createTestMessage();
FileInputStream fis = new FileInputStream("InitGenerateClubDataKnvb.tml");
Navajo n = NavajoFactory.getInstance().createNavajo(fis);
fis.close();
hm.inMessage = n;
// try{
// n.write(System.err);
// }catch(Exception e){
// System.err.println("Null navajo");
// }
File xxx = hm.createPointKmlFile(hm.inMessage, "Clubs");
logger.info("Saved file: " + xxx.getAbsolutePath());
// File res = new File("c:/clubs.kml");
// FileWriter fw = new FileWriter(res);
// xxx.write(fw);
// fw.flush();
// fw.close();
// System.err.println("KML Run finished...: "+res);
} catch (XMLParseException e) {
logger.error("Error: ", e);
} catch (IOException e) {
logger.error("Error: ", e);
}
}
Aggregations