logo       

RE: a though one: msg#00028

java.enhydra.general

Subject: RE: a though one

Hi Camila,
If you put "id" tags in the ssi, then you can modify those portions of your
document, just the same as if it was one single file. For example if you had a
banner.ssi included in your doc, the banner.ssi could have a <span
id="UserName">Mike</span>. You could then simply use the normal
page.setTextUserName("Camila")..

Or if you want to choose from a few diffent blocks of content you can remove
the ones you don't want, and keep the one you want. For example I have a
single html document where I need to choose from 4 or 5 different tables.
<table id="Type1Table">
<table id="Type2Table">
<table id="Type3Table">
etc.

At run time, I removeChild() all the tables I do not want, but keep the one(s)
I need.


If you have many,many fragments that you want to choose from, it might be more
practical to have seperate documents, and use importNode() to move nodes from
one Document to another.

It depends on your application, and requirements.

Hope this helps,
Mike.





-----Original Message-----
From: Camila Piñeiro [mailto:camila@xxxxxxxxxxxx]
Sent: Thursday, February 06, 2003 4:29 AM
To: enhydra@xxxxxxxxxxx
Subject: RE: Enhydra: 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


_______________________________________________
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