use of javax.xml.parsers.ParserConfigurationException in project jmonkeyengine by jMonkeyEngine.
the class XMLExporter method save.
@Override
public void save(Savable object, OutputStream f) throws IOException {
try {
//Initialize Document when saving so we don't retain state of previous exports
this.domOut = new DOMOutputCapsule(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(), this);
domOut.write(object, object.getClass().getName(), null);
DOMSerializer serializer = new DOMSerializer();
serializer.serialize(domOut.getDoc(), f);
f.flush();
} catch (ParserConfigurationException ex) {
throw new IOException(ex);
}
}
use of javax.xml.parsers.ParserConfigurationException in project Apktool by iBotPeaches.
the class ResXmlPatcher method removeApplicationDebugTag.
/**
* Removes "debug" tag from file
*
* @param file AndroidManifest file
* @throws AndrolibException
*/
public static void removeApplicationDebugTag(File file) throws AndrolibException {
if (file.exists()) {
try {
Document doc = loadDocument(file);
Node application = doc.getElementsByTagName("application").item(0);
// load attr
NamedNodeMap attr = application.getAttributes();
Node debugAttr = attr.getNamedItem("android:debuggable");
// remove application:debuggable
if (debugAttr != null) {
attr.removeNamedItem("android:debuggable");
}
saveDocument(file, doc);
} catch (SAXException | ParserConfigurationException | IOException | TransformerException ignored) {
}
}
}
use of javax.xml.parsers.ParserConfigurationException in project Apktool by iBotPeaches.
the class ResXmlPatcher method removeManifestVersions.
/**
* Removes attributes like "versionCode" and "versionName" from file.
*
* @param file File representing AndroidManifest.xml
* @throws AndrolibException
*/
public static void removeManifestVersions(File file) throws AndrolibException {
if (file.exists()) {
try {
Document doc = loadDocument(file);
Node manifest = doc.getFirstChild();
NamedNodeMap attr = manifest.getAttributes();
Node vCode = attr.getNamedItem("android:versionCode");
Node vName = attr.getNamedItem("android:versionName");
if (vCode != null) {
attr.removeNamedItem("android:versionCode");
}
if (vName != null) {
attr.removeNamedItem("android:versionName");
}
saveDocument(file, doc);
} catch (SAXException | ParserConfigurationException | IOException | TransformerException ignored) {
}
}
}
use of javax.xml.parsers.ParserConfigurationException in project Openfire by igniterealtime.
the class GatewayDWR method configure.
@Override
public void configure(ServletConfig servletConfig, Configuration configuration) throws ServletException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
document = builder.newDocument();
Element root = document.createElement("dwr");
document.appendChild(root);
Element allowElement = document.createElement("allow");
allowElement.appendChild(buildCreator("ConfigManager", "net.sf.kraken.web.ConfigManager"));
allowElement.appendChild(buildCreator("ConnectionTester", "net.sf.kraken.web.ConnectionTester"));
root.appendChild(allowElement);
} catch (ParserConfigurationException e) {
Log.error("Error configuring DWR for gateway plugin: ", e);
}
configuration.addConfig(document);
// Specify the path for the js files
Object bean = container.getBean("interface");
if (bean instanceof DefaultInterfaceProcessor) {
DefaultInterfaceProcessor processor = (DefaultInterfaceProcessor) bean;
processor.setOverridePath("/plugins/kraken/dwr");
}
}
use of javax.xml.parsers.ParserConfigurationException in project Openfire by igniterealtime.
the class MonitoringDWR method configure.
@Override
public void configure(ServletConfig servletConfig, Configuration configuration) throws ServletException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
document = builder.newDocument();
Element root = document.createElement("dwr");
document.appendChild(root);
Element allowElement = document.createElement("allow");
// Build stats bean
Element createElement = buildCreator("Stats", org.jivesoftware.openfire.reporting.stats.StatsAction.class.getName());
Element convertConversationElement = document.createElement("convert");
convertConversationElement.setAttribute("converter", "bean");
convertConversationElement.setAttribute("match", org.jivesoftware.openfire.archive.ConversationInfo.class.getName());
// Build conversation Element.
Element conversationElement = buildCreator("conversations", org.jivesoftware.openfire.archive.ConversationUtils.class.getName());
allowElement.appendChild(createElement);
allowElement.appendChild(convertConversationElement);
allowElement.appendChild(conversationElement);
root.appendChild(allowElement);
} catch (ParserConfigurationException e) {
Log.error("error creating DWR configuration: " + e);
}
configuration.addConfig(document);
// Specify the path for the Stat.js file
Object bean = container.getBean("interface");
if (bean instanceof DefaultInterfaceProcessor) {
DefaultInterfaceProcessor processor = (DefaultInterfaceProcessor) bean;
processor.setOverridePath("/plugins/" + MonitoringConstants.NAME + "/dwr");
}
}
Aggregations