Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
How do we call java class from a component to access file with in TS
Nawin
Hi,
I am on TS 6.7.2 sp1 with LiveSite 3.o , I have this requirement: I need to pull data from a flat text file present under my current workarea, in to the .page file under the same workarea. So need to have a custom java class to have this
[font=Arial][size=2]functionality achieved
[/font]
.[/size]
Can any one guide me on these question:
1) Can we use custom java class to read the flat text file from the workarea.
2) How can we extend this java class with in the component XSLT code.
Since I did much programming using perl, my knowledge on java is very very less/ null.
Parallel, I am referring through the SP dev guide 6.7.2 on the externals and controllers.
Thanks in advance
Find more posts tagged with
Comments
sheikh1
Yes, you are going at right direction. You can use either External or Prefix tags to refer your custom java class which returns the Document object.
Your XSLT can be able to read the response which comes under
.
-cheers
Rick Poulin
Since I did much programming using perl, my knowledge on java is very very less/ null.
Don't be so hard on yourself; surely it's at least empty string.
...I'll see myself out.
Bowker
We had a similar requirement, but we don't have the luxury of adding Java classes (easily). Therefore we worked out a way to read a flat file into a string in XSL without using any externals.
The XSL provided below was written a number of years ago when we were just learning XSL. There may be a better way (I surely hope so). If you find a better way, please share with the class.
Note the default is to read a max of 100,000 lines from the flat file. See embedded comments to increase/override the limit.
[PHP]
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="
http://xml.apache.org/xalan"
xmlns:url="xalan://java.net.URL"
xmlns:conn="xalan://java.net.URLConnection"
xmlns:isr="xalan://java.io.InputStreamReader"
xmlns:br="xalan://java.io.BufferedReader"
exclude-result-prefixes="xalan url conn isr br"
>
buffered reader not ready
[/PHP]
sheikh1
Thanks for sharing xslt code. It is very intuitive. For me I still prefer to going by java file since it is so easy write and debug.
Cheers,