Thanks for the response!
I think I'll just parse the whole XML file and search for whatever is required!!
------------- Original Message --------------
Joshua Allen <[log in to unmask]> wrote:
To:"[log in to unmask]" <[log in to unmask]>,
[log in to unmask], [log in to unmask]
From:Joshua Allen <[log in to unmask]>
Date:Sat, 30 Sep 2000 16:15:49 -0700
Subject: RE: Passing parameters to xsl from jsp
I'm not an expert, but some things to consider:
* Are you sure you need XSLT for this? It seems that you could just store
the DOM and call an XPath query against the DOM. In that case you would
simply need to capture the query from the post in JSP and use that to
construct your XPath query.
* A DOM loaded into memory is very much like a hashtable or dictionary
object that you might use for similar purposes. Keep in mind that a
hashtable, dictionary, or DOM (all of which would let you quickly look for a
particular piece of data very quickly) will all eat up a large chunk of RAM.
In fact, even if you were thinking of some way that XSLT can help you, most
XSLT processors (including Apache Xalan AFAIK) will load the full file in
memory when processing. So I guess what I am saying is that if you are
going to have to represent the entire data structure in-memory anyway, you
should be careful that you are not using XML "just because". Other
in-memory structures may be more efficient.
* If, however, you are more interested in using this as a database in the
more traditional sense, and do not wish to have the entire XML document
loaded into RAM constantly, you could think about another approach. One
simple technique is to use some abstraction layer that maps between
relational and XML data. Of course, you would need to run some relational
database software on your box, and if you are going the open-source route I
am not an expert on what mapping tools exist. I bet there is something that
works well with postgres, and of course you could download DB2 or Oracle,
which both have XML adapters.
* Now if your query requirements are simple and not as rich as a full
relational database allows, and you *still* do not want to read the whole
file into memory, I can think of some options. First, you could check the
SAX API. I am pretty sure you get that with Xerces, and undoubtedly you can
get it *somewhere* free. Otherwise, try grep :-)
> -----Original Message-----
> From: Priya Pinto [mailto:[log in to unmask]]
> Sent: Friday, September 29, 2000 11:38 PM
> To: [log in to unmask]; [log in to unmask];
> [log in to unmask]
> Subject: Passing parameters to xsl from jsp
> I'm using an XML file as database and I need to be able to
> search for a particular text node in it based on the users
> search input.
> Ideas to proceed
> 1) When the user enters the search phrase and clicks on
> search, call a jsp which takes the input and then calls the
> respective file with another xsl (how do I do this? do I
> parse the file and rewrite it with a diff xsl?)where the
> value is passed as a parameter and it displays only that set of nodes.
> 2)When the user enters the search phrase and clicks on
> search, I use a jsp file to accept the parameter and then
> call the xml file parse it and extract the nodes required and
> display it on the screen.
> Do tell me which is a better option and how to go about it?
> Or if there is any better way to go about this?
> I'm working on a Linux platform, with Apache, Tomcat, JSP, XML.
> Get Your Free Email At, http://www.rediffmail.com
> For fabulous shopping deals visit:
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Get Your Free Email At, http://www.rediffmail.com
For fabulous shopping deals visit: http://www.rediff.co.in/shopping/index.html