OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [xml-dev] efficient xml programming technique





> -----Original Message-----
> From: Haresh Gujarathi [mailto:gharesh@vsnl.com]
> Sent: 26 September 2001 17:15
> To: Xml-Dev
> Subject: [xml-dev] efficient xml programming technique
>
>
[...]
> a.
> I am little concerned since for each request the DOMParser object
> is created and DOM processing is done.
> (Well certain cases I can use SAX. But for time being let's assume, that I
> must use DOM)

Are you sure that creating the DOMParser is really eating up much
resources/slow to do? I'd suspect most of the resource allocation is
going into the DOM tree which you'll probably end up throwing away
anyway even if you do cache parsers.

In a previous application I did reuse parsers between requests (xml4j)
but found that the parser didn't recover properly from parse
exceptions (led to some interesting errors), so I ended up re-creating the
parser each request. Didn't seem to add much overhead.

> b. In the same application I have another scenario;
> In the JSP files I use xalan transformer object to perform XSL
> transformation on certain xml data.  Now this happens for each
> JSP request.
>
> Is this a normal practice?
>
> how can this be made efficient/less memory foot print/less runtime memory
> usage ?

Cache the transforms, and where possible the XML data. e.g. JAXP
Templates.

Basically reduce the amount of parsing you have to do for each request,
be that for a stylesheet, or the data you're transforming.

HtH,

L.


--
Leigh Dodds, Research Group, ingenta | "Pluralitas non est ponenda
http://weblogs.userland.com/eclectic |    sine necessitate"
http://www.xml.com/pub/xmldeviant    |     -- William of Ockham