To store the output of the OutputStream in the String

I can get the output of the transformer.transform("","") to be printed on the screen, but the aim is to store the output in the String.
I checked out the API, one way to get the data would be to store the output in the file using.....
new StreamResult(new File("x.html")) and then get the data. But I am not suppose to use a temporary storage in the form of a file. Is there any other way I can get the data in the form of a String.
The code is :
File file = new File("table.xsl");
StreamSource xslSource = new StreamSource(file);
File file1 = new File("test.xml");
StreamSource xmlSource = new StreamSource(file1);
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(xslSource);
target = new StreamResult(System.out);
transformer.transform(xmlSource,target);
Thanks in advance.
manibhat

Hi ecbouma,
Thanks for the solution.
I came across another approach..
StringWriter sw = new StringWriter();
PrintStream ps = new PrintStream(sw);
sw.toString();
It works fine...
I have a question over here...
PrintStream takes an argument that extends OutputStream, but looks like StringWriter does not extend OutputStream...
I am not sure why does the above code works.
manibhat

Similar Messages

  • How to store the string scanned by the scanner class

    try {
           Scanner scanner = new Scanner(new File("D:\\textfile.txt"));
           String sb;
           scanner.useDelimiter("\\t");
           while (scanner.hasNext()== true)
           System.out.println(scanner.next());
              scanner.close();
           catch (FileNotFoundException e)
           e.printStackTrace();
         }Output i get is
    Hi
    how
    are
    you
    I would like to store each word in a different string.What changes do i need to make in the code given above?

    warnerja wrote:
    But what if the text file contains "Trolls are annoying"? Then your solution fails.No warnerjav - this is not so.
    Solution still nearly works but assigns "Trolls" to variable 'hi', "are" to variable 'how' and "annoying" to variable 'are'.
    But you are right to point out that we must now trap exception for call to
    String you = scanner.next();in order to fix the javs for the sentence you suggest because there will be no more words in the scanner darkly.
    Best thankyou for you pointing this out to me for the hlep of us all learning more about the Javs we love.
    Best greetings,
    Bob Gateaux.

  • How to store the output of a analog to digital converter into an 2D array

    Hi
    I am doing my M.Tech Thesis in Image reconstruction and I am using labview for simulation and I want to know how to store the output of a analog to digital converter into an 2D labview array.

    nitinkajay wrote:
    I want to know how to store the output of a analog to digital converter into an 2D labview array.
    How exactly are you performing 'Analog to Digital'???
    Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • How to store the report output in app server local directory

    Dear All,
    I would like to store the reports output in the app server folder. How do i achieve?
    I am using reports10g, app server 10g. I am using web.show_document to call the reports. I would like to the achieve the same using this web.show_document built in.
    Thanks
    Balaji

    Hi,
    using desname pointing to an path on the apps-server the output is stored there. But when opening before in browser, then this document is stored in temporary folder on the client and you can't store them then to the apps server (if you not map the apps server or use web dav to do that).
    Regards
    Rainer

  • How can I store an output, i.e C from the attatchmen​t in an array?

    How can I store an output, i.e C from the attatchment in an array?
    Attachments:
    Testing.vi ‏18 KB

    Hi, Se
    Take a look my example.
    Attachments:
    Testing.vi ‏23 KB

  • Is there any standard SAP table which stores the license number assigned to a delivery item

    Hi Experts,
    This is in relation to license number assigned to a delivery item under ‘Export License Log’. Our scenario is for delivery of type NLCC created for an inter-company stock transport order. (i.e.not a sales order case where the license may get copied from sales order to delivery through copy control)
    As we understand, for legal control – relevant scenarios, export license for each item shall be determined afresh every time the delivery is accessed. (Depending on legal regulation, grouping, destination country, export control class, delivery partners vis-à-vis license master customer assignments etc.)
    To print the license text on one of the delivery output types, we want to access the license number for each item. (determined under export license log)
    Our question is:  is there any standard SAP table which stores the license number assigned to a delivery item?
    We have checked some of the license tables (T606*, VAEX, EMXX etc.) but couldn’t get any specific table storing delivery-item-specific license data.
    Helpful answers Text Removed
    Regards,
    Jagan
    Message was edited by: G Lakshmipathi
    Dont add such text in your post

    Hi Lakshmipathi,
    The export control log can be accessed by going to delivery Extras-> Export license log
    We need a table that stores the determined license for each item in a delivery document ( as shown in the below screenshot)
    Regards,
    Jagan

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • How to execute unix command through odi and store the result in table

    I have to reconcile  if data is loaded in table from csv file or not . I have to create a oracle data integrator package/interface/procedure to execute unix command to count number of rows in the csv files and store the count result in a table then i have to query the loaded table and count number of rows there and store in the table and have to compare is counts are same or not,  Please assist me how to make package/interface/procedure to  execute unix command and store result in oracle table.
    Thanks in Advance

    Use ODI OS command tool in the ODI package.
    create an interface in ODI using LKM File to Sql and the output file generated with the csv file's row count as a source and the db table(where the count needs to be stored) as a target

  • How do I store the values in the @D array in the below mentioned VI? Only the last row in the Array is populated with values from the image.

    Hello Guys,
    I am trying to build a sinogram from 180 projection images and I am not able to store the summed values into the array as it is moving the values and then populating all the rows except for the last with ZERO.
    Thanks in advance.
    Attachments:
    sinogram.vi ‏53 KB

    Your loop runs only three times, so all you can possibly populate is 3 rows.
    Typically, you would initialize a shift register with the initialized array, then use replace array subset, feeding the modified array back into the shift register. However, in this case you could just autoindex the 1D array at the output tunnel to build the resulting 2D array.
    Sorry, I am not familiar with sinograms. Do you have a link describing the algorithm?
    LabVIEW Champion . Do more with less code and in less time .

  • DIAdem: How to store the input channel information from the Analysis modules

    Hi,
    I would like to know if there is a way to store the input channel name(s) when executing modules from the Analysis Panel. For example, when I run an FFT on a set of data: x-channel: "[1]/Time" y-channel: "[1]/Voltage" , I would like to be able to store this information as a custom channel property in the output file (ex. "[1]/AutoSpectrum").  
    The only place I've found that contains this "history" information is in the log section of the Analyze Panel. However, I have not been able to figure out how to access the information in the Analysis log programatically through VBS scripting.
    Thanks

    Hi Brad,
    So here's where I'm struggling. My tool is more a set of tools. I have created custom bars that launch the appropriate dialog box for each tool. Let me give you and example of the kind of work flow I that might be used:
    The user loads up a TDM file or imports data using a DataPlugin. Then, they launch my tool for going through each channel and adding custom properties (sensor type, sensor location, etc). Once all properties have been applied to the channels they close that tool. Now they fire up the Smoothing module in ANALYSIS and save the result as a new channel. Next, they launch my tool for computing the Shock Response for that event. When the user has the desired output, they run my plotting SUD. This is where they can select which report template to use and which channels to plot. The selected channel(s) used for plotting doesn't have all of the custom properties that we taged in the original data channels.
    As you can see, the process involves using some of my own custom SUDs where I can keep track of everything but also allows the user to use any of DIAdem's native functions. This is where I am struggling to be able to keep track of the channels used as input. I can "see" the info I need listed in the log section of the ANALYSIS Panel but can't pragmatically access it (the info in the main display window). It would be really handy if this info was automatically stored in the channel properties of each output channel.
    I guess my only option is to (in the plotting SUD) not only ask the user for the channels to plot, but also ask them to select the coresponding original channels that have the custom properties.
    James

  • Where to store the PO: Terms and Condition file For printing it in PO

    Hi All,
    I want to add Terms and condition in my PO: Print output which is coming in PDF. I got the Profile name, which is --PO: Terms and Conditions filename. But i am not getting where i have to store the file on server and what i need to give the value for this profile. I had customized the PO_STANDARD_XSLFO template. Now only remaining thing is that i want to add the Terms and Conditions.
    Should I hardcode it in the XSL-FO Template???
    OR what value i should give to this profile option?
    Regards
    Ravi

    Ravi
    Check the thread
    How to add Terms and Conditions in Standard PO XSL-FO template
    Vicha

  • Store the out put of smartform in a directory which is created on app..Serv

    Dear All,
    I want to store the out put of smartform in a directory which is created on application server.so that the user in future can directly print the output with out again executing the smartform.....
    regards,
    Sudheer.G

    hi Sudheer,
    Correct me if I am worng but you cannot issue output without executing smartform.
    If you want to just store the output in App server then use the PDF output option in SmartForm attributes. Then use
    OPEN DATASET.
    READ DATASET.
    CLOSE DATASET.
    to store the PDF on app servee.
    Rgd
    Vivek
    Reward if helps

  • How do I read from a file and store the information in an array?

    Here is my problem:
    I am going to have to use a bufferedReader to read a file containing information on 10 vehicles. And after I read that file I want to store the info in Vehicle [] V.
    Where should I start?
    Thanks
    Steve

    Thank you for the quick response.
    As of right now our code is the same. Now I have to "parse" the information. What exactly do you mean?
    My code is as follows:
    while((str = br.readLine()) != null)
    String[] tokenArray = str.split(" ");
    for(int i = 0; i < tokenArray.length; i++)
    System.out.print(" Token: " + tokenArray);
    System.out.println("\n");
    Is that what you mean by parsing?
    I am not quite sure what e slpit(" ") is doing. Is there a better way?
    And just to make sure I am understanding my own code, I am storing the information from the br in tokenArray. Followed by a series of print statements which output the info.Correct?
    Thanks again,
    Steve                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Create a user key that stores the mantissa into X1

    Hi Friends:
    I was a hp 41cx user but have recently moved up to the Prime. 
    I’d like to create a user key that stores the mantissa into X1 and another user key that recalls the contents of X1 into the mantissa.
    Thanks for your help!
    Migs

    Hi Matt
    I suppose you could do it with a Click Box. Just insert a
    Click Box object on one of your slides. Then configure it so it
    doesn't pause and the action is to jump to the first slide. Then
    assign your hot key.
    I would suggest, however, that you avoid using F1 or other
    hot keys the browser uses, as the browser will trap them and they
    won't be available to the Captivate output. You will be scratching
    your head and wondering why it doesn't seem to work. Now if you are
    creating .EXE output, it should work dandy. But not if it's
    .SWF/.HTM combo.
    Cheers... Rick

  • Double click and get and store the value in variable.

    Hi,
    My intention is when i double click a particular record on a tabular, i want to capture or store the particular value of record into a variable and call that variable in print/preview button PLSQL code.
    Below i show the screenshot which contain a tabular and print preview button. After populating the data. the user will double click on the agent code LC354 and click the print/preview button it should display report for only the
    agent code of LC354(this is what i want). But normally when i click the print preview button it wil show the report of agent code of LC354 and LC325(this what i dont want).
    http://imageshack.us/photo/my-images/811/printpb.png/
    My problem is how to capture the value((*LC354*)) of particular record after double click the agent code(*LC354*)?
    i tried to store agent code in variable AG_CNT in mouse double click trigger with following plsql code. but it dosent work.
    declare
    AG_CNT varchar2(10);
    begin
    *AG_CNT* :=GET_ITEM_PROPERTY('RFQ_AGENT_DETAILS.AGENT_CODE',CURRENT_RECORD);
    end;after that pass that AG_CNT value in *:AG_CODE*. below code is in print/preview button.
         cursor c1 is select nvl(count(ENQUIRY_NO),0) from scott.EXP_QUOTE_STATUS
         where ltrim(rtrim(upper(job_status))) like 'APPROVED%' and ENQUIRY_NO = :REQ_FOR_QUOT.ENQUIRY_NO
    AND AGENT_CODE=*:AG_CODE* ;how to do this?
    skud.

    Hi skud
    i juast want to store the agent code to variable.if i did get ur point...
    Why don't u just use a simple assign statment for example...
    DECLARE
    V_VALUE  NUMBER;
    BEGIN
    V_VALUE := LC354 ; -- IF it was a value as LC354 static i mean
    -- or u could use any value
    V_VALUE := :ur_form_item_name; --- if it was dynamic
    END;That's it .
    Hope this helps...
    Regards,
    Ammatu Allah.

Maybe you are looking for

  • Different Styles in PlainView - Syntax Highlighting?

    Hi, I've managed to extend PlainView and looking at old JEdit code I have the syntax highlighting working for the most part. However, at certain times while typing the cursor starts to get way ahead of the text it's typing. And as I backspace on the

  • Streaming music from Time Capsule to Apple TV

    I own an Apple TV and just bought a Time Capsule, I was wondering whether i could stream music from my Time Capsule to my Apple TV without having any computer/mac turned on, is this possible?

  • Unknown network traffic / router traffic monitoring

    So I got a new PC with windows 7 on it, and I installed this gadget that monitors network traffic, and it shows a lot of traffic that my local PC isn't showing, so I am thinking there is something running on the LAN that I can't see. I was looking to

  • Show skipped slides in Light Table?

    Does anyone know how to display skipped slides in Light Table (or any other) view)? I bought this new Mac mainly so I can use Keynote in my corporate training presentations. But it takes too long to tailor each presentation, since I need to see at a

  • How do you attach photos to a Yahoo e-mail via Firefox?

    I cannot find how to attach photos to e-mails to my Yahoo mail contacts via Firefox. Every attempt has failed.