logo       

Re: a though one: msg#00021

java.enhydra.general

Subject: Re: 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 {

        //tomo info de welcome1

       Welcome1HTML welcome = (Welcome1HTML)comms.xmlcFactory.create(Welcome1HTML.class);

       HTMLTableCellElement cellorigen = welcome.getElementCellInfo();

        //hacerle cambios a welcome FALTA

         //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


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

News | FAQ | advertise