📄 inodeservice.java
字号:
/**
* @author 沈东良 Edward Shen<a href="mailto:shendl_s@hotmail.com">shendl_s@hotmail.com</a>
* 2007-8-7 上午11:07:10
*/
package net.sf.oxmled.service;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.List;
import org.dom4j.Document;
import net.sf.oxmled.model.INode;
import net.sf.oxmled.model.Node;
public interface INodeService {
/**
* 根据URL返回INode对象,代表整棵树
* @param url
* @return
* @throws Exception
*/
public abstract INode loadXmlFile(URL url) throws Exception;
/**
* 读取xml文件,返回字符串。
* @param url
* @return
* @throws Exception
*/
public abstract String loadXmlFileToString(URL url) throws Exception;
/**
* 助手方法,用来根据属性名和值,找出所有对应的Node
* @param rootNode
* @param attributeName
* @param attributeValue
* @return
*/
public abstract List<Node> getNodes(INode rootNode, String attributeName,
String attributeValue);
/**
* 递归寻找,直到找到
*
* @param results
* 找到的,放在这个结果集中, 这是返回值。
* @param node
* 节点,找它,找它儿子 然后递归
* @param attributeName
* @param attributeValue
*/
public abstract void getNodesRecursive(List<Node> results, Node node,
String attributeName, String attributeValue);
/**
* 返回第几个节点。从0开始
* @param parent
* @param index
* @return
*/
public abstract INode getChild(INode parent, int index);
/**
* 返回儿子的总数
* Returns the number of children of <code>parent</code>. Returns 0 if
* the node is a leaf or if it has no children. <code>parent</code> must
* be a node previously obtained from this data source.
*
* @param parent
* a node in the tree, obtained from this data source
* @return the number of children of the node <code>parent</code>
*/
public abstract int getChildCount(INode parent);
/**
* 返回某个节点在父亲节点中的索引号
* @param parent
* @param child
* @return
*/
public abstract int getIndexOfChild(INode parent, INode child);
/**
* 把node写入到某个文件中
* @param node
* @param url
* @throws URISyntaxException
* @throws IOException
*/
public abstract void write(INode node,URL url) throws IOException, URISyntaxException;
/**
* 把node写入到某个文件中
* @param node
* @param fileName 项目内的路径,相对于目标的根路径
* @throws URISyntaxException
* @throws IOException
*/
public abstract void write(INode node,String fileName) throws IOException, URISyntaxException;
/**
* 生成的xml文件使用美化格式
* @param node
* @param url
* @throws URISyntaxException
* @throws IOException
*/
public abstract void writeToPrettyPrint(INode node, URL url) throws IOException, URISyntaxException;
/**
* 生成的xml文件使用美化格式
* @param node
* @param fileName
* @throws IOException
* @throws URISyntaxException
*/
public abstract void writeToPrettyPrint(INode node, String fileName) throws IOException, URISyntaxException;
/**
* 生成的xml文件使用紧凑格式
* @param document
* @param fileName
* @throws IOException
*/
public abstract void writeToCompactFormat(INode node, String fileName) throws IOException;
/**
* 生成的xml文件使用紧凑格式
* @param node
* @param url
* @throws URISyntaxException
* @throws IOException
*/
public abstract void writeToCompactFormat(INode node, URL url) throws IOException, URISyntaxException;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -