cziegeler    02/02/18 07:03:34

  Modified:    src/scratchpad/src/org/apache/cocoon/sunshine/xml
                        XMLUtil.java
  Log:
  Removed obsolete methods
  
  Revision  Changes    Path
  1.3       +4 -87     
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLUtil.java      18 Feb 2002 14:47:56 -0000      1.2
  +++ XMLUtil.java      18 Feb 2002 15:03:34 -0000      1.3
  @@ -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.2 2002/02/18 14:47:56 cziegeler Exp $
  + * @version CVS $Id: XMLUtil.java,v 1.3 2002/02/18 15:03:34 cziegeler Exp $
   */
   public final class XMLUtil {
   
  @@ -432,93 +432,10 @@
       private static final String XML_ROOT_DEFINITION = XML_DEFINITION + "<root>";
   
       /**
  -     * Get a document fragment from an input stream.
  -     * The Reader must not provide valid xml. This xml is parsed by the
  +     * Get a document fragment from a <code>Reader</code>.
  +     * The reader must provide valid XML, but it is allowed that the XML
  +     * has more than one root node. This xml is parsed by the
        * specified parser instance and a DOM DocumentFragment is created.
  -     */
  -    public static DocumentFragment getDocumentFragment(Reader stream,
  -                                                       Parser parser)
  -    throws ProcessingException {
  -        DocumentFragment frag = null;
  -
  -        Writer writer;
  -        Reader reader;
  -        boolean removeRoot = true;
  -
  -        try {
  -            // create a writer,
  -            // write the root element, then the input from the
  -            // reader
  -            writer = new StringWriter();
  -
  -            writer.write(XML_ROOT_DEFINITION);
  -            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>");
  -
  -            // now test if xml input start with <?xml
  -            String xml = writer.toString();
  -            String searchString = XML_ROOT_DEFINITION+"<?xml ";
  -            if (xml.startsWith(searchString) == true) {
  -                // now remove the surrounding root element
  -                xml = xml.substring(XML_ROOT_DEFINITION.length(), xml.length()-7);
  -                removeRoot = false;
  -            }
  -
  -            reader = new StringReader(xml);
  -
  -            InputSource input = new InputSource(reader);
  -
  -            DOMBuilder builder = new DOMBuilder();
  -            builder.startDocument();
  -            builder.startElement("", "sunShine", "sunShine", new AttributesImpl());
  -
  -            IncludeFilter filter = new IncludeFilter(builder, builder);
  -            parser.setContentHandler(filter);
  -            parser.setLexicalHandler(filter);
  -            parser.parse(input);
  -
  -            builder.endElement("", "sunShine", "sunShine");
  -            builder.endDocument();
  -
  -            // Create Document Fragment, remove <root>
  -            final Document doc = builder.getDocument();
  -            frag = doc.createDocumentFragment();
  -            final Node root = doc.getDocumentElement().getFirstChild();
  -            root.normalize();
  -            if (removeRoot == false) {
  -                root.getParentNode().removeChild(root);
  -                frag.appendChild(root);
  -            } else {
  -                Node child;
  -                while (root.hasChildNodes() == true) {
  -                    child = root.getFirstChild();
  -                    root.removeChild(child);
  -                    frag.appendChild(child);
  -                }
  -            }
  -
  -        } catch (SAXException sax) {
  -            throw new ProcessingException("SAXException: " + sax, sax);
  -        } catch (IOException ioe) {
  -            throw new ProcessingException("IOException: " + ioe, ioe);
  -        }
  -
  -        return frag;
  -    }
  -
  -    /**
  -     * Get a document fragment from an input stream.
  -     * The Reader must not provide valid xml. This xml is parsed by the
  -     * configured JAXP SAX Parser and a DOM DocumentFragment is created.
  -     * If you have the <code>Parser</code> instance available use
  -     * getDocumentFragment(Reader, Parser) instead.
        */
       public static DocumentFragment getDocumentFragment(Parser parser,
                                                          Reader stream)
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to