Raj Sethi

Greenhorn
+ Follow
since Mar 11, 2001
Merit badge: grant badges
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Raj Sethi

Hi All
Is it possible to access windows specific APIs from an applet.
I have a requirement to download a applet in the browser and accedd some of the browser properties(something like VNC viewer )

Cheers
Raj
21 years ago
Hi All
Is it possible to access windows specific APIs from an applet.
I have a requirement to download a applet in the browser and accedd some of the browser properties(something like VNC viewer )

Cheers
Raj
21 years ago
Hi All
I have the following code
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
public class TestTransform
{

private static String RULES=
"<?xml version=\"1.0\"?>" +
"<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" version=\"1.0\">" +
" <xsl:template match=\"*\">" +
" <xsl:element name=\"{name()}\" >" +
" <xsl:call-template name=\"template-name\">" +
" </xsl:call-template>" +
" </xsl:element>" +
" </xsl:template> " +
"<xsl:template name =\"template-name\">" +
" <xsl aram name=\"first\">First </xsl aram>" +
" <xsl aram name=\"last\">Name </xsl aram>" +
" <xsl:value-of select=\"$first\"/>" +
" <xsl:value-of select=\"$last\"/>" +
"</xsl:template>" +
"</xsl:stylesheet>";
private static String SOURCE="<a>test</a>";
public static void main(String args[])
{
Source xmlsource = new StreamSource(new ByteArrayInputStream(SOURCE.getBytes()));
TransformerFactory factory = TransformerFactory.newInstance();
ByteArrayOutputStream result = new ByteArrayOutputStream();
Transformer transformer = null;
try
{
transformer = factory.newTransformer(new StreamSource(new ByteArrayInputStream(RULES.getBytes())));
transformer.setParameter("first","Raj");
System.out.println("get parameter first:" +transformer.getParameter("first"));
transformer.transform(xmlsource,new StreamResult(result));

System.out.println("output :"+result.toString());
}
catch (Exception e)
{
System.out.println("error "+e.getMessage());
}

}

}

The out put is FirstName instead of RajName //because I'm setting param first to Raj at //transformer.setParameter("first","Raj");
Where I am getting it wrong appreciate any help..

Originally posted by Raj Sethi:


Thanks Ajith,Daniel
I want to this task using java not XSl,I will give a try to cloneNode().
Has anyone familiar with importNode().what it does and how it does that would be good.

Originally posted by Daniel Olson:
Here is a link to an article called
Use XSLT to Merge XML Documents http://www.xmlmag.com/upload/free/features/xml/2001/06jun01/rj0103/rj0103.asp
Also there is another article in XML Developers Journal this month or last month that give three different ways to combine documents.


Hi
Has anyone got any tips to,combine two DOm document to one Document.I would appreciate your help.

Raj
Hi Thanks for your help..I tried your code it is the same ,may be I think my question was not clear ..
In my jsp page for downloading I'm NOT reading from any existing file,it dynamically generates data and WRITES to out object..
I think your code might work if it has to read from a file and write to out object ..corrrect me if I'm wrong .
could you pls. explain what is the purpose of using "pragma","expires" in header ..
Thanks again
Raj
21 years ago
Hi All,
I got it working able to download a text file from JSP page..My problem is :
when the download box pops up (Save/Open),it has got following funny lines..
--
You have choosen to download from this location submit.jsp(name of the jsp file) <url>
--
Instead of the jsp file name(submit.jsp) I want it to display the name of downloaded text file..
I using following setting thanks to prevous postes messages..
<%@ page contentType="application/octet-stream" buffer="216k" autoFlush="true" %>
response.setHeader("Content-Disposition","attachment;filename=\"BoralInvoice.txt\"");
Any help is highly appreciated
Raj
21 years ago
Hi
I have got a problem.
Description:
To show a jsp page (Number of text boxes and their size) depending on the rules which has to be stored in SOMEWHERE .
I don't have much exposure to XML .My understding if I use xml to store the rules it would be flexible don't know much ..

I would appreciate any suggestion

------------------
21 years ago