⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 periodattribute.java

📁 博克后台的开发,有很多使用的方法和例子可以提供给大家学习
💻 JAVA
字号:
package com.common.util.cis;

import java.util.Iterator;
import java.util.List;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

public class PeriodAttribute {

	private  Document pubPeriodDoc = openXml("../pubperiod.xml");

	/**
	 * 得到Period的集合
	 */
	public  List powerAttriblist = pubPeriodDoc.selectNodes("/pubperiod/period");


	/**
	 * 定位xml,看其是否存在
	 * 
	 * @param xPath
	 *            相对路径
	 * @return 成功返回doc
	 * @throws Exception
	 */
	public Document openXml(String xPath) {
		Document doc = null;
		try {
			SAXReader saxReader = new SAXReader();
			doc = saxReader.read(xPath);
		} catch (Exception ex) {
			System.out.println("Read XML Error-->>" + ex.toString());
		}
		return doc;
	}

	/**
	 * @param args
	 */
	/*public static void main(String[] args) {
		// TODO 自动生成方法存根
		PeriodAttribute preiodAttribute = new PeriodAttribute();
		Iterator attributeIter = preiodAttribute.powerAttriblist.iterator();
		
		while (attributeIter.hasNext()) {
			Element timeElement = (Element) attributeIter.next();
			String attribText = timeElement.attributeValue("text");
			String attribPower = timeElement.attributeValue("power");
			System.out.print(attribText+"  "+attribPower);
			System.out.println("");

			// alarmClock.start(pubTimer);
		}

	}*/

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -