We are working on a system that will get xml feed (through webservice or some other means.. to be decided) and display the results on a browser.
The platform is weblogic 8.1.3, we need to decide on the xml libraries to be used for parsing and displaying of a data, though weblogic offers certain jars for xml based processing we are thinking something more open source would be helpful incase we need to move the code to a different platform.
We are considering apache xerces.jar (for parsing the xml data), with xslt and xalan.jar for the transformations to convert it into html?
What is the latest/best versions of these two?
What are the alternatives to xerces and xalan, if any?
The latest versions of Xerces and Xalan are at xml.apache.org.
Alternatives would be Suns Crimson for XML and Saxon (on SourceForge) for XSLT.
You'll probably be fine using the Weblogic parser, whichever it is. Just make sure that you code against the JAXP API (which is the Java XML/XSLT/DOM/SAX processing API), and not against classes that may be specific to a particular parser. Then you should have no problems moving your code to use some other parser, because they all support JAXP.
Ping & DNS - updated with new look and Ping home screen widget
Joined: Oct 25, 2005
Ulf, Thanks for your response.
I am able to read xml, apply xsl and convert it to html. I have included the code below.
Couple of notes on the same:
1. I am creating a new StreamReader from string to pass to transform method, not sure if this is the most efficient way?
2. Rather than write to file, need to return the transform output as a String.
3. I can possibly optimize the xslSource by creating it only once, since this method will be called multiple times, sometimes possibly in a concurrent manner?
Joined: Mar 22, 2005
#1) You could use a BufferedReader instead, but since all data is in memory already, I wouldn't expect a noticeable difference.
#3) Check out javax.xml.transform.Templates (use TransformerFactory.newTemplates instead of TransformerFactory.newTransformer). It facilitates caching of XSLT transformations, and also guarantees thread-safety. [ October 26, 2005: Message edited by: Ulf Dittmer ]
Joined: Oct 25, 2005
Thanks for your suggestions.
Here is the modified code(for anyone interested):
Not to prolong this thread, what if i use a JDOMSource instead of streamsource will it help the performance? Since the calling program has the liberty of passing either xml-string of jdom source.