cziegeler 02/02/18 06:47:56 Modified: src/scratchpad/src/org/apache/cocoon/sunshine/xml XMLUtil.java Log: Removed obsolete methods Revision Changes Path 1.2 +1 -104 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/sunshine/xml/XMLUtil.java Index: XMLUtil.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/sunshine/xml/XMLUtil.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XMLUtil.java 18 Feb 2002 09:10:10 -0000 1.1 +++ XMLUtil.java 18 Feb 2002 14:47:56 -0000 1.2 @@ -99,7 +99,7 @@ * @deprecated Do not use this class! We will provide a better solution for most methods soon. * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: XMLUtil.java,v 1.1 2002/02/18 09:10:10 cziegeler Exp $ + * @version CVS $Id: XMLUtil.java,v 1.2 2002/02/18 14:47:56 cziegeler Exp $ */ public final class XMLUtil { @@ -598,54 +598,6 @@ } /** - * Stream xml from an input stream. - * The Reader must provide valid xml. This xml stream is parsed by the - * specified parser instance. The parser sends the SAXEvents to the - * ContentHandler and LexicalHandler. - */ - public static void streamXML(Reader stream, - Parser parser, - ContentHandler coh, - LexicalHandler leh) - throws ProcessingException { - Writer writer; - Reader reader; - - try { - // create a writer, - // write the root element, then the input from the - // reader - writer = new StringWriter(); - - writer.write("<root>"); - char[] cbuf = new char[16384]; - int len; - do { - len = stream.read(cbuf, 0, 16384); - if (len != -1) { - writer.write(cbuf, 0, len); - } - } while (len != -1); - writer.write("</root>"); - - reader = new StringReader(writer.toString()); - - InputSource input = new InputSource(reader); - - IncludeFilter filter = new IncludeFilter(coh, leh); - filter.setIgnoreRootElement(true); - parser.setContentHandler(filter); - parser.setLexicalHandler(filter); - parser.parse(input); - - } catch (SAXException sax) { - throw new ProcessingException("SAXException: " + sax, sax); - } catch (IOException ioe) { - throw new ProcessingException("IOException: " + ioe, ioe); - } - } - - /** * Create a parameter object from xml. * The xml is flat and consists of elements which all have exactly one text node: * <parone>value_one<parone> @@ -717,25 +669,6 @@ } /** - * Create a DOM document fragment from a string. - * A new DocumentFragment is created and a text node with the given - * value is appended to this fragment. - */ - public static DocumentFragment createFragment(String value) - throws ProcessingException { - DocumentFragment fragment = null; - if (value != null && value.trim().length() > 0) { - Document doc = XMLUtil.createDocument(); - fragment = doc.createDocumentFragment(); - Text text = doc.createTextNode(value.trim()); - fragment.appendChild(text); - } - - return fragment; - } - - - /** * Serialize a DOM node to a String. * The defaultSerializeToXMLFormat() is used to format the serialized xml. */ @@ -1141,39 +1074,3 @@ } } - - /** - * A little helper class implementing the error handler interface - */ - class SAXParserErrorHandler implements ErrorHandler { - /** - * Receive notification of a recoverable error. - */ - public void error(SAXParseException e) - throws SAXException { - throw new SAXException("Error parsing "+e.getSystemId()+" (line "+ - e.getLineNumber()+" col. "+e.getColumnNumber()+ - "): "+e.getMessage(),e); - } - - /** - * Receive notification of a fatal error. - */ - public void fatalError(SAXParseException e) - throws SAXException { - throw new SAXException("Fatal error parsing "+e.getSystemId()+" (line "+ - e.getLineNumber()+" col. "+e.getColumnNumber()+ - "): "+e.getMessage(),e); - } - - /** - * Receive notification of a warning. - */ - public void warning(SAXParseException e) - throws SAXException { - throw new SAXException("Warning parsing "+e.getSystemId()+" (line "+ - e.getLineNumber()+" col. "+e.getColumnNumber()+ - "): "+e.getMessage(),e); - } - } -
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]