📄 xml2tree.java
字号:
/* * File: Xml2Tree.java * Project: MPI Linguistic Application * Date: 02 May 2007 * * Copyright (C) 2001-2007 Max Planck Institute for Psycholinguistics * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package mpi.util;import org.apache.xerces.parsers.SAXParser;import org.xml.sax.InputSource;import org.xml.sax.XMLReader;import java.net.URL;import javax.swing.tree.DefaultMutableTreeNode;import javax.swing.tree.TreeNode;/** * Created on Apr 26, 2005 $Id: Xml2Tree.java,v 1.2 2006/04/20 08:13:56 klasal Exp $ $Author: * klasal $ $Version$ */public class Xml2Tree { private static XMLReader parser; /** * DOCUMENT ME! * * @param url DOCUMENT ME! * * @return DOCUMENT ME! * * @throws Exception DOCUMENT ME! */ public static TreeNode getTree(URL url) throws Exception { DefaultMutableTreeNode root = new DefaultMutableTreeNode("document"); if (parser == null) { parser = new SAXParser(); } parser.setContentHandler(new Xml2TreeHandler(root)); parser.parse(new InputSource(url.openStream())); return root; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -