unico       2004/03/27 07:39:40

  Modified:    src/java/org/apache/cocoon/components/source SourceUtil.java
  Log:
  add missing toDOM method counterparts to toSAX methods
  
  Revision  Changes    Path
  1.16      +52 -2     
cocoon-2.2/src/java/org/apache/cocoon/components/source/SourceUtil.java
  
  Index: SourceUtil.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/source/SourceUtil.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SourceUtil.java   17 Mar 2004 12:33:34 -0000      1.15
  +++ SourceUtil.java   27 Mar 2004 15:39:40 -0000      1.16
  @@ -215,7 +215,7 @@
        * @throws SAXException If a SAX exception occurs.
        */
       static public Document toDOM(Source source)
  -            throws SAXException, IOException, ProcessingException {
  +    throws SAXException, IOException, ProcessingException {
           DOMBuilder builder = new DOMBuilder();
   
           toSAX(source, builder);
  @@ -229,6 +229,56 @@
           return document;
       }
   
  +    /**
  +     * Generates a DOM from the given source
  +     * @param source The data
  +     *
  +     * @return Created DOM document.
  +     *
  +     * @throws IOException If a io exception occurs.
  +     * @throws ProcessingException if no suitable converter is found
  +     * @throws SAXException If a SAX exception occurs.
  +     */
  +    static public Document toDOM(ServiceManager manager, Source source)
  +    throws SAXException, IOException, ProcessingException {
  +        DOMBuilder builder = new DOMBuilder();
  +
  +        toSAX(manager, source, null, builder);
  +
  +        Document document = builder.getDocument();
  +        if (document == null) {
  +            throw new ProcessingException("Could not build DOM for '"+
  +                                          source.getURI()+"'");
  +        }
  +
  +        return document;
  +    }
  +
  +    /**
  +     * Generates a DOM from the given source
  +     * @param source The data
  +     *
  +     * @return Created DOM document.
  +     *
  +     * @throws IOException If a io exception occurs.
  +     * @throws ProcessingException if no suitable converter is found
  +     * @throws SAXException If a SAX exception occurs.
  +     */
  +    static public Document toDOM(ServiceManager manager, String 
mimeTypeHint, Source source)
  +    throws SAXException, IOException, ProcessingException {
  +        DOMBuilder builder = new DOMBuilder();
  +
  +        toSAX(manager, source, mimeTypeHint, builder);
  +
  +        Document document = builder.getDocument();
  +        if (document == null) {
  +            throw new ProcessingException("Could not build DOM for '"+
  +                                          source.getURI()+"'");
  +        }
  +
  +        return document;
  +    }
  +    
       /**
        * Make a ProcessingException from a SourceException
        * If the exception is a SourceNotFoundException than a
  
  
  

Reply via email to