logo       

RE: a though one: msg#00026

java.enhydra.general

Subject: RE: a though one

Thanks Scott and Mike, I'll try it.
But Mike, the "template" I want to use needs to be dynamically modified
too. Could the HTML fragment in the .ssi be dynamically modified too?
Thanks again,
Camila

----- Original Message -----
From: Mike Warne <mike.warne@xxxxxxxxxx>
To: <enhydra@xxxxxxxxxxx>
Sent: Wednesday, February 05, 2003 5:36 PM
Subject: RE: Enhydra: a though one


As Scott mentioned you need to use importNode()..

Another option that may or may not be useful for you is to use XMLC's
compile-time includes..
This is very similar to Server-Side Includes that are supported by many web
servers..

So in your html you can do things like..
<!--#include virtual="../media/OurBanner.ssi"-->

OurBanner.ssi is HTML fragment that will be inserted into your html file as
it is being compiled. The common html will be compiled-in when you run the
XMLC compiler.
I don't know if HTML editors support the ssi tags though, so if you preview
the files in your browser, or editor you may not see how the entire page
will look..

I haven't actually used this, but others have used it.
The main advantage for you would less coding & importing of nodes, and less
application overhead.

Mike.



-----Original Message-----
From: Scott Dietrich [mailto:sdietrich@xxxxxxxxx]
Sent: Wednesday, February 05, 2003 1:13 PM
To: enhydra@xxxxxxxxxxx
Subject: Re: Enhydra: a though one


On Wednesday, February 5, 2003, at 06:32 PM, Camila Piñeiro wrote:
> Hi all!
>
> I have a though question, but I’m sure somebody has done it before.
>
> I want to have something like a template for all my HttpPresentation
> classes, and that way I could have in only once place the design of
> all my pages –is the same for all- and just add what it is specific
> for an specific HttpPresentation class.
>
> Here follows the code of something that I tried and got me the error
> “DOM005 Wrong document”
>
> public void run(HttpPresentationComms comms)
>
> throws HttpPresentationException, IOException {
>
> file://tomo info de welcome1
>
> Welcome1HTML welcome =
> (Welcome1HTML)comms.xmlcFactory.create(Welcome1HTML.class);
>
> HTMLTableCellElement cellorigen = welcome.getElementCellInfo();
>
> file://hacerle cambios a welcome FALTA
>
> file://tomo base
>
> baseHTML base =
> (baseHTML)comms.xmlcFactory.create(baseHTML.class);
>
> HTMLTableCellElement celldestino = base.getElementCellInfo();
>
> try {
>
> Node hijo = cellorigen.getFirstChild();
>
> celldestino.appendChild(hijo.cloneNode(true));
>
> } catch(Exception e) {
>
> System.out.println(e.getMessage()); }
>
> byte[] buffer = base.toDocument().getBytes();
>
> comms.response.setContentType( "text/html" );
>
> comms.response.setContentLength( buffer.length );
>
> HttpPresentationOutputStream out =
> comms.response.getOutputStream();
>
> out.write(buffer);
>
> out.flush();
>
> }
>
> What I trying to do is to append a child (from one <td>) with the
> specific information related with Welcome1 to the base or template
> html (to another <td>).
>
> Can you tell me what I´m doing wrong? Is there a better way to do it
> that you know? I accept any suggestions, clues, ….
>
> Camila

Hi,

Take a look at Document.importNode(), you need to import the node from
WelcomeHTML into BaseHTML before adding it to BaseHTML's DOM, something
like:

celldestino.appendChild(celldestino.getOwnerDocument().importNode(hijo,
true));

Scott


_______________________________________________
Enhydra mailing list
Enhydra@xxxxxxxxxxx
http://www.enhydra.org/mailman/listinfo.cgi/enhydra

_______________________________________________
Enhydra mailing list
Enhydra@xxxxxxxxxxx
http://www.enhydra.org/mailman/listinfo.cgi/enhydra


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise