Tenplates and subtree plugins
Richard Keene <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.xmlc |
|---|---|
| Message-ID | <[email protected]> |
I want to take one document called layout.html and another called body.html
and take the main contents node (a div with id='mainContents') and
remove it from the
instance of bodyHTML.class and replace the div in an instance of
layoutHTML.class
with the removed div.
I have code like....
layoutHTML L = new layoutHTML();
bodyHTML t = new bodyHTML();
// The div I want to replace.
HTMLElement centerMiddle = L.getElementCenterMiddle();
// The div I want to plug into the layoutHTML object.
HTMLElement indexMainContents = t.getElementMainContents();
bodyMainContents.getParentNode().removeChild(indexMainContents);
centerMiddle.appendChild(t.getElementMainContents());
It compiles and when I run it it says 'wrong document'
It appears that the indexMainContents retains the class id or something
of the
owning document t, and so when L goes to render it'sself to the browser
it recognizes that the nodes are from the wrong doc.
Any one know a solution?
What I need is a functions like
/** Removes elmToMove from it's document, and transplants it to
** the objectToMoveTo
**/
public void transplantElement( HTMLElement elmToMove, HTMLObject
objectToMoveTo) {
... What goes here? ...
}
I'm not sure i have all of the types correct in the function.
Now I can edit the body contents seperate from the template layout. The
sidebar can
come from one XMLC generated class, the top bar from another, and the
body from antoher.
This is straight forward templates.
If XMLC could handel fragment .html files that would make it even easier.
--
Richard Keene
801-647-8932
[email protected]