You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Vincent Siveton (JIRA)" <ji...@codehaus.org> on 2007/01/27 16:30:44 UTC
[jira] Closed: (DOXIA-27) sink validation (sink advisor)
[ http://jira.codehaus.org/browse/DOXIA-27?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vincent Siveton closed DOXIA-27.
--------------------------------
Assignee: Vincent Siveton
added test cases
> sink validation (sink advisor)
> ------------------------------
>
> Key: DOXIA-27
> URL: http://jira.codehaus.org/browse/DOXIA-27
> Project: doxia
> Issue Type: Improvement
> Reporter: Juan F. Codagnone
> Assigned To: Vincent Siveton
> Fix For: 1.0-alpha-6
>
> Attachments: DOXIA-27.tar.gz
>
>
> Hi,
> in the past day i've been writting a twiki parser for doxia. It isn't done
> yet, but i started to convert some text using existing Sinks, and while doing
> that i've found some problems:
> None of the sinks tries to validates a correct usage. For example in most of
> sinks,
> sink.list();
> sint.listItem_();
> would generate an invalid output, and you don't find that until you process
> the output. I found this a bit fragile.
> To solve it, i've created an AdvicedSink class that is a proxy implementation
> of a Sink, where you can inject some Advisors to do some crosscutting
> validations. The advisors are like AOP and you only must implement one method
> instead of the 89 of the Sink.
> I've implemented two advisors: one that prints the the sink calls with
> indentation:
> head
> head_
> body
> section1
> sectionTitle
> text
> ...
> usefull for debuging, and one that throws a runtime exception if the closing
> element doesn't match with the starting, in cases like:
> sink.list();
> sint.listItem_();
> In the future i would like to see an advisor that check in a fine grain the
> sink events. For example in the XdocSink if i do
> sink.listItem();
> sink.text("foo");
> sink.listItem_();
> wrong code is generated, and i must do:
> sink.listItem();
> sink.paragraph();
> sink.text("foo");
> sink._paragraph();
> sink.listItem_();
> to get the correct content. And state machine advisor would only allow to call
> paragraph item a listitem and that would be reusable for all the sinks.
> Example of use:
> final Sink sink = new AdvicedSink(new MethodBeforeAdvice[] {
> new PrintAdvisor(System.out),
> new HangingElementAdvice(),
> }, new XdocSink(writer));
> I hope you found it usefull as i do.
> Regards,
> Juan.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira