unico       2004/03/24 04:24:14

  Modified:    src/java/org/apache/cocoon/components/source SourceUtil.java
  Log:
  add toDOM method that takes a ServiceManager
  
  Revision  Changes    Path
  1.15      +26 -1     
cocoon-2.1/src/java/org/apache/cocoon/components/source/SourceUtil.java
  
  Index: SourceUtil.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/SourceUtil.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SourceUtil.java   17 Mar 2004 12:09:51 -0000      1.14
  +++ SourceUtil.java   24 Mar 2004 12:24:14 -0000      1.15
  @@ -315,6 +315,31 @@
   
           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;
  +    }
   
       /**
        * Make a ProcessingException from a SourceException
  
  
  

Reply via email to