stylesheetfilter.java
来自「随书的代码」· Java 代码 · 共 39 行
JAVA
39 行
import org.jdom.filter.Filter;import org.jdom.*;import java.util.List;public class StylesheetFilter implements Filter { // This filter is read-only. Nothing can be added or removed. public boolean canAdd(Object o) { return false; } public boolean canRemove(Object o) { return false; } public boolean matches(Object o) { if (o instanceof ProcessingInstruction) { ProcessingInstruction pi = (ProcessingInstruction) o; if (pi.getTarget().equals("xml-stylesheet")) { // Test to see if we're outside the root element if (pi.getParent() == null) { Document doc = pi.getDocument(); Element root = doc.getRootElement(); List content = doc.getContent(); if (content.indexOf(pi) < content.indexOf(root)) { // In prolog return true; } } } } return false; } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?