Java tutorial
//package com.java2s; /* * File: xml_utils.java.java * * Copyright (C) 2002, Ruth Mikkelson * * 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 library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Contact : Ruth Mikkelson <mikkelsonr@uwstout.edu> * Department of Mathematics, Statistics and Computer Science * University of Wisconsin-Stout * Menomonie, WI 54751, USA * * This work was supported by the Intense Pulsed Neutron Source Division * of Argonne National Laboratory, Argonne, IL 60439-4845, USA. * * For further information, see <http://www.pns.anl.gov/ISAW/> * * Modified: * * $Log$ * Revision 1.10 2004/03/11 23:07:13 dennis * Removed dependency on DataSet Attributes * * Revision 1.9 2004/01/22 02:19:05 bouzekc * Removed unused imports and local variables. * * Revision 1.8 2003/10/20 16:31:06 rmikk * Fixed javadoc errors * * Revision 1.7 2003/06/18 20:35:35 pfpeterson * Changed calls for NxNodeUtils.Showw(Object) to * DataSetTools.util.StringUtil.toString(Object) * * Revision 1.6 2003/03/03 16:49:16 pfpeterson * Changed SharedData.status_pane.add(String) to SharedData.addmsg(String) * * Revision 1.5 2002/11/27 23:14:07 pfpeterson * standardized header * * Revision 1.4 2002/11/12 03:36:24 dennis * Since Attributes are no longer mutable, this can't call setValue() * for Double, Float and Int Attributes (line 421). This must still be * modified to adapt to immutable Attributes. * * Revision 1.3 2002/07/10 19:35:23 rmikk * Change in documentation * * Revision 1.2 2002/06/17 22:46:19 rmikk * Prettied up the file. Made minor changes * * Revision 1.1 2002/06/14 21:25:44 rmikk * Common utilities for Implementers of the IXmlIO interface * */ import java.io.*; public class Main { public static String errormessage; public static StringBuffer sb = new StringBuffer(2000); /** Returns the value associated with the tag<P> * Must be invoked after the tag and all attributes have been * dealt with */ public static String getValue(InputStream is) { errormessage = null; try { sb.setLength(0); for (char c = (char) is.read(); c != '<'; c = (char) is.read()) sb.append("" + c); return sb.toString(); } catch (Exception s) { errormessage = s.getMessage(); return null; } } }