xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Nils_Kilden-Pedersen AT Countrywide.Com
- To: "xom-interest" <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] javascript
- Date: Fri, 6 May 2005 10:22:29 -0700
xom-interest-bounces AT lists.ibiblio.org wrote on 05/06/2005 04:30:25 AM:
>
> I need to programmatically add a bit of JavaScript to an XML file, so I
did:
>
> Element script = new Element("script",
> "http://www.w3.org/1999/xhtml");
> String js_script = "\n function resize_all_pix() {\n";
> js_script += " max_width = "+width_int+";\n";
> js_script += " for(i=0;document.images.length > i;i++) {\n";
> js_script += " if (max_width < document.images[i].width )
{\n";
> js_script += " heigth = document.images[i].height;\n";
> js_script += " new_heigth = heigth *
> (max_width/document.images[i].width);\n";
> js_script += " document.images[i].width = max_width;\n";
> js_script += " document.images[i].heigth = new_heigth;\n";
> js_script += " }\n";
> js_script += " }\n";
> js_script += "}\n";
> Text js_text = new Text(js_script);
> script.appendChild(js_text);
I hope I never have to maintain code like this. Are you really sure this
is the best way to solve your problem? Almost anything would be better
than this. JSP, XSLT, or even Velocity. Imagine having to maintain the
Javascript code inside those strings.
Also, even though the compiler uses StringBuffer internally, isn't it
still considered bad form to concatenate strings like that?
Oh well, why should I care? :-)
Nils
>From jcowan AT reutershealth.com Fri May 6 13:36:34 2005
Return-Path: <jcowan AT reutershealth.com>
X-Original-To: xom-interest AT lists.ibiblio.org
Delivered-To: xom-interest AT lists.ibiblio.org
Received: from mail.reutershealth.com (unknown [65.246.141.36])
by lists.ibiblio.org (Postfix) with ESMTP id 1EA384C00B
for <xom-interest AT lists.ibiblio.org>;
Fri, 6 May 2005 13:36:34 -0400 (EDT)
Received: from skunk.reutershealth.com (mail [65.246.141.36])
by mail.reutershealth.com (8.13.1/8.13.1) with SMTP id
j46HaVvv001294;
Fri, 6 May 2005 13:36:32 -0400 (EDT)
Received: by skunk.reutershealth.com (sSMTP sendmail emulation);
Fri, 6 May 2005 13:36:16 -0400
Date: Fri, 6 May 2005 13:36:15 -0400
From: John Cowan <jcowan AT reutershealth.com>
To: Luca Passani <passani AT eunet.no>
Subject: Re: [XOM-interest] javascript
Message-ID: <20050506173615.GU19734 AT skunk.reutershealth.com>
References: <427B5551.2080104 AT eunet.no>
<20050506132006.GA27781 AT skunk.reutershealth.com>
<427B7300.60303 AT eunet.no>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <427B7300.60303 AT eunet.no>
User-Agent: Mutt/1.4.1i
Cc: xom-interest AT lists.ibiblio.org
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: xom-interest.lists.ibiblio.org
List-Unsubscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Fri, 06 May 2005 17:36:34 -0000
Luca Passani scripsit:
> BTW TagSoup rocks, but I am noticing that it's not doing too well with
> long lists of JavaScript...
> do I need to submit a bug report of some kind?
Try to strip it down to the smallest possible example that exposes the bug,
and then post it to tagsoup-friends AT yahoogroups.com (signup required;
send a blank mail to tagsoup-friends-subscribe AT yahoogroups.com first).
--
Her he asked if O'Hare Doctor tidings sent from far John Cowan
coast and she with grameful sigh him answered that www.ccil.org/~cowan
O'Hare Doctor in heaven was. Sad was the man that word www.reutershealth.com
to hear that him so heavied in bowels ruthful. All
jcowan AT reutershealth.com
she there told him, ruing death for friend so young,
algate sore unwilling God's rightwiseness to withsay. Ulysses, "Oxen"
-
Re: [XOM-interest] javascript
, (continued)
-
Re: [XOM-interest] javascript,
Adam Constabaris, 05/06/2005
- Re: [XOM-interest] javascript, Luca Passani, 05/06/2005
-
Re: [XOM-interest] javascript,
Luca Passani, 05/06/2005
- Re: [XOM-interest] javascript, Elliotte Harold, 05/06/2005
-
Re: [XOM-interest] javascript,
Elliotte Harold, 05/06/2005
-
Message not available
- Re: [XOM-interest] javascript, Elliotte Harold, 05/06/2005
-
Message not available
-
Re: [XOM-interest] javascript,
Adam Constabaris, 05/06/2005
-
Message not available
-
Re: [XOM-interest] javascript,
Luca Passani, 05/06/2005
-
Re: [XOM-interest] javascript,
Elliotte Harold, 05/06/2005
-
Re: [XOM-interest] javascript,
Luca Passani, 05/06/2005
- Re: [XOM-interest] javascript, Elliotte Harold, 05/06/2005
-
Re: [XOM-interest] javascript,
Luca Passani, 05/06/2005
-
Re: [XOM-interest] javascript,
Elliotte Harold, 05/06/2005
-
Re: [XOM-interest] javascript,
Luca Passani, 05/06/2005
-
Re: [XOM-interest] javascript,
Nils_Kilden-Pedersen, 05/06/2005
- Re: [XOM-interest] javascript, Luca Passani, 05/06/2005
- Re: [XOM-interest] javascript, Luca Passani, 05/06/2005
- RE: [XOM-interest] javascript, Jacobs, Robert A., 05/06/2005
- RE: [XOM-interest] javascript, Mustard, Sandy, 05/06/2005
Archive powered by MHonArc 2.6.24.