Streaming XML file content to a HTTPS servlet..

Hi,
I want to stream the contents of a XML file , which I have generated through XDK for PL/SQL, to a HTTPS address for a servlet.
This HTTPS connections uses certifcates for user authentication. I have the certifcate on my local machine. Is there anyway of doing this through PL/SQL? Are there any packages available in Oracle 8.1.6 for this purpose? Can somebody tell me if there is a better way of doing this?
Any help will be greatly appreciated.
Thanks.

After some additional trials I found a solution by calling the stored procedure in this way
DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
DBPrepareSQL (hdbc, "usp_InsertReport");
DBCreateParamInt (hstmt, "", DB_PARAM_RETURN_VALUE, -1);
DBCreateParamChar (hstmt, "XMLCONTENT", DB_PARAM_INPUT, sz_Buffer, (int) strlen(sz_Buffer) + 1 );
DBExecutePreparedSQL (hstmt);
DBClosePreparedSQL (hstmt);
DBGetParamInt (hstmt, 1, &s32_TestId);
where sz_Buffer is my xml file content and s32_TestID the return value of the stored procdure (usp_InsertReport(@XMLCONTENT XML))
Now I face the problem, that DBCreateParamChar limits the buffer size to 8000 Bytes.
Any idea to by-pass this shortage??

Similar Messages

  • How can I transfer a XML file content to a MS SQL database by stored procedure using LabWindows/CVI SQL Toolkit?

    Hi,
    I have a problem to transfer a XML file content to a MS SQL database by a given/fixed stored procedure. I'm able to transfer the content of the file by using following method ...
    hstmt = DBPrepareSQL (hdbc, EXEC usp_InsertReport '<Report> ..... </Report>');
    resCode = DBExecutePreparedSQL (hstmt);
    resCode = DBClosePreparedSQL (hstmt);
    ... but in this case I'm not able to fetch the return value of the stored procedure! 
    I have tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL) but I miss a datatype for xml?!?
    Any idea how to solve my problem?
    KR Cake  
    Solved!
    Go to Solution.

    After some additional trials I found a solution by calling the stored procedure in this way
    DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
    DBPrepareSQL (hdbc, "usp_InsertReport");
    DBCreateParamInt (hstmt, "", DB_PARAM_RETURN_VALUE, -1);
    DBCreateParamChar (hstmt, "XMLCONTENT", DB_PARAM_INPUT, sz_Buffer, (int) strlen(sz_Buffer) + 1 );
    DBExecutePreparedSQL (hstmt);
    DBClosePreparedSQL (hstmt);
    DBGetParamInt (hstmt, 1, &s32_TestId);
    where sz_Buffer is my xml file content and s32_TestID the return value of the stored procdure (usp_InsertReport(@XMLCONTENT XML))
    Now I face the problem, that DBCreateParamChar limits the buffer size to 8000 Bytes.
    Any idea to by-pass this shortage??

  • How to insert External XML file content into XMLTYPE through Pro*c

    Could any one sugest me how to insert a external XML file content into Db
    into XMLTYPE datatype through Pro*c program.
    Thanks for any help...... who has done this
    Ghanta Tagore

    Hi
    After some good fight of 3 days, I have done it through Pro*c
    This is the way to handle this
    Buffer-->Temporary Clob-->XMLTYPE(using CreateXml)
    Pasting my piece o code to do this
    ===============
    OCIClobLocator *license_txt;
    varchar h_ttt[1024] = {'\0'};
    ub4 amt;
    int i;
    EXEC SQL ALLOCATE :license_txt;
    EXEC SQL LOB CREATE TEMPORARY :license_txt ;
    GetName(name); /*Gets Name to insert into name column in License Table*/
    for(i=0; i<4;i++)
    GetXMLL((char *)h_ttt.arr); /*Gets a string value of XML into this example*/
    /*<Tagore>Is From TCS Delhi</Tagore>*/
    /*This can be changed to get buffer from FILE */
    h_ttt.len = strlen((char *)h_ttt.arr);
    amt = sizeof(char) * h_ttt.len ;
    EXEC SQL LOB WRITE APPEND :amt FROM :h_ttt INTO :license_txt;
    EXEC SQL
    INSERT INTO license_table VALUES (:sss, :name, sys.xmltype.createXML(:license_txt))
    ================
    Thanks For ur Help
    Tagore Ghanta

  • EC SALES LIST - Belgique: XML file: Content not accepted in prolog

    Hy tou you all,
    We've implemented all Ec sales list note oss for Belgium but at the upload in the delcaration vat system the xml file is not accepted : "Content not accepte in prolog"; Did this message encured to you ?
    Thanks,
    TF

    HI,
    I hope you are asking about below legal changes
    http://www.minfin.fgov.be/portail2/fr/e-services/intervat/calendrier.html
    and SAP DS colleagues are working on same and they are planning to release the note
    within soon.
    For same information will check the service market place.
    Thank you.
    Regards
    Madhu M

  • Display an XML file Content as a treeView in a SharePoint 2013 custom form edited with SharePoint Designer 2013

    Hello everyone,
    Within a list form, user has to select a value amongst a huge number of availables options.
    Instead of using something like a dropdown list, which would be very boring to parse, I would like to display possibles values in a treeview.
    To do that, I tried to use an <Sharepoint:SPTreeView bind to a SharePoint:SPXmlDataSource who read data from an XML File.
    <SharePoint:SPXmlDataSource runat="server" DataFile="../../SiteAssets/App_Data/myfile.xml" AutoSave="True" XPath="" ID="myDataXml"></SharePoint:SPXmlDataSource>
    <SharePoint:SPTreeView runat="server" ID="MyTreeView" DataSourceID="myDataXml" />
    But when I try to display the form in my web browser, an error occurs.
    Therefore, my question is : Is it possible to display the content of an Xml file as a treeView in a SharePoint 2013 custom form edited with SharePoint Designer 2013 ?
    If the answer is yes, how ? Which are the required properties for "SharePoint:SPXmlDataSource" tag and "SharePoint:SPTreeView"  tag ?
    What are the requirements to use thoses tags ?
    Regards,
    Florian.
    Ps : I dont have access to the server side of the SharePoint site I am working on.

    Assuming that https://fullsitename is a new URL address did you make sure to update your browser to include it in the Trusted Sites zone?  The message you are quoting is exactly the one you get if you don't have it in Trusted Sites.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • How to display an xml file contents in jsp as tree view

    hi,
    Iam trying to read an xml file and display the structure in jsp as tree view, can any one help me

    Use a [XML or DOM parser|http://java-source.net/open-source/xml-parsers] to read a XML file into a tree structure of Java objects.
    Use the [Collections API|http://java.sun.com/docs/books/tutorial/collections/index.html] to get hold of the relevant elements in a tree structure.
    Use JSTL´s [c:forEach|http://java.sun.com/javaee/5/docs/tutorial/doc/bnakh.html] tag to iterate over a Collection in JSP.
    Use HTML´s [<ul>/<li>|http://www.w3.org/TR/REC-html40/struct/lists.html#h-10.2] or [<dl>/<dt>/<dd>|http://www.w3.org/TR/REC-html40/struct/lists.html#h-10.3] tags to represent a tree in HTML.

  • Where to save web.xml file in apache jserv with servlet 2.0

    hi,
    we are using apache jserv which included servlet 2.0 we are able to run .class files and
    jsp files,but we are using web.xml file for connection pooling which we were used in tomcat
    but we are unable to find web-inf folder in apache/jserv to save the file.
    please help me out in this problem,
    please guide us is there any other method of connection pooling apache jserv,we are using backend
    as oracle9i
    i will be greatfull to u in this regards
    laiq

    Hi,
    Just create WEB-INF folder and copy the web.xml.
    good luck !
    ...san :-)

  • Searching for BLOB xml file content

    Hi Gurus,
    I am having a table with a blob type column which is holding xml files. Is there a way to select records of the table based on specific words contained in the xml?
    Many Thanks,
    Napster

    rp0428 wrote:
    But if OP really wants to search the 'content' of the xml elements I don't see that working for them.
    Sure, he can.  All you have to do is add auto_section_group to the index parameters, then you can search within any of the specific tags, as demonstrated below.
    SCOTT@orcl12c> CREATE TABLE a_table
      2    (id          NUMBER,
      3      blob_type_column  BLOB)
      4  /
    Table created.
    SCOTT@orcl12c> INSERT INTO a_table VALUES (1,
      2  UTL_RAW.CAST_TO_RAW (
      3  '<a><b>something different</b><c>whatever you are looking for</c></a>'))
      4  /
    1 row created.
    SCOTT@orcl12c> INSERT INTO a_table VALUES (2,
      2  UTL_RAW.CAST_TO_RAW (
      3  '<a><b>something else</b><c>something different</c></a>'))
      4  /
    1 row created.
    SCOTT@orcl12c> CREATE INDEX test_index ON a_table (blob_type_column)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  PARAMETERS ('SECTION GROUP CTXSYS.AUTO_SECTION_GROUP')
      4  /
    Index created.
    SCOTT@orcl12c> SELECT id, UTL_RAW.CAST_TO_VARCHAR2 (blob_type_column)
      2  FROM   a_table
      3  WHERE  CONTAINS
      4            (blob_type_column,
      5             '(whatever AND looking) WITHIN c') > 0
      6  /
            ID
    UTL_RAW.CAST_TO_VARCHAR2(BLOB_TYPE_COLUMN)
             1
    <a><b>something different</b><c>whatever you are looking for</c></a>
    1 row selected.
    SCOTT@orcl12c> SELECT id, UTL_RAW.CAST_TO_VARCHAR2 (blob_type_column)
      2  FROM   a_table
      3  WHERE  CONTAINS
      4            (blob_type_column,
      5             '(something different) WITHIN b') > 0
      6  /
            ID
    UTL_RAW.CAST_TO_VARCHAR2(BLOB_TYPE_COLUMN)
             1
    <a><b>something different</b><c>whatever you are looking for</c></a>
    1 row selected.
    SCOTT@orcl12c> SELECT id, UTL_RAW.CAST_TO_VARCHAR2 (blob_type_column)
      2  FROM   a_table
      3  WHERE  CONTAINS
      4            (blob_type_column,
      5             '(something different) WITHIN c') > 0
      6  /
            ID
    UTL_RAW.CAST_TO_VARCHAR2(BLOB_TYPE_COLUMN)
             2
    <a><b>something else</b><c>something different</c></a>
    1 row selected.

  • PLSQL changing XML file content

    Hello Experts,
    I have a task to do.
    I have to replace special characters from an XML file placed on the server through PLSQL.
    So that i created a plsql procedure.
    PROCEDURE REMOVE_SPECIAL_CHARS (p_file_name IN VARCHAR2)
    AS
    l_tmp_clob       CLOB                             DEFAULT EMPTY_CLOB();
    l_bfile          BFILE NULL;
    l_dest_offset    INTEGER            := 1;
    l_src_offset     INTEGER            := 1;
    l_outfile        UTL_FILE.file_type;
    lang_ctx         NUMBER             := DBMS_LOB.default_lang_ctx;
    warning          NUMBER NULL;
    l_dest_file      VARCHAR2(300) NULL;
    BEGIN
    mob_util_pck.log_write ('I','Inside REMOVE_SPECIAL_CHARS procedure(+)');
    l_dest_file:=SUBSTR (p_file_name, (INSTR (p_file_name, '/', -1, 1))+1);
    mob_util_pck.log_write ('I','Following File will be modified: '||l_dest_file);  
       l_bfile := BFILENAME ('MOBSEPAOUT', l_dest_file);
       DBMS_LOB.OPEN (l_bfile, DBMS_LOB.file_readonly);
       DBMS_LOB.createtemporary (l_tmp_clob, TRUE);
       DBMS_LOB.loadclobfromfile (dest_lob          => l_tmp_clob
                                , src_bfile         => l_bfile
                                , amount            => DBMS_LOB.getlength (l_bfile)
                                , dest_offset       => l_dest_offset
                                , src_offset        => l_src_offset
                                , bfile_csid        => DBMS_LOB.default_csid
                                , lang_context      => lang_ctx
                                , warning           => warning
       DBMS_LOB.CLOSE (l_bfile);
    mob_util_pck.log_write ('I','Deleting Old File');
       BEGIN
          mob_util_pck.delete_files ('MOBSEPAOUT'
                                   , l_dest_file
       END;
    mob_util_pck.log_write ('I','Before Replacing Characters');
       l_tmp_clob := REPLACE (l_tmp_clob, '€', 'E');
       l_tmp_clob := REPLACE (l_tmp_clob, '@', '(at)');
       l_tmp_clob := REPLACE (l_tmp_clob, '&', '+');
       l_tmp_clob := REPLACE (l_tmp_clob, 'à', 'a');
       l_tmp_clob := REPLACE (l_tmp_clob, 'é', 'e');
       l_tmp_clob := REPLACE (l_tmp_clob, 'è', 'e');
       l_tmp_clob := REPLACE (l_tmp_clob, 'ç', 'c');
       l_tmp_clob := REPLACE (l_tmp_clob, 'ù', 'u');
       l_tmp_clob := REPLACE (l_tmp_clob, 'ï', 'i');
       l_tmp_clob := REPLACE (l_tmp_clob, 'ù', 'u');
       l_tmp_clob := REPLACE (l_tmp_clob, '[', '(');
       l_tmp_clob := REPLACE (l_tmp_clob, ']', ')');
       l_tmp_clob := REPLACE (l_tmp_clob, '\', '/');
       l_tmp_clob := REPLACE (l_tmp_clob, '^', '.');
       l_tmp_clob := REPLACE (l_tmp_clob, 'ù', 'u');
       --l_tmp_clob := REPLACE (l_tmp_clob, '_', '-');
       l_tmp_clob := REPLACE (l_tmp_clob, '`', '''');
       l_tmp_clob := REPLACE (l_tmp_clob, '{', '(');
       l_tmp_clob := REPLACE (l_tmp_clob, '|', '/');
       l_tmp_clob := REPLACE (l_tmp_clob, '}', ')');
       l_tmp_clob := REPLACE (l_tmp_clob, '~', '-');
       l_tmp_clob := REPLACE (l_tmp_clob, 'À', 'A');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Á', 'A');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Â', 'A');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ã', 'A');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ä', 'A');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Å', 'A');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ç', 'C');
       l_tmp_clob := REPLACE (l_tmp_clob, 'È', 'E');
       l_tmp_clob := REPLACE (l_tmp_clob, 'É', 'E');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ê', 'E');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ë', 'E');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ì', 'I');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Í', 'I');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Î', 'I');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ï', 'I');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ñ', 'N');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ò', 'O');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ó', 'O');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ô', 'O');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Õ', 'O');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ö', 'O');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ù', 'U');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ú', 'U');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Û', 'U');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ü', 'U');
       l_tmp_clob := REPLACE (l_tmp_clob, 'Ý', 'Y');
       mob_util_pck.log_write ('I','After Replacing Special Characters');
       mob_util_pck.log_write ('I','Before Creating New File '||l_dest_file);
       DBMS_XSLPROCESSOR.clob2file(l_tmp_clob, 'MOBSEPAOUT', l_dest_file);
       mob_util_pck.log_write ('I','After Creating New File '||l_dest_file);
       mob_util_pck.log_write ('I','Inside REMOVE_SPECIAL_CHARS procedure(-)');
    END REMOVE_SPECIAL_CHARS;
    This procedure is working fine for some special characters. But some special characters are getting replaced by different characters before performing the replace so it is causing wrong replacement of characters.
    eg- i need to replace & by +
    but it is changing it to +amp which is incorrect.
    Is it something related to characters encoding?
    Please help.
    Regards-
    Vikrant

    eg- i need to replace & by +
    but it is changing it to +amp which is incorrect.
    Is it something related to characters encoding?
    Due to its special meaning in the XML language, occurrences of the ampersand character '&' have be escaped to &amp; as well as '<', '>' and '"' respectively to &lt;, &gt; and &quot;.
    So in short, do not replace the ampersand character.

  • How to display file content in browser using servlet..? urgent!!!

    hello,
    i am building a application for which when a user logs in he will we redirected to page where he will have one link ,with this link a file is associated.
    when user press that link he should be able to see that particular file in internet browser....
    now can anybody give me a code sample of how to display a file in browser....
    please reply me as soon as possible...

    thanks for your reply....
    but i don't want this....
    i want to read a file from disk into stream or buffer and from that again reading and printing in browser.....
    a servlet should be built for this....
    i wrote this but its not working
    ========================================================
    public class FilePrinting extends HttpServlet
         public void doPost(HttpServletRequest req,HttpServletResponse res)
              throws IOException,ServletException
              ServletOutputStream out=res.getOutputStream();
              res.setContentType("text/html");
              String fileURL="/mydomainWebApp/Test.htm";
              res.setHeader("Content-disposition","attachment; filename=" +="Test.htm" );
              BufferedInputStream bis=null;
              BufferedOutputStream bos=null;
              try
                   URL url = new URL( fileURL );
                   bis=new BufferedInputStream(url.openStream());
                   bos = new BufferedOutputStream(out);
                   byte[] buff = new byte[2048];
                   int bytesRead;
                   // Simple read/write loop.
                   while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                   bos.write(buff, 0, bytesRead);
              }catch(final MalformedURLException e)
                   System.out.println ( "MalformedURLException." );
                   throw e;
              }catch(final IOException e)
                   System.out.println ( "IOException." );
                   throw e;
              }finally
                   if (bis != null)
                        bis.close();
                   if (bos != null)
                        bos.close();
    =======================================================================
    please send me sample code if anyone have../...

  • JSP Servlet and convert the result set of an SQL Query To XML file

    Hi all
    I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
    thisis my servlet which will call the jsp page and the jsp just behind it.
    //this is the servlet
    import java.io.*;
    import java.lang.reflect.Array;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.naming.*;
    import javax.sql.*;
    public *class *Campaign *extends *HttpServlet
    *private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
    *private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
    *private* DataSource _dataSource;
    *public* *void* setDataSource(DataSource dataSource)
    _dataSource = dataSource;
    *public* DataSource getDataSource()
    *return* _dataSource;
    *public* *void* init()
    *throws* ServletException
    *if* (_dataSource == *null*) {
    *try* {
    Context env = (Context) *new* InitialContext().lookup("java:comp/env");
    _dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
    *if* (_dataSource == *null*)
    *throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
    } *catch* (NamingException e) {
    *throw* *new* ServletException(e);
    protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    Connection conn = *null*;
    *try* {
    conn = getDataSource().getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
    // out.println("Le r&eacute;sultat :<br>");
    ArrayList <String> Lescomments= *new* ArrayList<String>();
    ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
    ArrayList <String> Lesnoms = *new* ArrayList <String>();
    *while* (rs.next()) {
    Lescomments.add(rs.getString("comments"));
    request.setAttribute("comments",Lescomments);
    Lesidentifiant.add(rs.getString("post_id"));
    request.setAttribute("id",Lesidentifiant);
    Lesnoms.add(rs.getString("postname"));
    request.setAttribute("nom",Lesnoms);
    rs.close();
    stmt.close();
    *catch* (SQLException e) {
    *finally* {
    *try* {
    *if* (conn != *null*)
    conn.close();
    *catch* (SQLException e) {
    // les param&egrave;tres sont corrects - on envoie la page r&eacute;ponse
    getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
    }///end of servlet
    }///this is the jsp page called
    <%@ page import="java.util.ArrayList" %>
    <%
    // on r&eacute;cup&egrave;re les donn&eacute;es
    ArrayList nom=(ArrayList)request.getAttribute("nom");
    ArrayList id=(ArrayList)request.getAttribute("id");
    ArrayList comments=(ArrayList) request.getAttribute("comments");
    %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    Liste des campagnes here i will create the xml file the problem is to display all rows
    <hr>
    <table>
    <tr>
    </tr>
    <tr>
    <td>Comment</td>
    <td>
    <%
    for( int i=0;i<comments.size();i++){
    out.print("<li>" + (String) comments.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>nom</td>
    <td>
    <%
    for( int i=0;i<nom.size();i++){
    out.print("<li>" + (String) nom.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>id</td>
    <td>
    <%
    for( int i=0;i<id.size();i++){
    out.print("<li>" + (String) id.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    </table>
    </body>
    </html>
    This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (*char*)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
    //outputFile.createNewFile();
    FileWriter outfile = *new* FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
    // Define connection string and make a connection to database
    Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
    Statement stat = conn.createStatement();
    // Create a recordset
    ResultSet rset = stat.executeQuery("Select * From posts");
    // Expecting at least one record
    *if*( !rset.next() ) {
    *throw* *new* IllegalArgumentException("No data found for the posts table");
    outfile.write("<Table>"+cLf);
    // Parse our recordset
    // Parse our recordset
    *while*(rset.next()) {
    outfile.write("<posts>"+cLf);
    outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
    outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
    outfile.write("</posts>"+cLf);
    outfile.write("</Table>"+cLf);
    // Everything must be closed
    rset.close();
    stat.close();
    conn.close();
    outfile.close();
    catch( Exception er ) {
    %>

    Please state your problem that you are having more clearly so we can help.
    I looked at your code I here are a few things you might consider:
    It looks like you are putting freely typed-in comments from end-users into an xml document.
    The problem with this is that the user may enter characters in his text that have special meaning
    to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
    You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
    You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
    if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
    When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
    and re-displayed correctly.
    Also, it looks like you are putting business logic in your JSP page (creating an xml file).
    The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client.

  • FTP to Read content of Text/xml file

    Hi,
    I need a help for reading content of text/xml file through FTP. Below I just am explaining the scenario.
    Our application server is in UNIX. Now we have to run a report program to access in to a FTP server which is in windows platform. Using FTP_CONNECT, FTP_COMMAND, FTP_DISCONNECT we are able to connect to FTP server and also able to copy files from FTP server to SAP application server. After copied in application server, we are able to read the content of the txt file in to internal table in ABAP program using OPEN DATASET. But our requirement is that we want to read the text or xml file content into internal table while accessing into FTP server from SAP application instead of after copying the file into application server.
    So please help me to solve my problem.
    -Pk

    Thank you Bala,
    But can you help me what should I pass against FNAME and CHARACTER_MODE Import parameter? Should I pass the full path of the file with name or only I have to pass file name ? For example if my text file name in FTP Server is test.txt and the IP of the ftp server is 10.10.2.3 then should I pass the value against FNAME as '
    10.10.2.3\xyz\text.txt' ? Here xyz is the name of the directory in C drive where test.txt is exist.
    Please help me.
    -pk

  • Access XML files from HTTP

    Hi,
    I need access XML file from HTTP. Server need parameters in the URL to generate XML files. For example, http://fileserver/xmlfile?orderid=123&custid=321.
    I created a XML Data Server in ODI 11g. The JDBC Url should be jdbc:snps:xml?f=<filename>&s=<schema>&d=<DTD>.
    However, it reports error when replaced the <filename> with "http://fileserver/xmlfile?orderid=123&custid=321".
    I found it's caused by ampersand of the HTTP Url. I guess ODI treat custid=321 as JDBC parameter rather than HTTP parameter.
    How to fill the JDBC Url in this situation?
    Thanks,

    i solved my problem by using the Socket object and controlling my file access by writing requests to the outputstream

  • Where to place an xml file that is read by  java class file  dir structure

    Hello all,
    I have an xml file that I am using in lieu of a database to track conference rooms . This is a small file. I need to read this file from my java class file which is used by a jsp. Currently I have an absolute path C://logger/conference.xml. All works fine but I need to deploy to a different machine soon and so I need to place this file somewhere in the project directory structure (created by netbeans) so that it will be included in the war file and can be read by the java class file.
    Also what would be the relative path to this suggested directory.
    TIA!!!

    public class DOMconference {
        /** Creates a new instance of DOMconference */
        public DOMconference() { }
        //private final static String XML_FILE_NAME = "/opt/conference.xml";//set the output file and location
        public String XML_FILE_NAME = "";
        private final static String FIRST_CONF_ID = "8200";//set the initial conference number
        static Document document;
        public void getFilePath(String path)
            XML_FILE_NAME = path.replaceAll("\\\\","/");
            System.out.println("XML==============="+XML_FILE_NAME);
        File file = new File(XML_FILE_NAME);
        *generic method that returns a Document object
       public Document getDocument() throws SAXException, ParserConfigurationException,
               IOException
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setIgnoringComments(true);
           factory.setCoalescing(true);
           factory.setNamespaceAware(false);
           factory.setValidating(false);
           DocumentBuilder builder = factory.newDocumentBuilder();
           document = builder.parse(file);   //HERE IS WHERE THE ERROR POINT S TO
           return document;
       }Here is the complete error:
    INFO: Server startup in 1282 ms
    XML===============C:/Documents and Settings/gforte/agi/build/web/WEB-INF/conference.xml
    [Fatal Error] bin:1:1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292)
    at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:172)
    at agi.DOMconference.getDocument(DOMconference.java:91)
    at agi.DOMconference.getLdapConferences(DOMconference.java:466)
    at agi.Ldap.getConferences(Ldap.java:243)
    at org.apache.jsp.test_jsp._jspService(test_jsp.java:111)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    [Fatal Error] bin:1:1: Content is not allowed in prolog.
    NotifyUtil::java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:606)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:571)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:936)
    at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:248)
    So if I change my code to this (note that all I change is how the constant XML_FILE_NAME is set and I copy and paste the path that is derived from getFilePath after the String.replaceAll call.):
    public class DOMconference {
        /** Creates a new instance of DOMconference */
        public DOMconference() { }
        private final static String XML_FILE_NAME = "C:/Documents and Settings/gforte/agi/build/web/WEB-INF/conference.xml";//set the output file and location
        //public String XML_FILE_NAME = "";
        private final static String FIRST_CONF_ID = "8200";//set the initial conference number
        static Document document;
        public void getFilePath(String path)
            //XML_FILE_NAME = path;//.replaceAll("\\\\","/");
            System.out.println("XML==============="+XML_FILE_NAME);
        File file = new File(XML_FILE_NAME);
        *generic method that returns a Document object
       public Document getDocument() throws SAXException, ParserConfigurationException,
               IOException
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           factory.setIgnoringComments(true);
           factory.setCoalescing(true);
           factory.setNamespaceAware(false);
           factory.setValidating(false);
           DocumentBuilder builder = factory.newDocumentBuilder();
           document = builder.parse(file);
           return document;
       }All is fine..
    Just in case, here is my xml file contents copy and paste from notepad.
    <?xml version="1.0"?><conf_rooms><conf_room><conf_id>8200</conf_id><conf_name>Conference room 1</conf_name></conf_room><conf_room><conf_id>8201</conf_id><conf_name>Conference Room 2</conf_name></conf_room><conf_room><conf_id>8202</conf_id><conf_name>dufus</conf_name></conf_room></conf_rooms>Thanks for hanging in there with me on this.
    Graham

  • FM to read XML files from Application server in ECC5.0

    Hi All,
    We need to pick up an XML file from Application server/FTP server. The requirement is to parse the XML file and process it to create material master. SAP provides standard function modules to read XML files.
    Now we need to read the XML file contents of MM01 and upload into SAP Data Base through BAPI
    I need to know about the Function modules to read XML files from Application Server and also about the FM's that will update the Date base tables with the data obtained form XML files.
    Regards
    Prathima

    Parsing XML data:
    http://help.sap.com/saphelp_nw04/helpdata/en/86/8280ba12d511d5991b00508b6b8b11/frameset.htm
    or alternatively check out ABAP online help for "CALL TRANSFORMATION".
    For creating the material master look at BAPI_STANDARDMATERIAL_CREATE.
    Thomas

Maybe you are looking for