Re: custom transformer

2003-06-18 Thread Geert Van Damme

Thanks for the tip, but after playing around with it I realize that I'm mixing up two 
different things.
If I throw the SAXException, the rest of the original pipeline is still executed, 
after which the error pipeline is executed. What I want is to stop the original 
pipeline from the moment the exception is thrown, and thus not do any other 
transformations (this is required 'cause one transformer does some FTP stuff).

To make things clearer :
I'm starting from an XSP using esql to fetch fields from database. When an error 
occurs on database level (esql:error-results), the current pipeline may NOT be 
executed any further, but a new pipeline should be activated (this is why I thought I 
could invoke the error pipeline).

Any suggestions ? Could I use redirects inside the esql:error-results tag ? Or is 
there a better solution ?

Thanks again !


 [EMAIL PROTECTED] 06/17/03 04:39pm 
Le Mardi, 17 juin 2003, à 16:09 Europe/Zurich, Martin Holz a écrit :

 Geert Van Damme [EMAIL PROTECTED] writes:

 Hi,

 I'm writing a custom transformer, extending the 
 AbstractDOMTransformer. Is there a way to throw an exception from 
 this transformer so that the error handling pipeline of the sitemap 
 is 'activated' ? (the transform method signature does not throw an 
 exception). Or is the error handling from the sitemap only meant for 
 SAXExceptions ?


 Any checked exception in setup or any of the ContentHandler methods 
 should activate
 the error pipline. If you can't throw a ProcessingException in setup, 
 wrap a SAXException
 around your real exception.

In the case of AbstractDOMTransformer, transform() doesn't declare any 
exceptions (which it should IMO), so you might have to rewrite the 
notify() method in your transformer so that your transformation 
operation can throw exceptions.

-Bertrand

-
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: custom transformer

2003-06-17 Thread Martin Holz
Geert Van Damme [EMAIL PROTECTED] writes:

 Hi,
 
 I'm writing a custom transformer, extending the AbstractDOMTransformer. Is there a 
 way to throw an exception from this transformer so that the error handling pipeline 
 of the sitemap is 'activated' ? (the transform method signature does not throw an 
 exception). Or is the error handling from the sitemap only meant for SAXExceptions ?
 

Any checked exception in setup or any of the ContentHandler methods should activate 
the error pipline. If you can't throw a ProcessingException in setup, wrap a 
SAXException
around your real exception. 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Custom transformer

2003-02-04 Thread Konstantin Piroumian
From: Lionel Crine [EMAIL PROTECTED]

 I have an xml document :

 ?xml version=1.0 encoding=UTF-8?
 xsp:page xmlns:xsp=http://apache.org/xsp;
 xmlns:my_NS=http://www.my_NS.com/my_NS/query/1.0;


 my_NS:document
my_NS:query VERSION=2.0 RESULTSPACE=R1
  my_NS:property NAME = DocType
my_NS:elemDOCUMENT/my_NS:elem
  /my_NS:property
/my_NS:query
 /my_NS:document

 /xsp:page


 In my transformer I need to get all that si between my_NS:document
 /my_NS:document tag and put it in a string or a String buffer.

 Which method can do that for me ?

You should implement almost all the methods of ContentHandler interface,
such as:
startDocument()
startElement()
characters()
endElement()
endDocument()

etc. and store everything you need into a String buffer.

For an example you can take a look at classes in
src/java/org/apache/cocoon/transformation/helper/ package.

-- Konstantin


 Sax Characters method only returns  DOCUMENT, but I also need the tags.

 Lionel


 -
 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]




-
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]




Re: Custom transformer

2003-02-04 Thread Lionel Crine
I saw that and I've already implemented this method.

Where I'm stuck is that these methods return a void so how can I store my 
tags and text in a StringBuffer?

Lionel


-
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]



RE: Custom transformer

2003-02-04 Thread Carsten Ziegeler


 -Original Message-
 From: Konstantin Piroumian [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 04, 2003 11:42 AM
 To: [EMAIL PROTECTED]
 Subject: Re: Custom transformer 
 
 
 From: Lionel Crine [EMAIL PROTECTED]
 
  I have an xml document :
 
  ?xml version=1.0 encoding=UTF-8?
  xsp:page xmlns:xsp=http://apache.org/xsp;
  xmlns:my_NS=http://www.my_NS.com/my_NS/query/1.0;
 
 
  my_NS:document
 my_NS:query VERSION=2.0 RESULTSPACE=R1
   my_NS:property NAME = DocType
 my_NS:elemDOCUMENT/my_NS:elem
   /my_NS:property
 /my_NS:query
  /my_NS:document
 
  /xsp:page
 
 
  In my transformer I need to get all that si between my_NS:document
  /my_NS:document tag and put it in a string or a String buffer.
 
  Which method can do that for me ?
 
 You should implement almost all the methods of ContentHandler interface,
 such as:
 startDocument()
 startElement()
 characters()
 endElement()
 endDocument()
 
 etc. and store everything you need into a String buffer.
 
 For an example you can take a look at classes in
 src/java/org/apache/cocoon/transformation/helper/ package.

If you inherit from the AbstractSAXTransformer, you only have
to invoke startSerializedXMLRecording() before the first element
arrives that you want to have included in your string.

And at the end invoke endSerializedXMLRecording() and you get
all the XML inbetween as a string.

Have a look at some other transformers using the AbstractSAXTransformer
for samples.

Carsten

-
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]




RE: Custom transformer

2003-02-04 Thread Lionel Crine
I see, thanks


-
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]