I can only think of two ways to achieve common headers
and footers on a web page generated with XMLC, and
neither works:
1) The built-in SSI mechanism. This will load in a
header.html and footer.html into the top and bottom of
your web page wherever you put the SSI directives
BEFORE running the XMLC interface generation. So lets
say I have index.html and products.html, and I have a
<span id="siteName">site</span> in my header.html that
both index.html and products.html include. So I'll
get interfaces indexHTML and productsHTML, both of
which will have a method setTextSiteName(). But
because they don't extend a common interface with that
method, my code to set the site name has to use
reflection to call the setTextSiteName() method. That
sucks.
2) DOM import. Say I make a file called template.html
that contains my header and footer information in it,
and has a <div id="content"> in the middle of it where
I want my page content to go. I can set my dynamic
header content with my templateHTML interface, and I
can set my dynamic page content with my productsHTML
interface. And then I can say:
Element contentDiv =
templateXmlObj.getElementContent();
Node migratedContent =
contentDiv.getDocument().importNode(productsXmlObj,
true);
contentDiv.appendChild(migratedContent);
...and then just write the templateXmlObj to the
response with the content from the products page
inserted. Right? Wrong. Line 2 above throws a:
org.w3c.dom.DOMException: Node type being imported is
not supported
at
org.enhydra.apache.xerces.dom.CoreDocumentImpl.importNode(CoreDocumentImpl.java:1049)
at
org.enhydra.apache.xerces.dom.CoreDocumentImpl.importNode(CoreDocumentImpl.java:860)
So wtf? Surely someone has succeeded in creating a
webapp based on XMLC with common (and dynamic!) header
and footer code. What am I missing? Is there another
way?
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
|
|