using xsl to filter out xml data

M

mank

Our back-end service(web service) returns resultset data in xml format.
It returns around 2000 records of data. Our java program performs some
business logic (mostly if else statements) to filter out that data and
narrow down the resultset to 30 records.
We use Castor to convert xml to java. So we get 2000 java objects from
every web service call and then filter it out to 30 objects and send
30 objects to the web page. We think that creation of 2000 objects
everytime is a big overhead. is there any way to reduce this
overhead???
Some people say that If use XSL and put business rules into XSL and let
XSL parse XML to filter out the unwanted records, then we will be saved
of the overhead of unecessary java objects.. IS it right? How to do
that?
 
T

TechBookReport

mank said:
Our back-end service(web service) returns resultset data in xml format.
It returns around 2000 records of data. Our java program performs some
business logic (mostly if else statements) to filter out that data and
narrow down the resultset to 30 records.
We use Castor to convert xml to java. So we get 2000 java objects from
every web service call and then filter it out to 30 objects and send
30 objects to the web page. We think that creation of 2000 objects
everytime is a big overhead. is there any way to reduce this
overhead???
Some people say that If use XSL and put business rules into XSL and let
XSL parse XML to filter out the unwanted records, then we will be saved
of the overhead of unecessary java objects.. IS it right? How to do
that?
XSLT seems a common sense way to go, and is well supported in Java.
However for building the XSL I've found that prototyping using instant
Saxon (this is for a Windows platform), is a good way to (a) learn XSL
and (b) a good way to develop the XSL which can then be used in your
Java code.

Pan
===================================================================
TechBookReport Java: http://www.techbookreport.com/JavaIndex.html
 
A

Antti S. Brax

Our back-end service(web service) returns resultset data in xml format.
It returns around 2000 records of data. Our java program performs some
business logic (mostly if else statements) to filter out that data and
narrow down the resultset to 30 records.
We use Castor to convert xml to java. So we get 2000 java objects from
every web service call and then filter it out to 30 objects and send
30 objects to the web page. We think that creation of 2000 objects
everytime is a big overhead. is there any way to reduce this
overhead???
Some people say that If use XSL and put business rules into XSL and let
XSL parse XML to filter out the unwanted records, then we will be saved
of the overhead of unecessary java objects.. IS it right? How to do
that?

Those people failed to mention that XSL transformation also
creates Java objects (assuming you would be using an XSLT
implementation written in Java). They're just hidden behind
the API with which you transform the XML document. So you may
or may not get a performance gain from it.

Also, developing XSL transformations and especially debugging
them seems to be a terrible pain in the ass. If there are any
debugging tools for XSL available I would be very happy to
hear suggestions.

Still, XSL sounds like it has in your case the potential of
converting Java code to interpreted XSL documents. That is
usually always a good thing even if it causes a performance
hit. Even better if you can use XSL to format the XML into the
format in which it is sent to the web page.
 
M

Malte

mank said:
Our back-end service(web service) returns resultset data in xml format.
It returns around 2000 records of data. Our java program performs some
business logic (mostly if else statements) to filter out that data and
narrow down the resultset to 30 records.
We use Castor to convert xml to java. So we get 2000 java objects from
every web service call and then filter it out to 30 objects and send
30 objects to the web page. We think that creation of 2000 objects
everytime is a big overhead. is there any way to reduce this
overhead???
Some people say that If use XSL and put business rules into XSL and let
XSL parse XML to filter out the unwanted records, then we will be saved
of the overhead of unecessary java objects.. IS it right? How to do
that?

If at all possibly, I'd try to limit the resultset before parsing it,
Then I'd use XSL for the transformation, if still necessary.
I use OxygenXML which is not very costly to develop my XSL.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,835
Latest member
KetoRushACVBuy

Latest Threads

Top