Writing HTML data in TEXT File
I am writing HTML content in TEXT file ...I read it in a string and then write using PrintStream...
But it writes all content on one line ..I want to write it as it was in source HTML file...
Perchance, the OP is referring to the lack of carriage returns in his outputted data, and querying where they have absconded to? An analysis of his posts to date reveals that he has read the contents of a File into a String variable, and wants to write the (presumably modified) String back to a file (uncertain as to whether this is the same file or a different one) In the process of outputting to said file, carriage returns previously contained in the original input file are not present in the output. I would hazard a guess that the OP does not want said carriage returns in the String to disappear.
Is my analysis of the situation correct?
An example of the code that you have written to date would be of extreme usefulness to us in aiding you in your noble quest.
Without such a resource, I must rely on my intuition instead.
Possible places that the carriage returns are being "dropped"
1 - On reading in. Are you discarding carriage returns while building up your variable?
2 - On manipulating. Are you processing this line by line, or reading it all into one large variable?
3 - On output - are you using "print" or "println" in the output?
I look forward to further correspondence with you sir
kind regards,
evnafets
Similar Messages
-
How to get the source code of an HTML page in Text file Through J2EE
How to get the source code of an HTML page in Text file Through J2EE?
Huh? If you want something like your browser's "view source" command, simply use a URLConnection and read in the data from the URL in question. If the HTML page is instead locally on your machine, use a FileInputStream. There's no magic invovled either way.
- Saish -
Loading data from text file into ListBox
I have data in a text file that I want to load into a
listbox... I have fully mastered handling strings and arrays so I'm
going to need some help...
I was wondering how do I get flash to load a text file that
contains the data below.. and display it line for line like I want
it to list down the component
"Launch;7.1.7.6"
"Engine;7.1.7.6"
"OSX;7.0.0.2" (or something close to that)
and I was wondering how do i just get it to take it fromt he
file.. line for line from where it says exeversion in the file and
list it in the listbox...
I'm really thankful to anybody that helps.
Data in text file:
quote:
exeversion=Launch;7.1.7.6;
exeversion=Engine;7.1.7.6;
exeversion=LinuxX86;7.0.0.2;
exeversion=LinuxPPC;7.0.0.2;
exeversion=LinuxMIPS;7.0.0.2;
exeversion=OSX;7.0.0.2;
exeversion=Config;7.1.7.6;
exeversion=UI;7.1.7.7;
exeversion=JAVA;7.0.4.5;nobody cna help me? i really need to know or have a tutorial
or something so i can learn from it... i really appreciate anyone
who helps -
Unable to find file error while loading data from text file to Oracle
Hi,
I am having a interface where i am loading a data of Text file to Oracle.
But when i am trying to do this i am getting following error.
ODI-1227: Task SrcSet0 (Loading) fails on the source FILE connection SAPMM.
Caused By: java.sql.SQLException: File not found: d:/mdb/#General.get_filename
at com.sunopsis.jdbc.driver.file.FileResultSet.<init>(FileResultSet.java:160)
at com.sunopsis.jdbc.driver.file.impl.commands.CommandSelect.execute(CommandSelect.java:57)
at com.sunopsis.jdbc.driver.file.CommandExecutor.executeCommand(CommandExecutor.java:33)
SAPMM is connection name.
I am using get_filename to get the filename and it is fetching correct value as the this variable refreshes in previous step of this interface.
KM used for loading is File to SQL
What would be cause of this error?
Thanks,
MaheshHi,
Did a testing and following are the result
I have
A> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Execution of Interface which gets the file name from v_filename and load into target table
Package executes successfully.
B> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Scenario of Interface which gets the file name from v_filename and load into target table
Package executes with erre as it is not able to find the file
C> created package having steps like
1. Declaration of variable v_filename.
2. Refreshing variable v_filename.
3. Execution of Interface which gets the file name from v_filename and load into target table
4. Now create a scenario of the package , use the generated scenario in another package say main_package
Execution of main_package is successful.
Thanks,
Sutirtha -
Cant get data from text file to print into Jtable
Instead of doing JDBC i am using text file as database. I cant get data from text file to print into JTable when i click find button. Goal is to find a record and print that record only, but for now i am trying to print all the records. Once i get that i will change my code to search desired record and print it. when i click the find button nothing happens. Can you please take a look at my code, dbTest() method. thanks.
void dbTest() {
DataInputStream dis = null;
String dbRecord = null;
String hold;
try {
File f = new File("customer.txt");
FileInputStream fis = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
Vector dataVector = new Vector();
Vector headVector = new Vector(2);
Vector row = new Vector();
// read the record of the text database
while ( (dbRecord = dis.readLine()) != null) {
StringTokenizer st = new StringTokenizer(dbRecord, ",");
while (st.hasMoreTokens()) {
row.addElement(st.nextToken());
System.out.println("Inside nested loop: " + row);
System.out.println("inside loop: " + row);
dataVector.addElement(row);
System.out.println("outside loop: " + row);
headVector.addElement("Title");
headVector.addElement("Type");
dataTable = new JTable(dataVector, headVector);
dataTableScrollPane.setViewportView(dataTable);
} catch (IOException e) {
// catch io errors from FileInputStream or readLine()
System.out.println("Uh oh, got an IOException error!" + e.getMessage());
} finally {
// if the file opened okay, make sure we close it
if (dis != null) {
try {
dis.close();
} catch (IOException ioe) {
} // end if
} // end finally
} // end dbTestHere's a thread that loads a text file into a JTable:
http://forum.java.sun.com/thread.jsp?forum=57&thread=315172
And my reply in this thread shows how you can use a text file as a simple database:
http://forum.java.sun.com/thread.jsp?forum=31&thread=342380 -
Error while writing the data into the file . can u please help in this.
The following error i am getting while writing the data into the file.
<bindingFault xmlns="http://schemas.oracle.com/bpel/extension">
<part name="code">
<code>null</code>
</part>
<part name="summary">
<summary>file:/C:/oracle/OraBPELPM_1/integration/orabpel/domains/default/tmp/
.bpel_MainDispatchProcess_1.0.jar/IntermediateOutputFile.wsdl
[ Write_ptt::Write(Root-Element) ] - WSIF JCA Execute of operation
'Write' failed due to: Error in opening
file for writing. Cannot open file:
C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing. ;
nested exception is: ORABPEL-11058 Error in opening file for writing.
Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\
BPEL_Import_with_Dynamic_Transformation
\WORKDIRS\SampleImportProcess1\input for writing. Please ensure 1.
Specified output Dir has write permission 2.
Output filename has not exceeded the max chararters allowed by the
OS and 3. Local File System has enough space
.</summary>
</part>
<part name="detail">
<detail>null</detail>
</part>
</bindingFault>Hi there,
Have you verified the suggestions in the error message?
Cannot open file: C:\oracle\OraBPELPM_1\integration\jdev\jdev\mywork\BPEL_Import_with_Dynamic_Transformation\WORKDIRS\SampleImportProcess1\input for writing.
Please ensure
1. Specified output Dir has write permission
2. Output filename has not exceeded the max chararters allowed by the OS and
3. Local File System has enough space
I am also curious why you are writing to a directory with the name "..\SampleImportProcess1\input" ? -
How to extract data from text file to database table
Hi ,
I am trying to upload data in text file to database table using GUI_UPLOAD function .what would be the program for that.
thanks in advance.Hi,
I don't think you have a standard sap program to upload data from file to database table...
Instead you can create a custom program like this..
DATA: T_FILEDATA(1000) OCCURS 0 WITH HEADER LINE.
DATA: T_ZTABLE LIKE ZTABLE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\TEST.TXT'
tables
data_tab = T_FILEDATA
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT T_FILEDATA.
T_ZTABLE = T_FILEDATA.
APPEND T_ZTABLE.
ENDLOOP.
MODIFY ZTABLE FROM TABLE T_ZTABLE.
COMMIT WORK..
Thanks,
Naren -
How to get the source code of an HTML page in Text file Through java?
How to get the source code of an HTML page in Text file Through java?
I am coding an application.one module of that application is given below:
The first part of the application is to connect our application to the existing HTML form.
This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
Could any body provide coding hint for thatYou're welcome. How about awarding them duke stars?
edit: cheers! -
Writing binary data to a file without carriage returns every 512 bytes
Is there a VI for writing binary data to a file without carriage returns being inserted every 512 bytes?
ThanksHi Momolxg,
I could be way off on this. I tried to simulate what you've done by
making a for loop that would run a set number of times. For my example I
used 1025. I wired the iteration terminal to a 'Write to SGL File.vi'
outside the loop with indexing enabled. It wrote the SGL data from 0 to
1024 to the file. I then read the file with a 'Read Characters from
File.vi' and searched the output for a carriage return (0D hex). It was
found five times. The reason why was the SGL number it was reading had a
13 (0D hex) in it. Perhaps you're running into a similar problem?
I tried it again, this time using the 'Write to I16 File.vi'. The
carriage return was found five times: the 28th character the first time
then on the 512th character four consecutive time
s after that. I suppose
that makes sense that you'd find a 0D in the numbers at equal spacings if
they're incrementing this way... In this case the carriage returns you're
seeing are actually numbers from your data.
One big difference is that I'm using a set pattern of numbers. This
doesn't appear to be your case. Is there a better way we can duplicate
your problem? It sounds interesting. Again my simulation could be way
off. (I'm also running this on LV60 for Linux so my results could be
different)
- Kevin
In article <[email protected]>,
"momolxg" wrote:
> Is there a VI for writing binary data to a file without carriage returns
> being inserted every 512 bytes? Thanks -
Remove duplicates while loading data from text file
Hi,
Data in text file (some times has duplicates) is being loaded into Oracle 9i database using Informatica. To improve performance, we would like to remove duplicates at the time of each load using Oracle procedure. Could you please help me with this?
Thanks,
LakshmiNo, our table doesn't have that. Most of the functionality is managed at the informatica level. Is there any other way? Thanks,
-
How to write data to text file using external tables
can anybody tell how to write data to text file using external tables concept?
Hi,
Using external table u can load the data in your local table in database,
then using your local db table and UTL_FILE pacakge u can wrrite data to text file
external table
~~~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2153251
UTL_FILE
~~~~~~~~~
http://download-east.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093
Message was edited by:
Nicloei W
Message was edited by:
Nicloei W -
Spool SQl data into text file using dynamic sql
Hi,
I am spooling output data into text file using command
select 'select t.mxname,bo.lxtype,t.mxrev'||chr(10)||'from mx_1234567'||chr(10)||
'where <condition>';
here mxname varchar(128),lxtype(128),mxrev(128) all are of varchar type.I want the output in format
e.g Part|1211121313|A
but due to column width the output,I am getting is with spaces.
"Part then blank spaces |1211121313 then blank spaces |A"
how can I remove these spaces between columns.I used set space 0 but not working.
Thanks in advance.
Your help will be appreciated.Hi Frank,
I have seen your reply for SET LINE SIZE function. But, I could not be able to understand it.
I am facing similar kind of issue in my present project.
I am trying spool more than 50 columns from a table into flat file. Because of more column lengths in few columns, i am getting space. There are so many columns with the same issue. I want to remove that space.so that, data can fit perfectly in one line in .txt file without any wrap text.
Below is my sample query.sql. Please let me know the syntax. My mail id : [email protected]
--Created : Sep 22,2008, Created By : Srinivasa Bojja
--Export all Fulfillments
--Scheduled daily after 1:00am and should complete before 3:30am
WHENEVER SQLERROR EXIT SQL.SQLCODE
SET LINESIZE 800
SET WRAP OFF
SET PAGESIZE 800
SET FEEDBACK OFF
SET HEADING ON
SET ECHO OFF
SET CONCAT OFF
SET COLSEP '|'
SET UNDERLINE OFF
SPOOL C:\Fulfillment.txt;
SELECT SRV.COMM_METHOD_CD AS Method,
SRV.SR_NUM AS "Fulfillment Row_Id",
CON.LAST_NAME AS "Filled By"
SRV.SR_TITLE AS Notes,
SRVXM.ATTRIB_04 AS "Form Description"
FROM SIEBEL.S_SRV_REQ SRV,
SIEBEL.S_SRV_REQ_XM SRVXM,
SIEBEL.S_USER USR,
SIEBEL.S_CONTACT CON
WHERE SRV.ROW_ID = SRVXM.PAR_ROW_ID AND
SRV.OWNER_EMP_ID = USR.ROW_ID AND
CON.ROW_ID= SRV.CST_CON_ID;
SPOOL OFF;
EXIT; -
How to export bulk data in text file
Dear,
We have an requirement to get data from GL CONTAINING below tables, but it's taking lot of time, could you share the best way to get data in text file as quick as possiable.
from gl_je_headers_v,gl_je_lines,GL_JE_CATEGORIES
,gl_code_combinations_v
where gl_je_headers_v.je_header_id = gl_je_lines.je_header_id
AND GL_JE_CATEGORIES.je_category_name = gl_je_headers_v.je_category
and gl_code_combinations_v.CODE_COMBINATION_ID =
gl_je_lines.code_combination_id
and gl_code_combinations_v.CHART_OF_ACCOUNTS_ID = 50349
AND gl_je_headers_v.PERIOD_NAME = 'SEP-2012'it's based on formatting data in text file
you can use utl_file but it's row by row process your data
you can try spool
as example
spool c:\tmp\myfile.txt
select *
from emp;
spool off;or try export for example in sql developer -
Writing data in text file..
1. check the file name in D:\\temp\\test.txt
2. if it exists, then open file. if there is data, then read data. after the last record, it writes new data.
3. if it does not exist, create text.txt file and write data into text.txt file.
so far, I have a code..
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) {
String filename="test";
String format = "%1$-9s%2$-3s%3$-30s%4$-30s%5$-30s\n";
String arraydata[] = { "John", "F.", "Kennedy", " ", "t", "John2", "F2.", "Kennedy2", " ", "t2"};
String cnt_id ="2";
int cnt_orderid = Integer.valueOf(cnt_id);
try
PrintStream ps = new PrintStream(new FileOutputStream("D:\\temp\\"+filename+".txt"));
for (int i=1; i<cnt_orderid; i++)
ps.println(String.format(format, (Object[])arraydata)); // write in test.txt file
ps.close();
catch (Exception e)
System.out.println(e);
my question is..
1. how to check the file exists or not
2. how to write the data in the new line after the last data in the file.1. Use a File object.
File file = new File("someFile.txt");
if (file.exists()) { ... }2. Consider using FileWriter; the constructor allows you to append to the end of the file:
FileWriter fileWriter = new FileWriter(file, true);Michael -
Writing in to a Text file in Vista 32 OS
Dear Friends,
I have developed a standalone ticker in Adobe AIR, in that
iam storing setting options in a local text file. It is working
fine in XP.
but when i install my application(ticker) in Vista32 OS,
when i do changes in my setting file, i have to write the changes
in local text file. it is not writing the modified setting text in
the text file. my coding is:
function writefile() {
tempscr1=3;
var finalstr2:String =
"smallwinmode="+smscr+"&speed="+setmc.tickeropt.sld.s.value+"&alert="+altval+"&maxi="+max ifeed+"&alwtop="+setmc.tickeropt.aifch.selected+"&prescr="+tempscr1+"&prescrx="+newwindow3 .x+"&prescry="+newwindow3.y+"&firstinstal="+fins;
var dskTopFileStream2:FileStream = new FileStream();
var dskTopFile2:File = File.applicationDirectory;
var fileString2:String = (dskTopFile2.nativePath +
"\\settings.txt");
dskTopFile2 = dskTopFile2.resolvePath(fileString2);
dskTopFileStream2.openAsync(dskTopFile2, FileMode.WRITE);
dskTopFileStream2.writeUTFBytes(finalstr2);
dskTopFileStream2.close();
Anybody can help me. if it works in Vista also i can release
my product, i got struct up... kindly tell me should i change my
coding to write txt file in Visa? pls help me....
Thanks in advance,
Syed Abdul RahimYour user probably doesn't have permission to write to the
application directory. The OS is right to protect the program
directory.
You should be writing data files into the user's home
directory somewhere. All of the other "somethingDirectory"
properties of File name such directories. For files that the user
doesn't actually work with directly, I prefer
applicationStorageDirectory myself. For files you are writing out
for the user to see, I'd use documentsDirectory instead.
Maybe you are looking for
-
Chart legend name programmatically
Hi, How can I change programmatically the legend name of my chart? Thanks, ToNi.
-
How can I choose the movy language? I know several ones and enjoy watching the movies in the original one.
-
Problem when booting from PATA drive on IDE-3 with SATA RAID on ICH5R
Hello, I have a PATA drive installed as Master on IDE-3 (Promise Controller), using Windows XP as the operating system. I also have an aditional drive as Slave on IDE-3. I recently bought 2 SATA drives which I would like to use as a RAID array, so I
-
Adobe illustrator How to edit my photo Template
Can anyone tell me how to edit the photo blocks on my Template. Someone made me a template in adobe illustrator and i can't seem to edit the blocks to add photos instead of the other images. Thank You
-
Can anybody give me idea about the OnLine PC maintenance & desktop Sharing
I have a project on OnLine PC Maintenance How can I detect Spyware & Virus from remote machine. Is it possible with desktop sharing? if Yes, then how can i share desktop remotely?