Re: [xmlc] Headers and footers
Justin Akehurst <[email protected]> Thu, 1 Sep 2005 09:04:35 -0700
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format...
------------=_1125590715-4880-152
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
I'm also using DOM import to do this sort of functionality.
My source document (template.html) contains something like this:
<div id=3D"headerGoesHere">
<div class=3D"mockup">My header Goes Here</div>
</div>
My header document (header.html) contains this:
<div id=3D"header">
<div>The real header</div>
</div>
I can pull in the header so that the final result looks like so:
<div id=3D"headerGoesHere">
<div>The real header</div>
</div>
With this method:
protected void replace(XMLObject document, Node replaceNode, Node sourceNod=
e) {
Node parentNode =3D replaceNode.getParentNode();
if (sourceNode !=3D null) {
Node importedNode =3D document.importNode(sourceNode, true);
parentNode.replaceChild(importedNode, replaceNode);
}
}
via a call like so:
replace(templateXHTML, templateXHTML.getElementHeaderGoesHere(),
headerXHTML.getElementHeader());
-Justin
On 9/1/05, Erik Rasmussen <[email protected]> wrote:
>=20
> --- James Rochford <[email protected]> wrote:
> > I am currently using a dynamic header and footer.
> > My approach is a
> > little different but perhaps it will work for you.
> > I'm using a custom
> > framework but the premise is the same. All the
> > pages in our site are
> > passed to a handler that inspects the XMLObject for
> > a particular div in
> > this case <div id=3D"header">. Sort of a "post
> > processor" for the view
> > where content that is the same across all pages gets
> > added. Hope this
> > helps.
>=20
> Aha! My problem was that I thought that importNode()
> was a method on Document, so I was calling
> xmlObject.getDocument().importNode(), when I needed to
> be calling xmlObject.importNode().
>=20
> It's still not working 100% smoothly, but you've
> gotten me over that exception. Thanks!
>=20
> 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
>
------------=_1125590715-4880-152
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
------------=_1125590715-4880-152--