logo       

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

java.enhydra.xmlc

Subject: Re: [xmlc] Headers and footers

I'm also using DOM import to do this sort of functionality.

My source document (template.html) contains something like this:
<div id="headerGoesHere">
<div class="mockup">My header Goes Here</div>
</div>

My header document (header.html) contains this:

<div id="header">
<div>The real header</div>
</div>

I can pull in the header so that the final result looks like so:
<div id="headerGoesHere">
<div>The real header</div>
</div>

With this method:

protected void replace(XMLObject document, Node replaceNode, Node sourceNode) {
Node parentNode = replaceNode.getParentNode();
if (sourceNode != null) {
Node importedNode = 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 <i_am_erik@xxxxxxxxx> wrote:
>
> --- James Rochford <jrochford@xxxxxxxxx> 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="header">. Sort of a "post
> > processor" for the view
> > where content that is the same across all pages gets
> > added. Hope this
> > helps.
>
> 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().
>
> It's still not working 100% smoothly, but you've
> gotten me over that exception. 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