cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Haul <h...@dvs1.informatik.tu-darmstadt.de>
Subject Re: [Q] util:include-uri relative path
Date Fri, 12 Jul 2002 20:18:39 GMT
On 12.Jul.2002 -- 08:42 AM, Vadim Gritsenko wrote:
> > From: Christian Haul [mailto:haul@dvs1.informatik.tu-darmstadt.de]
> >       {
> >          org.apache.cocoon.components.parser.Parser newParser = null;
> >          try {
> >             newParser = (org.apache.cocoon.components.parser.Parser)
> > this.manager.lookup(org.apache.cocoon.components.parser.Parser.ROLE);
> >             XSPUtil.include(this.resolver.resolve(<xsl:copy-of
> > select="$source-uri"/>).getInputSource(), this.contentHandler,
> newParser);
> 
> Ooooh, no! Sorry Chris, but why the hell parse source twice???
> 
> My thinking here is that everywhere else Cocoon uses resolver to
> resolver URIs (and factory is deprecated). Thus, include-source is not
> needed and include-uri has to be refactored.
> 
> 
> >           } catch (Exception e) {
> >               getLogger().error("Could not include source", e);
> >           } finally {
> >               if (newParser != null) this.manager.release((Component)
> > newParser);
> >           }
> >       }

OK, gimme a hint: why does the following result in no output at all while the
other one works fine?

    public static void includeSource(String uri, String base, SourceResolver resolver, ContentHandler
contentHandler) 
        throws RuntimeException {
        
        if (base != null) base = (base != "" ? base : null);
        Source source = null;
        try {
            source = resolver.resolveURI(uri, base, null);
            resolver.toSAX(source, contentHandler);
          } catch (Exception e) {
              throw new RuntimeException("Error including source "+uri+" "+base+":"+e.getMessage());
          } finally {
              if (source != null)
                 resolver.release(source);
          }
    }

Oh, of course I couldn't find an error message anywhere.

	Chris.
-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
    fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message