本文整理匯總了Java中org.dom4j.DocumentException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java DocumentException.printStackTrace方法的具體用法?Java DocumentException.printStackTrace怎麽用?Java DocumentException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.dom4j.DocumentException
的用法示例。
在下文中一共展示了DocumentException.printStackTrace方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: XMLBeanFactory
import org.dom4j.DocumentException; //導入方法依賴的package包/類
public XMLBeanFactory(InputStream input) {
SAXReader reader = new SAXReader();
Document doc = null;
try {
doc = reader.read(input);
if (doc == null)
return;
} catch (DocumentException e) {
e.printStackTrace();
}
Element root = doc.getRootElement();
@SuppressWarnings("unchecked")
List<Element> beanElems = root.elements();
for (Element beanElem : beanElems) {
Bean bean = parseBeanElement(beanElem);
addBean(bean);
}
instancetiateSingletons();
}
示例2: testdeployDefinition
import org.dom4j.DocumentException; //導入方法依賴的package包/類
@Test
public void testdeployDefinition() {
// 初始化
SAXReader reader = new SAXReader();
// 拿不到信息
//URL url = this.getClass().getResource("/multipleTask.xml");
URL url = this.getClass().getResource("/singleTask.xml");
Document document = null;
try {
document = reader.read(url);
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String definitionContent = document.asXML();
// deploy first time
DefinitionHelper.getInstance().deployDefinition("singleTask", "測試單人任務流程", definitionContent, true);
//DefinitionHelper.getInstance().deployDefinition("multipleTask", "測試多人任務流程", definitionContent, true);
}
示例3: getApplicationId
import org.dom4j.DocumentException; //導入方法依賴的package包/類
/**
* Get the packageId for the manifest file
*
* @param manifestFile
* @return
*/
public static String getApplicationId(File manifestFile) {
SAXReader reader = new SAXReader();
if (manifestFile.exists()) {
Document document = null;// Read the XML file
try {
document = reader.read(manifestFile);
Element root = document.getRootElement();// Get the root node
String packageName = root.attributeValue("package");
return packageName;
} catch (DocumentException e) {
e.printStackTrace();
}
}
return null;
}
示例4: getMapByXmlStr
import org.dom4j.DocumentException; //導入方法依賴的package包/類
/**
* 解析XML字串得到Map對象
* @author Rocye
* @param xmlStr Xml字符串
* @return Xml對應的Map對象
* @version 2017.11.15
*/
public static Map<String, Object> getMapByXmlStr(String xmlStr){
Document doc = null;
try {
doc = DocumentHelper.parseText(xmlStr);
} catch (DocumentException e) {
e.printStackTrace();
}
Map<String, Object> map = new HashMap<String, Object>();
if (doc == null){
return map;
}
Element rootElement = doc.getRootElement();
Element2Map(rootElement, map);
return (Map<String, Object>)map.get("xml");
}
示例5: parseInitData
import org.dom4j.DocumentException; //導入方法依賴的package包/類
private Map<String, String> parseInitData(String data) {
try {
Map<String, String> ussData = new HashMap<>();
Document document = DocumentHelper.parseText(data);
Element root = document.getRootElement();
Iterator iter = root.elementIterator();
while (iter.hasNext()) {
Element ele = (Element) iter.next();
log.debug("name:" + ele.getName() + " value:" + ele.getStringValue());
ussData.put(ele.getName(), ele.getStringValue());
}
// 隨機device id
String deviceID = "e";
for (int i = 0; i < 3; i++) {
int randomNum = ThreadLocalRandom.current().nextInt(10000, 99999);
deviceID += randomNum;
}
ussData.put("deviceID", deviceID);
return ussData;
} catch (DocumentException e) {
e.printStackTrace();
}
return null;
}
示例6: isSuiteXml
import org.dom4j.DocumentException; //導入方法依賴的package包/類
/**
* 判斷是否為suite的xml配置
* @param content
* @return
*/
public static boolean isSuiteXml(byte[] content)
{
SAXReader reader = new SAXReader();
try
{
Document doc = reader.read(new ByteArrayInputStream(content));
Element rootEle = doc.getRootElement();
String rootEleName = rootEle.getName();
return "suite".equals(rootEleName);
}
catch (DocumentException e)
{
e.printStackTrace();
}
return false;
}
示例7: parse
import org.dom4j.DocumentException; //導入方法依賴的package包/類
public void parse(URL is) {
SAXReader saxReader = new SAXReader();
try {
Document document = saxReader.read(is);
Element root = document.getRootElement();
collectProperty(root);
parseAuth(root);
parseApp(root);
//
// System.out.println("====================parse ok=============");
// System.out.println(properties.toString());
// System.out.println(authSetting.toString());
} catch (DocumentException e) {
log.error("Load route.xml error.");
e.printStackTrace();
}
}
示例8: testdeployDefinition
import org.dom4j.DocumentException; //導入方法依賴的package包/類
@Test
public void testdeployDefinition() {
// 初始化
SAXReader reader = new SAXReader();
// 拿不到信息
URL url = this.getClass().getResource("/process12.xml");
Document document = null;
try {
document = reader.read(url);
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String definitionContent = document.asXML();
// deploy first time
DefinitionHelper.getInstance().deployDefinition("process", "測試流程", definitionContent, true);
}
示例9: xml2Map
import org.dom4j.DocumentException; //導入方法依賴的package包/類
public static Map<String, Object> xml2Map(InputStream xml){
SAXReader saxReader = new SAXReader();
Document doc;
try {
doc = saxReader.read(new InputStreamReader(xml));
return document2Map(doc);
} catch (DocumentException e) {
e.printStackTrace();
return null;
}
}
示例10: getDocument
import org.dom4j.DocumentException; //導入方法依賴的package包/類
/**
* 獲取document對象
* @param file 讀取的文件對象
* @return 返回Document對象
*/
public static Document getDocument(File file){
// 創建saxReader對象
SAXReader reader = new SAXReader();
// 通過read方法讀取一個文件 轉換成Document對象
Document document = null;
try {
document = reader.read(file);
} catch (DocumentException e) {
e.printStackTrace();
}
return document;
}
示例11: ConfigurationWrapper
import org.dom4j.DocumentException; //導入方法依賴的package包/類
private ConfigurationWrapper() {
try {
File configFile = getConfigFile();
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(configFile);
rootElement = document.getRootElement();
} catch (DocumentException e) {
e.printStackTrace();
}
}
示例12: initM2_HOME
import org.dom4j.DocumentException; //導入方法依賴的package包/類
private static void initM2_HOME() {
M2_HOME = System.getenv("M2_HOME");
if (null == M2_HOME) {
throw new RuntimeException(resource.getString("m2_home.not.found"));
}
List<String> configPaths = new ArrayList<>();
// ${user.home}/.m2/setting.xml
String userHome = System.getProperty("user.home");
StringBuilder sb = new StringBuilder(userHome);
sb.append(File.separator)
.append(".m2")
.append(File.separator)
.append("settings.xml");
configPaths.add(sb.toString());
// $M2_HOME/conf/settings.xml
sb.delete(0, sb.length());
sb.append(M2_HOME)
.append(File.separator)
.append("conf")
.append(File.separator)
.append("settings.xml");
configPaths.add(sb.toString());
try {
LOCAL_REPOSITORY = readConfig(configPaths);
} catch (DocumentException e) {
e.printStackTrace();
}
if (LOCAL_REPOSITORY == null) {
throw new RuntimeException(resource.getString("maven.config.file.not.found"));
}
}
示例13: readXML
import org.dom4j.DocumentException; //導入方法依賴的package包/類
/**
*
* @param xmlPath
* xml配置文件classpath路徑
* @return xml配置文件內容
*/
public static String readXML(String xmlPath) {
StringBuffer xmlBuffer = new StringBuffer();
SAXReader reader = new SAXReader();
try {
Document xmlDoc = reader.read(ConfigUtil.class.getClassLoader().getResourceAsStream(xmlPath));
xmlBuffer.append(xmlDoc.asXML());
} catch (DocumentException e) {
e.printStackTrace();
}
return xmlBuffer.toString();
}
示例14: readXML
import org.dom4j.DocumentException; //導入方法依賴的package包/類
private Element readXML(String path){
SAXReader reader=new SAXReader();
Document document= null;
try {
document = reader.read(path);
} catch (DocumentException e) {
e.printStackTrace();
}
Element root=document.getRootElement();
return root;
}
示例15: readDocument
import org.dom4j.DocumentException; //導入方法依賴的package包/類
/**
* 讀取xml文件
*/
public static Document readDocument(String xmlFilePath) {
// 創建SAXReader對象
SAXReader reader = new SAXReader();
// 讀取文件 轉換成Document
Document document = null;
try {
document = reader.read(new File(xmlFilePath));
} catch (DocumentException e) {
e.printStackTrace();
}
return document;
}