[ http://issues.apache.org/jira/browse/COCOON-1906?page=comments#action_12437870 ] Lars Trieloff commented on COCOON-1906: ---------------------------------------
Jean Baptiste, the main problem is that there is no casting in Javascript and for any class that implements both XMLlizable and Source, the Rhino interpreter cannot decide because the distance is equal. So I see following solutions: - adding a method for every xmllizable source (the approach of my patch) - making xmlizable extend source (impossible, as it is in excalibur) - adding an interface xmlizablesource and changing every cocoon source that implements xmlizable (inconvenient) - adding methods with different names sourceToSAX() and xmlizableToSAX() (this is not the best Java style, but would be the choice for Javascript development) As the goal is to make it easier to use this class from Javascript, I would prefer the last option. It does not break the api, requires no changes to existing code and is easy to implement? What do you think? > [PATCH] simple-xml binding does not work with non file sources > -------------------------------------------------------------- > > Key: COCOON-1906 > URL: http://issues.apache.org/jira/browse/COCOON-1906 > Project: Cocoon > Issue Type: Bug > Components: Blocks: Forms, * Cocoon Core > Affects Versions: 2.2-dev (Current SVN) > Reporter: Lars Trieloff > Attachments: cocoon-formsbinding-sample.patch, > cocoon-formsbinding-sourceutil.patch > > > The cocoon forms flowscript API comes with a helper method form.loadXML, that > retrieves data from an xml document. The current implementation however does > not work with documents that are referenced not as files, but as > SitemapSources, e.g. via the cocoon:/ or xmldb:// pseudo-protocol. In this > case the Rhino engine is unable to resolve the ambiguity between two method > signatures: > org.mozilla.javascript.EvaluatorException: > "resource://org/apache/cocoon/forms/flow/javascript/Form.js", line 287: The > choice of Java constructor toSAX matching JavaScript argument types > (org.apache.cocoon.components.source.impl.SitemapSource,org.apache.cocoon.forms.util.XMLAdapter) > is ambiguous; candidate constructors are: > void toSAX(org.apache.excalibur.xml.sax.XMLizable,org.xml.sax.ContentHandler) > void toSAX(org.apache.excalibur.source.Source,org.xml.sax.ContentHandler) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
