Re: [xmlc] Headers and footers

Justin Akehurst <[email protected]> Thu, 1 Sep 2005 09:40:59 -0700
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1125592900-4880-169
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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 <[email protected]> wrote:
>=20
> --- James Rochford <[email protected]> wrote:
> > class RenderView{
> >     // object that contains getters for the request
> > and response.
> >     private HttpComs httpCom;
> > ...
> >     public XMLCFactory getFactory(){
> >         XMLCFactory factory =3D
> >
> XMLCContext.getContext(httpCom.getServlet()).getXMLCFactory();
> >         return factory;
> >     }
> >
> > public void drawheader(XMLObject returnHtml){
> >         // Get the page containing the header and
> > footer.
> >         headerFooterHTML headerFooter
> >
> =3D(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=3D"header"> element.
> >         Node node =3D
> > returnHtml.getElementById("header");
> >         if(node !=3D null){
> >             Node headerNode =3D
> >
> returnHtml.importNode(headerFooter.getElementHeader(),true);
> >             node.appendChild(headerNode);
> >         }
> >
> >             XMLCContext xmlc =3D
> > XMLCContext.getContext(httpCom.getServlet());
> >             OutputOptions outo =3D
> > xmlc.createOutputOptions(httpCom.getRequest(),
> > httpCom.getResponse(),returnHtml);
> >             outo.setPrettyPrinting(true);
> >             xmlc.writeDOM(httpCom.getRequest(),
> > httpCom.getResponse(),
> > outo ,returnHtml);
> >  }
> > }
>=20
> 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...
>=20
> My design.html: (the equiv of your headerFooter.html)
> ----
> <html>
> <head>
>         <title>Design template</title>
> </head>
> <body>
> <div id=3D"header">
>         This is the header for <span id=3D"siteName_1">Widgets
> R Us</span>.
> </div>
> <div id=3D"footer">
>         This is the footer for <span id=3D"siteName_2">Widgets
> R Us</span>.
> </div>
> end of doc
> </body>
> </html>
> ----
>=20
> My page.html:
> ----
> <html>
> <head>
>         <title>My page</title>
> </head>
> <body>
> <div id=3D"header"></div>
> <div id=3D"content>
>   Page content here
> </div>
> <div id=3D"footer"></div>
> </body>
> </html>
> ----
>=20
> When I appendChild() the header node from design.html
> to the header node of my page.html, what gets inserted
> is:
> ----
> <div id=3D"header">
>         This is the header for <span id=3D"siteName_1">Widgets
> R Us</span>.
> </div>
> <div id=3D"footer">
>         This is the footer for <span id=3D"siteName_2">Widgets
> R Us</span>.
> </div>
> end of doc
> ----
>=20
> Obviously, what I want it to insert would just be:
> ----
> <div id=3D"header">
>         This is the header for <span id=3D"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.
>=20
> 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=3D"footer">
>         This is the footer for <span id=3D"siteName_2">Widgets
> R Us</span>.
> </div>
> end of doc
> ----
>=20
> 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!
>=20
> Any ideas?
>=20
> Thanks,
> Erik
>=20
>=20
>=20
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>=20
>=20
>=20
>=20
>=20
> --
> You receive this message as a subscriber of the [email protected] mailin=
g list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=3Dhelp
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>=20
>=20
>


------------=_1125592900-4880-169
Content-Type: text/plain; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: 8bit


--
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws

------------=_1125592900-4880-169--