Converting objects into Strings

How would someone convert an object of say (String, int, double, String) into a readable string. I tried the toString() method but all I get is something like this
Student@1f12c4e

..I'm not sure I understand "how" to override. The whole point of this project is to use quicksort on a list of students, unfortunately all I get is the address whenever I use the .toStrings() method.
Here's what I have, any help would be greatly appreciated-so very close
import cs1.Keyboard;
import java.io.*;
import java.util.*;
public class StudentTraverse
public static void main(String[] args)
String newName;
int newSocial;
double newGPAs;
String newMajors;
System.out.println("How many Students would you like to add");
Student newStudent;
StudentList12 WORK = new StudentList12();
int total = Keyboard.readInt();
for(int number = total; number > 0; number--)
System.out.println("Name?");
newName = Keyboard.readString();
System.out.println("Social?");
newSocial = Keyboard.readInt();
System.out.println("GPA?");
newGPAs = Keyboard.readDouble();
System.out.println("Major?");
newMajors = Keyboard.readString();
newStudent = new Student(newName, newSocial, newGPAs, newMajors);
System.out.println("Inserting: "+newStudent.toString());
WORK.add(newStudent);
for(total = 0; total < WORK.size(); total++)
System.out.println("top" total": "+WORK.top(total).toString());
try
BufferedReader in = new BufferedReader(new FileReader("LIST.out"));
while (in.ready())
// Print file line to scree
System.out.println (in.readLine());
in.close();
catch (Exception e)
System.err.println("File input error");
public class StudentNode
public Student student;
public StudentNode next;
public StudentNode()
next = null;
student = null;
public StudentNode(Student d, StudentNode n)
student = d;
next = n;
public void setNext(StudentNode n)
next = n;
public void setData(Student d)
data = d;
public StudentNode getNext()
return next;
public Student getData()
return data;
public String toString()
return ""+data;
public StudentNode(Student newStudent)
METHOD NAME: StudentNode
AUTHOR:
DATE OF CREATION: Nov 20, 2004
DATE OF UPDATES: Nov 28, 2004
PURPOSE: Acts as a node for the Student list
ALGORITHM:Acts as node for the list
INSTANCE VARIABLES: none
student = newStudent;
next = null;
public class Student
private String name;
private int social;
private double GPA;
private String Major;
public Student(String newName, int newSocial, double newGPAs, String newMajors)
METHOD NAME: Student
AUTHOR:
DATE OF CREATION: Nov 20, 2004
DATE OF UPDATES: Nov 28, 2004
PURPOSE: The actual Student class, determines what is allowed in the array
ALGORITHM:Declare what variables will be needed for the program
INSTANCE VARIABLES: String name, int social, double GPA, String Major
name = newName;
social = newSocial;
GPA = newGPAs;
Major = newMajors;
import java.io.*;
import cs1.Keyboard;
import java.io.BufferedWriter;
import java.util.*;
public class StudentList12
private StudentNode list;
static int i = 0;
public StudentList12()
METHOD NAME: StudentList12
AUTHOR:
DATE OF CREATION: Nov 20, 2004
DATE OF UPDATES: Nov 28, 2004
PURPOSE: Declares the Node
ALGORITHM:Declare the Node
INSTANCE VARIABLES: none
list = null;
public boolean isEmpty()
return list == null;
public int size()
return i;
public void add(Student newStudent)
METHOD NAME: add
AUTHOR:
DATE OF CREATION: Nov 20, 2004
DATE OF UPDATES: Nov 28, 2004
PURPOSE: Let's users add objects to the array of objects
ALGORITHM:Traverses the current list and adds object to the end
INSTANCE VARIABLES: none
list = new StudentNode(newStudent, list);
i++;
current = current.next;
current.next = node;
public Student remove()
if(isEmpty())
return null;
StudentNode tmp = list;
list = tmp.getNext();
i--;
return tmp.getData();
public void insertEnd(Student newStudent)
if(isEmpty())
add(newStudent);
else
StudentNode t = list;
while(t.getNext() != null)
t=t.getNext();
StudentNode tmp = new StudentNode(newStudent, t.getNext());
t.setNext(tmp);
i++;
public Student removeEnd()
if(isEmpty())
return null;
if(list.getNext() == null)
return remove();
StudentNode t = list;
while(t.getNext().getNext() != null)
t = t.getNext();
Student newStudent = t.getNext().getData();
t.setNext(t.getNext().getNext());
i--;
return newStudent;
public Student top(int n)
StudentNode t = list;
for(int i = 0; i <n && t != null; i++)
t = t.getNext();
return t.getData();
public void writeToFile(int n)
int z = n;
try
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
for(int counter = z; counter >= 0; counter--)
System.out.println(counter);
out.close();
catch(Exception e)
System.err.println("Couldn't Write File");
try
PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("LIST.out")));
out.write(list.toString());
out.close();
catch(Exception e)
System.err.println("Couldn't Write File");
}

Similar Messages

  • How to convert byte into string

    can any tell me how to convert byte into string
    when im an debugging thid code in eclipse it shows the result in integer format instead of string but in command prompt it is showing result in string format..........plz help
    package str;
    import java.io.*;
    public class Testfile {
    public static void main(String rags[])
    byte b[]=new byte[100];
    try{
    FileInputStream file=new FileInputStream("abc.txt");
    file.read(b,0,50);
    catch(Exception e)
         System.out.println("Exception is:"+e);
    System.out.println(b);
    String str=new String(b);
    System.out.println(str);
    }

    Namrata.Kakkar wrote:
    errors: count cannot be resolved and Unhandled exception type Unsupported Encoding Exception.
    If i write an integer value instead of "count" then Unhandled exception type Unsupported Encoding Exception error is left.This is elementary. You need to go back to [http://java.sun.com/docs/books/tutorial/|http://java.sun.com/docs/books/tutorial/] .

  • Convert  Objects into an XML Document? Possible?

    Hello,
    Is there a way to convert different objects into an XML File/Document
    If I create 10 objects and then I want to create an XML Document
    of these objects,is it possible to do this?
    Ajay

    Hello,
    Is there a way to convert different objects into an
    XML File/Document
    If I create 10 objects and then I want to create an
    XML Document
    of these objects,is it possible to do this?
    Ajayjust override the .toString() method...

  • Convert document into string with unicode

    I want to convert my document into string with all <,>,& to be converted into <, >, and &. When I am doing transformation, I am getting <,> etc.
    Can anybody suggest me how to do that.
    regards,
    Ranjan

    I don't know of any way to tell the parser to convert is for you, you'll have to replace the characters yourself after you got the string from the parser.
    Aviran
    http://www.aviransplace.com

  • Convert Table into string, No FM is working good for this

    Hi all,
    i want to convert a table into string, but while convert, i found out that the string has special lenght , and i am getting only some rows of the table  wihle converting, even if i am using concatinate, i got the same problem,
    please let me know if there is a way to convert all the table into string and not a littel bit of it.
    BR

    I remember that you were facing the problem with the below function module
    types:begin of ty_string,
          field1 type char1024,
          end of ty_string.
    data:it type table of ty_string.
    data:wa type ty_string.
    data:out type string,
    line type string,
    rest type string.
    do 100 times.
      do 1024 times.
        concatenate 'A' wa-field1 into wa-field1.
      enddo.
      append wa to it.
    enddo.
    call function 'CONVERT_TABLE_TO_STRING'
      exporting
        i_tabline_length = '1024'
      importing
        e_string         = out
      tables
        it_table         = it.
    For me the variable out holds 102400 characters.

  • Convert Inputstructure into String and store into DB2

    Hello All
    My requirement is I want to convert total input structure into string then stored into database single field as clob. Can anyone suggest me how will i retive input structor, is there any user defined function will i write or is there any inbuilt functionality in SAP PI. Plese suggest me
    Thanks&Regards,
    VenkatK

    Hi Swarup / Shamly
      My input structure is nearly 60 fields. Sample Structure
    <?xml version="1.0" encoding="utf-8"?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <SOAP-ENV:Body>
             <create xmlns="urn:MySoapServices">
                <PurchaseOrder>
                   <BuyerDetails>
                        <Organization>University of Washington</Organization>
                        <Authorized_Person>
                             <FisrtName>Cease</FisrtName>
                             <LastName>Wayne</LastName>
                        </Authorized_Person>
                        <Street>Savery Hall</Street>
                        <City>Seattle</City>
                        <State>Wa</State>
                        <Zip>98195</Zip>
                        <Contact_Numbers>
                                  <Phone>888-846-6638</Phone>
                                  <Fax>212-629-1158</Fax>
                        </Contact_Numbers>
                        <Email>hidekiu.washington.edu</Email>
                   </BuyerDetails>
                   <SupplierDetails>
                        <Organization>Thomas Industrial Network</Organization>
                        <Authorized_Person>
                             <FisrtName>Cease</FisrtName>
                             <LastName>Wayne</LastName>
                        </Authorized_Person>
                        <Street>5 Penn Plaza, 10th Floor</Street>
                        <City>New York</City>
                        <State>NY</State>
                        <Zip> 10001</Zip>
                        <Contact_Numbers>
                                  <Phone>888-846-6638</Phone>
                                  <Fax>212-629-1158</Fax>
                        </Contact_Numbers>
                   </SupplierDetails>
                   <PurchaseOrderInformation>
                        <Order_Number>4556</Order_Number>
                        <Order_Delivery_Date>10-10-2006</Order_Delivery_Date>
                        <PO_Type>Finished</PO_Type>
                        <status>PO sent</status>
                   </PurchaseOrderInformation>
                   <Address>
                        <Shipping_Address>
                             <Organisation>University of Washington</Organisation>
                        <Authorized_Person>
                             <FisrtName>Cease</FisrtName>
                             <LastName>Wayne</LastName>
                        </Authorized_Person>
                             <Street>Savery Hall</Street>
                             <City>Seattle</City>
                             <State>Wa</State>
                             <Zip>98195</Zip>
                             <Email>hidekiu.washington.edu</Email>
                        </Shipping_Address>
                        <Billing_Address>
                             <Organisation>University of Washington</Organisation>
                        <Authorized_Person>
                             <FisrtName>Cease</FisrtName>
                             <LastName>Wayne</LastName>
                        </Authorized_Person>
                             <Street>Savery Hall</Street>
                             <City>Seattle</City>
                             <State>Wa</State>
                             <Zip>98195</Zip>
                             <Email>hideki</Email>
                        </Billing_Address>
                   </Address>
                   <Payment_Terms>
                        <Purchase_Order>
                             <PO_Number>456</PO_Number>
                             <Payment_Type>Bank</Payment_Type>
                             <Payment_Type_PO>
                                  <Bank>
                                       <BankName>Citibank</BankName>
                                       <AccountNumber>654987456</AccountNumber>
                                       <BranchCode>564</BranchCode>
                                  </Bank>
                                  <Credit_Card>
                                       <Payment_Type_CC>VISA</Payment_Type_CC>
                                       <CC_Number>1234 4567 7890 0123</CC_Number>
                                       <CC_Expire_Date>10-12-2012</CC_Expire_Date>
                                  </Credit_Card>
                             </Payment_Type_PO>
                        </Purchase_Order>
                        <Currency>USD</Currency>
                   </Payment_Terms>
                   <Purchase_Items>
                        <Item>
                             <Part_Name>6 foot wide 5 foot high cabinet</Part_Name>
                             <Quantity>9</Quantity>
                             <Description>Cabinets of systems</Description>
                        </Item>
                        <Item>
                             <Part_Name>6 foot wide shelves</Part_Name>
                             <Quantity>6</Quantity>
                             <Description>Shelves for books</Description>
                           </Item>
                   </Purchase_Items>
              </PurchaseOrder>           
             </create>
          </SOAP-ENV:Body>
       </SOAP-ENV:Envelope>
               I need to store whole XML structure (Including  XML version) into Database single field as a clob. not  field values. Please help me out from this issue.

  • How convert integer into string

    Hi,
    I need to convert answer3 from double into String
    answer3 = Double.parseDouble(dij3)/(1 + Math.pow(( Double.parseDouble(tesside_luas_i) / Double.parseDouble(tesside_luas_j) ),0.5847));

    Now the integer value is string but why i cannot get valur from my servlet to my web page
    package net.mybizaid.isodms.servlet;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import net.mybizaid.isodms.*;
    public class SPLDataInputServlet extends HttpServlet {
         public void doPost (HttpServletRequest request, HttpServletResponse response)
         throws IOException, ServletException
    System.out.println( "******************** Calculation Servlet ******************" );
                   String dij     ;
                   String population_i ;
                   String population_j ;
                   String project_name = "";
                   String project_status = "";
                   double answer;
                   String handler = "";
                   String url                    = "";
                   double answer3;
                   String dij3 ="";
                   String tesside_luas_i ="";
                   String tesside_luas_j ="";
                   double answer2;
                   String dij2 ="";
                   String luas_i ="";
                   String luas_j ="";
                   String counter                    = "";
                   String i                                   = "";
                   handler                          = request.getParameter( "handler" );
                   dij                    = request.getParameter("dij");
                   population_i               = request.getParameter("population_i");
                   population_j               =     request.getParameter( "population_j");
                   project_name               =     request.getParameter( "project_name");
                   project_status               =     request.getParameter( "project_status");
                   dij2                    = request.getParameter("dij2");
                   luas_i               = request.getParameter("luas_i");
                   luas_j               =     request.getParameter( "luas_j");
                   dij3                    = request.getParameter("dij3");
                   tesside_luas_i               = request.getParameter("tesside_luas_i");
                   tesside_luas_j               =     request.getParameter( "tesside_luas_j");
                   HttpSession session = null;
                   session = request.getSession(true);
                   int cnt = counter != null && !counter.equals("") ? Integer.parseInt(counter) : 0;
                   int ii = i != null && !i.equals("") ? Integer.parseInt(i) : 0;
    //Tesside
    if (handler != null && !handler.equals( "" ) && handler.equals( "cal3" ))
                   try
    System.out.println("The DIJ3 value is :"+dij3);
    System.out.println("The tesside_luas_i value is :"+tesside_luas_i);
    System.out.println("The tesside_luas_j value is :"+tesside_luas_j);
                        answer3 = Double.parseDouble(dij3)/(1 + Math.pow(( Double.parseDouble(tesside_luas_i) / Double.parseDouble(tesside_luas_j) ),0.5847));
                        String str = String.valueOf( answer3 );
    System.out.println("The answer value is :"+str);
                         url = "/jsp/model/tessideAnswer.jsp";
                         dispatchErrorMsg( request, response, url, "" );
              catch (Exception e)
                        request.setAttribute("pd.errorMessage", e.getMessage());
                        dispatchErrorMsg( request, response, "/jsp/Error.jsp", e.getMessage() );
    //PotensiPasaran
    if (handler != null && !handler.equals( "" ) && handler.equals( "cal2" ))
                   try
    System.out.println("The DIJ2 value is :"+dij2);
    System.out.println("The luas_i value is :"+luas_i);
    System.out.println("The luas_j value is :"+luas_j);
                        answer2 = Double.parseDouble(dij2)/(1 + Math.sqrt(( Double.parseDouble(luas_i) / Double.parseDouble(luas_j) )));
    System.out.println("The answer value is :"+answer2);
                         url = "/jsp/model/potensiPasaranAnswer.jsp";
                         dispatchErrorMsg( request, response, url, "" );
              catch (Exception e)
                        request.setAttribute("pd.errorMessage", e.getMessage());
                        dispatchErrorMsg( request, response, "/jsp/Error.jsp", e.getMessage() );
    //Reilly
         if (handler != null && !handler.equals( "" ) && handler.equals( "add" ))
                   try
                        System.out.println("The DIJ value is :"+dij);
                        System.out.println("The population_i value is :"+population_i);
                        System.out.println("The population_j value is :"+population_j);
                        answer = Double.parseDouble(dij)/(1 + Math.sqrt(( Double.parseDouble(population_i) / Double.parseDouble(population_j) )));
    System.out.println("The answer value is :"+answer);
                         url = "/jsp/model/reillyAnswer.jsp";
                         dispatchErrorMsg( request, response, url, "" );
              catch (Exception e)
                        request.setAttribute("pd.errorMessage", e.getMessage());
                        dispatchErrorMsg( request, response, "/jsp/Error.jsp", e.getMessage() );
         public void doGet (HttpServletRequest request, HttpServletResponse response)
         throws IOException, ServletException
              doPost(request, response);
         }//end doGet
         public void dispatchErrorMsg(HttpServletRequest req, HttpServletResponse res,
                                                           String target, String message)
              try
                   RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(target);
                   req.setAttribute("eshop.ErrMessage",message);
                   dispatcher.forward(req, res);
              catch (Exception e)
                   System.err.println( e.getMessage() );
    }//end class

  • Converting the scanner object into string object....

    Hello everyone. I've finished my hw and one thing made me curious about it. I hope you can help me. Now, I've tried to make this code in NetBeans IDE 6.0:
    Scanner src = new Scanner(System.in);
    String s = src.toString().toLowerCase(Turkish /* locale thing*/);
    My purpose is to take users entries to console as string and than make the letters in lower case. But, my language is turkish. So I've problem with it because there is no Locale Turkish object in IDE.
    So what do you suggest. Do you know a downloadable or updatable solution for this. Or if you're sure that there is no prepared solution, what do you suggest.

    I've looked that page but I've found some of the answers at http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html#toLowerCase(java.util.Locale)
    I knew that I can't write a code like that. I was just wondering if I could change the locale (after I initialize the string obj.) while toLowerCase().
    I needed that becouse when I want to ask a question at console: I must ask it in whatever user's language is. And also get the answers in their own language. Then I'll match the answers with my answers. for example console will ask:
    please enter your language? T?rk?e, English, Dutch, ?vrit, ...
    and the user will enter some characters to chose their language IN THEIR OWN ALPHABET that I'll match those with the ones that I created the answers (inside the codes) in all languages.
    If there is a match the program will work with that alphabet.
    I was asking for an easier way to get on with this. There may be a class that I can reach any kind of alphabets. or a method maybe.

  • How to convert Objext[] into String[] or any other object

    Hi,
    I've happened to come across a weird problem in java 1.6. I am sure it was alright before. Here is what I want to do and the result is
    Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String;
        Vector toVec = new Vector();
        StringTokenizer addrs = new StringTokenizer(addressesTo,";");
        while(addrs.hasMoreTokens()) {
            toVec.add(new String(addrs.nextToken()));
    String[] to;
    Object[] obj = toVec.toArray();
    to = (String[])obj;
    the tokenizer has at least 1 item. I am sure of it.
    Can anybody explain this phenomena?
    Thanks.

    No, you did not use identical code before, or if you did, you got the same results.
    String[] str[] = (String[])list.toArray(); // won't work, as toArray() returns Object[]
    String[] str[] = (String[])list.toArray(new String[0]); // works, creates a new String[]
    String[] str[] = (String[])list.toArray(newString[list.size()]); // works, returns a reference to the array created inline

  • Converting Object into primitives

    Can someone help me, i am calling a method that return Object and i want to know how i can cast it as an int or a char or a double
    thanx for any help in advance

    If the Object type is valid for a cast, just do it:
    Object o = 55;
    int i = (int)o;
    double d = (double)o;
    char c = (char)o;
    If you attempt to cast something that's not valid - for instance a String, it'll throw
    "ClassCastException: Cannot cast java.lang.String to int"

  • How to convert filenames into strings

    im listing a lists of files
    using the method listFiles() which returns me data of type File which are actually
    all files in the dir.
    may i know how do i convert the filenames returned to become strings
    so that i can manipulate the filenames as string format instead of file format?
    thanks for any help suggested!

    Im encountering a problem now before i can test the method...
    This the current problem i had :
    i only showed part of the codes here:
    File[] listing = Dir.listFiles();
    String[] lists;
    for (int i=0; i < listing.length; i++)
    lists[i] = new String(listing.getName());
    out.print(lists[i] + "<br>");
    The error i had:
    variable lists might not have been initialized
    lists[i] = new String(listing[i].getName());
    ^
    1 error
    I forgot how to deal with String array...
    I declare as String[] lists; coz i do not know the size of the array...
    how do i assign the filenames to strings?
    Please kindly help..thanks a lot!

  • How To Convert XML into String?

    Hi,
    I have a requirement in which I need to convert the data from XML file to string.
    E.g.
       <Drawing>
          <DrawingSpecification>
             <Header>
                <SoldTo>SDN</SoldTo>
                <SoldToName>SAP</SoldToName>
                <Date/>
                <Manager>CEO</Manager>
                < Plant>INDIA</Name>
                <Items>
                   <Item>
                       < MaterialNumber>MatNum12</ MaterialNumber>
                       <ProductNumber>ProName12</ ProductNumber>
                   </Item>
               </Items>
               < ClientId>ClientID123</ ClientId>
               <FileName>FileName123</FileName>
               <Type/>
               < TemplateName/>
          </DrawingSpecification>
          <Image contentType=""/>
       < /Drawing>
    Output should be like:
       < File>
          < Content> SDN SAP CEO INDIA MatNum12 ProName12 ClientID123 FileName123</Content>
       < /File>
    Please provide solution for the same.
    Thanks,
    Abhishek.

    what about something like this
    package test;
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class Test {
         public static void main(String args[]) throws Exception {
              DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
              DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
              Document doc = docBuilder.parse(new File("test.xml"));
              StringBuffer buffer = new StringBuffer();
              appendChildren(buffer, doc.getChildNodes());
              System.out.println(buffer.toString());
         private static void appendChildren(StringBuffer buffer, NodeList list) {
              for (int i = 0; i < list.getLength(); i++) {
                   Node node = list.item(i);
                   if (node.getNodeValue() != null) {
                        if (node.getNodeValue().trim().length() > 0) {
                             buffer.append(node.getNodeValue()).append("|");
                   appendChildren(buffer, node.getChildNodes());
    ...btw: IMHO the use of this forum is to get an answer to an particular question - not to ask for complete solutions - create the solution yourself an ask if you are stuck somewhere (with a bit of research (google) it is not hard to find a solution for your problem)
    regards franz
    ...close thread if question is answered

  • Can't convert int into String

    I'm trying to code a GUI that will give an employee id, name, salary, hire date, and vac days.
    public String getFieldValue(int fieldIndex) {
              switch (fieldIndex){
              case 0: return employeeID;
              case 1: return firstName;
              case 2: return lastName;
              case 3: return empIndicator;
              case 4: return salary;
              case 5: return hireDate;
              case 6: return vacDate;
              return null;
    My salary and vacDate are double and int. How do I display all the fields?
    Thanks

    I would use enums here, not magic numbers.
    Are you trying to extract the text held in JTextFields? If so, perhaps returning String is all you need. This you can parse via the wrapper classes (i.e., Integer.parseInt(...) and Double.parseDouble(...))

  • How to convert BLOB into a String

    Hi,
    I got a blob column from the database.
    It contains one XML File.
    How to convert it into String.
    I need the code for how to convert the blob into String
    Thanks in Advance.

    A blob would be a byte-array, which you can use in the String(byte[]) constructor

  • How to convert xslt file into string

    i'm writting a java program to use xslt to transform the xml file. i'm encountering the problem when i try to convert the xslt file into string. i've defined my utility class called 'XmlUtil' to carry out the operation of transform xml file through xslt. but in my main java program i need to convert both xml and xslt file into a string in order to input them in my function argument. my function argument is as follows:
    String htmlString = XmlUtil.applyXsltString(xmlContent, xsltString);
    i've already converted xmlcontent into string by using:
    xmlContent = xmlContentBuffer.toString();
    but i don't know how to convert 'xsltString' now ? i've searched the google for an hour but i cannot find the solution. anyone can help ?
    detail of my souce code is as follow:
    import java.io.*;
    import java.net.*;
    import java.lang.*;
    import java.io.StringReader;
    import java.lang.reflect.Array;
    import java.util.Properties;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.sax.SAXResult;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.sax.SAXTransformerFactory;
    import javax.xml.transform.sax.TransformerHandler;
    import javax.xml.transform.stream.StreamSource;
    import org.apache.xml.serializer.OutputPropertiesFactory;
    import org.apache.xml.serializer.Serializer;
    import org.apache.xml.serializer.SerializerFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    import org.xml.sax.XMLReader;
    import org.xml.sax.helpers.XMLReaderFactory;
    import XmlUtil;
    public class FileDownload {
    public static void download(String address, String localFileName){
    OutputStream out = null;
    URLConnection conn = null;
    InputStream in = null;
    StringBuffer xmlContentBuffer = new StringBuffer();
    String temp = new String();
    String xmlContent;
    try {
    URL url = new URL(address);
    out = new BufferedOutputStream(
    new FileOutputStream(localFileName));
    conn = url.openConnection();
    in = conn.getInputStream();
    byte[] buffer = new byte[1024];
    int numRead;
    long numWritten = 0;
    System.out.println (in.toString ());
    while ((numRead = in.read(buffer)) != -1) {
    out.write(buffer, 0, numRead);
    numWritten += numRead;
    temp = new String(buffer);
    xmlContentBuffer.append(temp);
    System.out.println(localFileName + "\t" + numWritten);
    xmlContent = xmlContentBuffer.toString();
    String htmlString = XmlUtil.applyXsltString(xmlContent, xsltString);
    } catch (Exception exception) {
    exception.printStackTrace();
    } finally {
    try {
    if (in != null) {
    in.close();
    if (out != null) {
    out.close();
    } catch (IOException ioe) {
    public static void download(String address) {
    int lastSlashIndex = address.lastIndexOf('/');
    if (lastSlashIndex >= 0 &&
    lastSlashIndex < address.length() - 1) {
    download(address, address.substring(lastSlashIndex + 1));
    } else {
    System.err.println("Could not figure out local file name for " + address);
    public static void main(String[] args) {
    for (int i = 0; i < args.length; i++) {
    download(args);
    }

    I don't understand why you need load the XML and XLS files into a String. A Transformer can be constructed from a Source and there is a StreamSouce which can be constructed from an InputStream. The transform() method can take a Source as input and can produce a Result. There is no need to go near a String representation of either the input.

Maybe you are looking for

  • Transfer Requirement not getting created

    Hi All, My query as below; Production order is created using KANBAN (Control Cycle/Supply Area is defined) using classic KANBAN. WM is in place and all the setting related to TR/TO creation for WM movement type 103 is in place. When i am trying to re

  • I cannot restart my iPad 2 with these messages (error # : 1603)

    Hello all. I have a 3G iPad 2. When I restart the IPAD appears [FTL:MSG] Apple NAND Driver (AND) RW [FTL:MSG] FIL_Init [OK] [FTL:MSG] BUF_Init [OK] And the I tunes cannot restore my Pad Someone can give me a hand?

  • Is BaseLining mandatory for Tracking Gantt in Project Server ?

    Hello all, I am new to Project Sever and I am feeling a bit uncomfortable with the usage of baselines. I just want a simple implementation where I will have my own custom defined Actual Task Start and Actual Task Finish to track the tasks. But is it

  • Oracle9i Database Release 2 Enterprise for HP 9000 Series HP-UX

    Is the "Oracle9i Database Release 2 Enterprise/Standard Edition for HP 9000 Series HP-UX" really running only on HP-UX 64 bit. No chance on 32 bit? Werner

  • Using Rotronic HygroFlex w/ Labview

    Does anyone have any experience with Rotronic's HygroFlex Humidity Sensors?  I am trying to program this in Labview, but cannot seem to get commands to work. I have opened a Visa Session with the device, and have the correct visa resource name, but i