logo       

Re: [xmlc] Headers and footers: msg#00007

java.enhydra.xmlc

Subject: Re: [xmlc] Headers and footers

I'd like to see the Java code you have that exhibits the problem
described, with both header and footer being sucked into the dom
instead of just the header.

-Justin

On 9/1/05, Erik Rasmussen <i_am_erik@xxxxxxxxx> wrote:
>
> --- James Rochford <jrochford@xxxxxxxxx> wrote:
> > class RenderView{
> > // object that contains getters for the request
> > and response.
> > private HttpComs httpCom;
> > ...
> > public XMLCFactory getFactory(){
> > XMLCFactory factory =
> >
> XMLCContext.getContext(httpCom.getServlet()).getXMLCFactory();
> > return factory;
> > }
> >
> > public void drawheader(XMLObject returnHtml){
> > // Get the page containing the header and
> > footer.
> > headerFooterHTML headerFooter
> >
> =(headerFooterHTML)this.getFactory().create(headerFooterHTML.class);
> >
> > ...
> > Update the header content
> > ...
> >
> > // Get the node in the return html where I
> > want to insert the
> > header. Import the header node
> > // from the headerFooter. Append the node to
> > the <div
> > id="header"> element.
> > Node node =
> > returnHtml.getElementById("header");
> > if(node != null){
> > Node headerNode =
> >
> returnHtml.importNode(headerFooter.getElementHeader(),true);
> > node.appendChild(headerNode);
> > }
> >
> > XMLCContext xmlc =
> > XMLCContext.getContext(httpCom.getServlet());
> > OutputOptions outo =
> > xmlc.createOutputOptions(httpCom.getRequest(),
> > httpCom.getResponse(),returnHtml);
> > outo.setPrettyPrinting(true);
> > xmlc.writeDOM(httpCom.getRequest(),
> > httpCom.getResponse(),
> > outo ,returnHtml);
> > }
> > }
>
> When I do this, it's inserting the entire document
> starting from the specified div to the destination
> document. That's confusing. Let me show an
> example...
>
> My design.html: (the equiv of your headerFooter.html)
> ----
> <html>
> <head>
> <title>Design template</title>
> </head>
> <body>
> <div id="header">
> This is the header for <span id="siteName_1">Widgets
> R Us</span>.
> </div>
> <div id="footer">
> This is the footer for <span id="siteName_2">Widgets
> R Us</span>.
> </div>
> end of doc
> </body>
> </html>
> ----
>
> My page.html:
> ----
> <html>
> <head>
> <title>My page</title>
> </head>
> <body>
> <div id="header"></div>
> <div id="content>
> Page content here
> </div>
> <div id="footer"></div>
> </body>
> </html>
> ----
>
> When I appendChild() the header node from design.html
> to the header node of my page.html, what gets inserted
> is:
> ----
> <div id="header">
> This is the header for <span id="siteName_1">Widgets
> R Us</span>.
> </div>
> <div id="footer">
> This is the footer for <span id="siteName_2">Widgets
> R Us</span>.
> </div>
> end of doc
> ----
>
> Obviously, what I want it to insert would just be:
> ----
> <div id="header">
> This is the header for <span id="siteName_1">Widgets
> R Us</span>.
> </div>
> ----
> ...or even more ideal would be just the contents of
> the header div, but I can live with the div tags in
> there too.
>
> It doesn't just append the contents of the header div,
> it appends EVERYTHING after it. Ditto for footer.
> When I appendChild() the footer info, what gets
> inserted is:
> ----
> <div id="footer">
> This is the footer for <span id="siteName_2">Widgets
> R Us</span>.
> </div>
> end of doc
> ----
>
> I'm calling importNode() just like you are. I could
> get around this by having separate header.html and
> footer.html files, but gross! I must be doing
> something wrong. Apparently the "node" that you get
> back is really a pointer to the rest of the tree,
> including nodes at lower depths. How
> counter-intuitive!
>
> Any ideas?
>
> Thanks,
> Erik
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
>
>
>
>
> --
> You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx mailing
> list.
> To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx
> For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>


--
You receive this message as a subscriber of the xmlc@xxxxxxxxxxxxx mailing list.
To unsubscribe: mailto:xmlc-unsubscribe@xxxxxxxxxxxxx
For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise