use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class ScriptingRegistration method registerScriptAddOns.
private void registerScriptAddOns() {
File[] addonXmlFiles = AddOnsController.getController().getAddOnsDir().listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.endsWith(".script.xml");
}
});
final IXMLParser parser = XMLLocalParserFactory.createLocalXMLParser();
for (File file : addonXmlFiles) {
BufferedInputStream inputStream = null;
try {
inputStream = new BufferedInputStream(new FileInputStream(file));
final IXMLReader reader = new StdXMLReader(inputStream);
parser.setReader(reader);
final ScriptAddOnProperties addOn = new ScriptAddOnProperties((XMLElement) parser.parse());
addOn.setAddOnPropertiesFile(file);
AddOnsController.getController().registerInstalledAddOn(addOn);
} catch (final Exception e) {
LogUtils.warn("error parsing " + file, e);
} finally {
FileUtils.silentlyClose(inputStream);
}
}
}
use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class ScriptAddOnProperties method toXml.
public XMLElement toXml() {
final XMLElement xmlElement = super.toXml();
addScriptsAsChild(xmlElement);
addLibAsChild(xmlElement);
return xmlElement;
}
use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.
the class ScriptAddOnProperties method addLibAsChild.
private void addLibAsChild(XMLElement parent) {
final XMLElement xmlElement = new XMLElement("libs");
if (lib != null) {
for (String l : lib) {
final XMLElement libElement = new XMLElement("lib");
libElement.setAttribute("name", l);
xmlElement.addChild(libElement);
}
}
parent.addChild(xmlElement);
}
use of org.freeplane.n3.nanoxml.XMLElement in project jwt by emweb.
the class RenderUtils method extractTextNodes.
private static void extractTextNodes(XMLElement e) {
for (Object o : e.getChildren()) {
XMLElement c = ((XMLElement) o);
if (c.getChildren().size() > 0)
extractTextNodes(c);
if (c.getContent() != null && c.getName() != null) {
IXMLElement textNode = c.createElement(null);
textNode.setContent(c.getContent());
c.setContent(null);
c.addChild(textNode);
}
}
}
use of org.freeplane.n3.nanoxml.XMLElement in project jwt by emweb.
the class RenderUtils method nodeValueToString.
static String nodeValueToString(XMLElement node) {
String result = node.getContent();
if (result == null) {
result = "";
for (Object o : node.getChildren()) {
XMLElement e = (XMLElement) o;
result += e.getContent();
}
}
return result;
}
Aggregations