> From: Christian Haul [mailto:[EMAIL PROTECTED]]
> 
> On 12.Jul.2002 -- 08:42 AM, Vadim Gritsenko wrote:
> > > From: Christian Haul [mailto:[EMAIL PROTECTED]]
> > >       {
> > >          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?


Hint: two start document events, two end document events.

See my other email, my proposed patch uses include consumer.
(not sure though why no output)


Vadim

 
>     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
> [EMAIL PROTECTED]
>     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:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to