tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard Lewis Ship" <hls...@gmail.com>
Subject Re: Tapestry DOM, is it read only??
Date Wed, 05 Sep 2007 16:21:37 GMT
YAGNI:  I've been adding such features only as needed.  Tapestry already
does modify the DOM, adding <script> elements inside the <body> tag, for
example, and changing element attributes.

On 9/3/07, Fernando Padilla <fern@alum.mit.edu> wrote:
>
> I need some more help. :)
>
> So I thought the documentation said that the Tapestry DOM was there so
> that we could go back and modify it before it got serialized out to the
> user.  But I don't quite see any modification methods exposed in the API
> (no setName, no removeChild, etc).
>
> Am I right or wrong?
>
> Is the only way to modify the tree is to do a deep copy of the whole
> tree with desired modifications, I don't think I even see a way to
> modify the root element..
>
>
>
> Along these lines.. Is there any way to switch in our own MarkupWriter
> for the duration of a particular component?  That way we can switch in a
> markup writer that will do the modifications that I want the first time,
> rather than having to go back..
>
>
>
> ideas please :) :)
>
>
>
> Fernando Padilla wrote:
> > Yes I've been looking all over the code.  Right now I think that I have
> > two options.  Could I get some more feedback?
> >
> > 1) hack :)
> >   write a mixin that will go through the dom after rendering and replace
> > element/attribute names with desired versions: "fm_fbml" to "fb:fbml".
> > This is how I'll start, but it would be much better to have tapestry
> > support namespaces properly.
> >
> > 2) start submitting patches to have tapestry support namespaces:
> >  a) Maintain Namespace in Tapestry DOM
> >   1) add url to tapestry.dom nodes
> >   2) have tapestry parser set them
> >   3) the information will be available for mixins/components
> >  b) We can then print them out, by default or by configuration
> >   1) generate url/prefix mappings
> >   2) print them out as appropriate
> >   3) have some way to have desired prefixes
> >      ( or somehow pull them out from the original template ).
> >
> >
> > Any feedback?  Do you think patches to have tapestry support namespaces
> > would be wanted??
> >
> >
> >
> >
> > Nick Westgate wrote:
> >> Or possibly patch TemplateParser to do what you want.
> >> Tapestry uses SAX. See:
> >> org.apache.tapestry.internal.services.TemplateParserImpl
> >>
> >> Cheers,
> >> Nick.
> >>
> >>
> >> Josh Canfield wrote:
> >>> This has been mentioned as a bug in this list, search for *T5: XML
> >>> declaration is missing from rendered page. Any workrounds?*
> >>>
> >>> While I haven't tried this, I imagine that you could create
> >>> components to
> >>> work around this for now using MarkupWriter.writeRaw(). Or possibly
> >>> use the
> >>> OutputRaw component.
> >>>
> >>>
> http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/corelib/components/OutputRaw.html
> >>>
> >>>
> >>>
> >>> Josh
> >>>
> >>> On 8/30/07, Fernando Padilla <fern@alum.mit.edu> wrote:
> >>>> Hi.  We are going to be writing a facebook application, and we want
> to
> >>>> use Tapestry 5.  To do so, we have to generate FBML:
> >>>> http://wiki.developers.facebook.com/index.php/FBML
> >>>>
> >>>> We came hit a pretty big snag, in that it doesn't look like tapestry
> 5
> >>>> support namespaces/prefixes.  Below you see the tapestry template we
> >>>> are
> >>>> using, and you see the output below it.  And we need all of the "fb:"
> >>>> prefixes to stay there, as well as the "xmlns:fb" declaration.
> >>>>
> >>>> Do you have any ideas?  I know I can probably create a component for
> >>>> each element, but that would just be a big unmaintainable pain (
> there
> >>>> are like 50 right now and the FBML language changes ).. Or is there
a
> >>>> simpler way to maintain lots of mostly the same components :(
> >>>>
> >>>> Any other ideas?
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> <fb:fbml xmlns:t="
> http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"
> >>>> xmlns:fb="http://apps.facebook.com/ns/1.0">
> >>>>        <h1>Welcome</h1>
> >>>>         <p>Just to prove this is live: </p>
> >>>>        <p> The current time is: ${currentTime}. </p>
> >>>>        <fb:name uid="1305604"/>
> >>>>        <span>[<t:pagelink t:page="Start">refresh</t:pagelink>]</span>
> >>>> </fb:fbml>
> >>>>
> >>>>
> >>>> <fbml>
> >>>>        <h1>Welcome</h1>
> >>>>         <p>Just to prove this is live: </p>
> >>>>        <p> The current time is: Thu Aug 30 13:43:19 PDT 2007.
</p>
> >>>>        <name uid="1305604"></name>
> >>>>        <span>[<a href="/fandom/start"
> id="pagelink">refresh</a>]</span>
> >>>> </fbml>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >>>> For additional commands, e-mail: users-help@tapestry.apache.org
> >>>>
> >>>>
> >>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: dev-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message