本文整理汇总了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;
}