Re: custom transformer
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]
custom transformer
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 ? I'm using Cocoon2.0.4 thanks ! Geert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: custom transformer
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]
custom transformer problem
Hello, My question is about exception handling in cocoon. I've a transformer that checks the validity of an XML document. If the document is not valid it throws an exception. When the transformer is after a generator it works well: it throws an exception and the error page is sent to the browser. But if the transformer is after another transformer, it doesn't throw the exception and all the pipeline is executed. However, the exception is logged in sitemap.log.Does anybody know how solve this problem? map:match pattern="UML_MAST_XMI2MAST_XMLresponse"map:generate type="myStream"map:parameter name="file-name" value="mast"/map:parameter name="validation" value="false"//map:generatemap:transform type="xalan" src=""/ !-- if Iadd this transformer, the following transformer doesn't work well; if I delete it myValidation transformerworks well--map:transform type="myValidation"map:parameter name="dom-name" value="DBresult"/map:parameter name="dom-root-element" value="MAST_RT_View"/map:parameter name="schema" value="mast.xsd"//map:transformmap:transform type="xalan" src=""/map:serialize//map:match Oskar
Custom transformer
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 ? 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]
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. -- 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
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
-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
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]
Re: Writing a custom transformer
simo kauranen wrote: Now I've written and compiled a transformer. I put the .class file where I found the other transformer .class files (not under tomcat) and defined the transformer in the sitemap (and restarted tomcat). I got ClassNotFoundException. Could someone tell where I should put the .class file that cocoon would find it? tomcat/webapps/cocoon/WEB-INF/classes/my/package/MyTransformer.class Vadim Simo K. - 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]
Writing a custom transformer
Hi, Maybe I'm a little dumb but I can't figure out from the source codes how I should write my own transformer. Several questions remain: Which functions should a transformer implement? Which function takes in the SAX stream and which emits it forward and how? Where the changes to the SAX are made? I went through among others the TraxTransformer source code but I couldn't find the line where the xslt transformation was made? Are loggers necessary for a transformer? Could someone help with these? Thanks! Simo K. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com - 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: Writing a custom transformer
From: simo kauranen [mailto:[EMAIL PROTECTED]] Hi, Maybe I'm a little dumb but I can't figure out from the source codes how I should write my own transformer. Several questions remain: Which functions should a transformer implement? Transformer is an implementation of a SAX ContentHandler and inherits all the methods like: startDocument(), startElement(), ..., endElement(), endDocument(). (For the complete list see SAX2 specification or the AbstractSAXTrasnformer). You decide depending on the task you want to solve with your transformer which ones to override to get the needed result. The rest of the methods that usually are present, like: configure(), setup(), recycle(), dispose() are lifecycle interfaces implementations from Avalon. See http://jakarta.apache.org/avalon for details. Konstantin Which function takes in the SAX stream and which emits it forward and how? Where the changes to the SAX are made? I went through among others the TraxTransformer source code but I couldn't find the line where the xslt transformation was made? Are loggers necessary for a transformer? Could someone help with these? Thanks! Simo K. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com - 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: Writing a custom transformer
Now I've written and compiled a transformer. I put the .class file where I found the other transformer .class files (not under tomcat) and defined the transformer in the sitemap (and restarted tomcat). I got ClassNotFoundException. Could someone tell where I should put the .class file that cocoon would find it? Simo K. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com - 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]
Writing a custom Transformer?
Hi, Does anyone happen to know where I could find a simple and thorough example of writing a custom transformer. I've searched all over the net but haven't found anything detailed enough. Thanks for tips! Simo K. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com - 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: Writing a custom Transformer?
From: simo kauranen [mailto:[EMAIL PROTECTED]] Hi, Does anyone happen to know where I could find a simple and thorough example of writing a custom transformer. I've searched all over the net but haven't found anything detailed enough. Take a look at the Cocoon transformers' source: org.apache.cocoon.transformation.*; Not that they are all simple, but you'll get the idea. Konstantin Thanks for tips! Simo K. __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com - 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]