Write XML file on client

I'm trying to generate XML files on a client machine. I'm using SQL*Plus Instant Client v 10.1.0.4.0 connected to DB version 10.1.0.3.0. I've created a view of XMLType and am able to select XML from this view. I've been unable to figure out a way to generate well-formed XML via a Spool command and Select statement as Sqlplus returns the XML as one row and has problems with line wrapping, embedded spaces, and also including the SQL command in the spooled output. I've tried many different permutations of Set commands to no avail.
Is there a way to generate a valid XML file from Sqlplus on a client machine using the Spool command? If not Sqlplus, any other suggestions?
Thanks,
Glenn

I would be inclined to write a pipelined function to take a clob, and break it up into pieces (perhaps after a '>').
Here's an example of a pipelined function, which you can modify to suit your needs, such as working with CLOBs. You may also want to add more intelligence to it, such as checking for when the chunk is longer than 2000 characters.
CREATE TYPE tvc2000 AS TABLE OF VARCHAR2(2000)
CREATE OR REPLACE
FUNCTION chopper
  p_string IN VARCHAR2
RETURN tvc2000
PIPELINED
IS
  l_len NUMBER := LENGTH(p_string);
  l_out NUMBER := 0;
  l_pos NUMBER;
BEGIN
  l_pos := INSTR(p_string, '>', l_out+1);
  WHILE l_pos > 0 LOOP
    PIPE ROW(SUBSTR(p_string, l_out+1, l_pos - l_out));
    l_out := l_pos;
    l_pos := INSTR(p_string, '>', l_out+1);
  END LOOP;
  IF l_out < l_len THEN
    PIPE ROW(SUBSTR(p_string, l_out+1, l_len - l_out));
  END IF;
  RETURN;
END;
SELECT *
FROM TABLE(chopper('abc>def>'))
COLUMN_VALUE
abc>
def>Tak

Similar Messages

  • How to read and write Xml file at client side using JavaScript !

    Hello,
    i am new to javascript.
    I have requirement to read and update XML file at client side.
    Will you please guide what could be the best way to read and update XMl file using javascript.
    Thanks,
    Zuned

    This is a Java forum,not a Javascript forum. Maybe you should ask here [http://www.webdeveloper.com/forum/forumdisplay.php?forumid=3&s|http://www.webdeveloper.com/forum/forumdisplay.php?forumid=3&s].

  • Writing and updating XML file on client side

    Hello,
    I'm looking for a simple example which permit to write and
    update a xml file on the client side.
    Someone can help me, please?

    meghashyamgr ,
    Because of security reasons a swf running in a browser cannot
    read or write xml files to a user's computer. What can be done,
    however, is write xml to what is known as a SharedObject.
    SharedObjects act as cookies for Flashplayer.
    If you would like an example of this I'd be more than happy
    to show you...

  • Sending xml file from client to servlet

    Hi,
    I am writing the server component of an applcation, such that it will receive xml files from the clients(standalone application similar to javaSwing stuff but it's coded in C#), and the servlet will have to extract the data from the xml file and update the mySql database. it will also fulfill the client's request for xmlFiles (and extract data from DB, format to xml file and send back to client)
    I'm new to implementing the servlet receiving files from clients so would need some help.
    I've got 3 questions to ask:
    1) How does the servlet receive/returns the xml file from the client as a series of httpPost request/response. Do i send a File or the file's contents as a String to/from the client?
    2) Is it also a must to use socket for the file transfers? I have read in other posts about sockets as well as HttpURLConnection but i don't quite understand.
    3) When I send a file back to the client(client is standalone application written in C# whereas server is coded in java), what do i specify for the HttpResponse.setContentType() in my servlet? (i'm returning the xml file to client)
    Would really appreciate for any help rendered. If you have any useful links, would appreciate them too. Thanks a lot.
    Karen

    I've got 3 questions to ask:
    1) How does the servlet receive/returns the xml file
    from the client as a series of httpPost
    request/response. Do i send a File or the file's
    contents as a String to/from the client?The server will listen on some port for requests. The client has to open a socket to this server to send the file as string to the server.
    see http://java.sun.com/docs/books/tutorial/networking/index.html
    >
    2) Is it also a must to use socket for the file
    transfers? I have read in other posts about sockets as
    well as HttpURLConnection but i don't quite
    understand.You use HttpURLConnection to make a request using the http protocol, instead of opening a socket and then writing the html headers yourself.
    3) When I send a file back to the client(client is
    standalone application written in C# whereas server is
    coded in java), what do i specify for the
    HttpResponse.setContentType() in my servlet? (i'm
    returning the xml file to client)Its up to your receiving program how to interpret this though, so you probably dont need this.

  • Java applet writes to file on client, no signing necessary

    Hi,
    I wonder if this is a feature or bug:
    I download and execute in my browser an unsigned applet/jar myCharts.jar from server. The applet references classes from package org.jfree.chart, which are not packed in myCharts.jar downloaded from server, but are locally stored on client in jre/lib/ext/jfreechart.jar (and therefore JVM running the applet loads and uses these local classes from local jar).
    The applet can write the file to client disk without any problem using classes from locally loaded jfreechart.jar. If I merge both jars into a big one and load it through network, file write access is forbidden.
    I am using JRE 1.5.0.3 for Windows and default java_policy file with 2      permissions added:
    permission java.lang.RuntimePermission "accessDeclaredMembers";
    permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
    Is it a bug, or feature ?
    According to my opinion these 2 permissions should not result in applet ability to write files using locally loaded classes.
    Thanks for your answer
    Martin

    The following is a duplicate posting in reponse to similar question:
    http://forum.java.sun.com/thread.jsp?forum=4&thread=200482&start=0&range=30#735223
    In short, you cannot write to a server without help from servier-side software such as a servlet, cgi, ASP, etc.
    If you go with something like an Oracle database on your server, it's a non-issue because the seucirty aspects are taken care of for you.
    V.V.

  • Exception while trying to write xml file

    When I try to write my DOM tree to an XML file a get the following exception form the transformer.transform() function call:
    Exception in thread "AWT-EventQueue-0" java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone()Z
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373)
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127)
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:662)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:708)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
    at CentMon.ConfigRW.writeConfig(ConfigRW.java:77)
    The whole thing worked for 2 years. I did not change anything on the code. the only difference is that i have now office 2007 installed instead of office 2003.
    That's the code which generates the exception:
    import java.io.File;
    import java.io.IOException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    public void writeConfig(Document doc){
    TransformerFactory tFactory =
    TransformerFactory.newInstance();
    Transformer transformer;
    if (doc==null){
    System.out.println("Document is null");
    else{
    try {
    transformer = tFactory.newTransformer();
    } catch (TransformerConfigurationException e) {
    transformer = null;
    System.out.println(e.getMessage());
    DOMSource source = new DOMSource(doc);
    StreamResult result = new StreamResult(new File(filename));
    try {
    if (transformer != null){
    transformer.transform(source, result);
    } catch (TransformerException ex) {
    Logger.getLogger(ConfigRW.class.getName()).log(Level.SEVERE, null, ex);
    }

    I am getting the exact same error when trying to write out an XML file. I have been following the J2EE Tutorial. Perhaps I need to look for a more recent tutorial.
    Exception in thread "AWT-EventQueue-0" java.lang.AbstractMethodError: org.apache.crimson.tree.XmlDocument.getXmlStandalone()Z
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.setDocumentInfo(DOM2TO.java:373)
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:127)
    at com.sun.org.apache.xalan.internal.xsltc.trax.DOM2TO.parse(DOM2TO.java:94)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:662)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:708)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:313)
    at com.wordhopper.xml.DOMXMLParser.writeXMLFile(DOMXMLParser.java:55)
    at com.wordhopper.gui.xmltool.XMLEditor.writeButtonActionPerformed(XMLEditor.java:217)
    at com.wordhopper.gui.xmltool.XMLEditor.access$100(XMLEditor.java:13)
    at com.wordhopper.gui.xmltool.XMLEditor$2.actionPerformed(XMLEditor.java:139)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
    at java.awt.Component.processMouseEvent(Component.java:6348)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
    at java.awt.Component.processEvent(Component.java:6113)
    at java.awt.Container.processEvent(Container.java:2085)
    at java.awt.Component.dispatchEventImpl(Component.java:4714)
    at java.awt.Container.dispatchEventImpl(Container.java:2143)
    at java.awt.Component.dispatchEvent(Component.java:4544)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
    at java.awt.Container.dispatchEventImpl(Container.java:2129)
    at java.awt.Window.dispatchEventImpl(Window.java:2475)
    at java.awt.Component.dispatchEvent(Component.java:4544)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

  • Write a file on client from java procedure

    Hello to all, my problem is that i want to write a file from a java procedure using the normal java class. But when i try to write
    File file=new File("C:\\DiscoD\\myFile.txt");
    FileWriter fw=new FileWriter(file);
    fw.write("ciao");
    nothing happens and no file is created. How can i write a file on my pc client from java procedure?
    Thanks to anyone that want helps me.

    I want to write a java procedure loading java class on oracle with utility loadjava and this work for example for classical Hello World. Now i want to write data on a text file on my hard disk using class java calling the procedure for example in this mode:
    begin
    procedure('ciao'); //this procedure have to write on a file located on my pc the word ciao
    end;
    But nothing happens. Why? There is a special reason related to how oracle works(privileges, permission etc)?
    Thanks

  • [JS] Write XML file

    Hello 
    I read an XML file I y contribution of the change and I want to write it in a new XML file.
    I would get this presentation
    but I opt cesi
    Here is my code :
        leDossierOEBPS = "~/Desktop/content/";
        monEcritureContent(File (leDossierOEBPS + '/content.opf'),File (leDossierOEBPS + '/content5.opf'));
    function monEcritureContent(refFile,refFile2) {
       default xml namespace = 'http://www.idpf.org/2007/opf';
        var XMLHeader = '<\?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>';
        var XMLWorkbookHeader = "<\?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
        var XMLWorkbookHeader2 = " xmlns=\"http\://www.idpf.org/2007/opf\" unique-identifier=\"bookid\" version=\"2.0\"";
               if(refFile != null) {
                            refFile.open("r");
                            var XMLToParse = refFile.read();
                            refFile.close();
                            XMLToParse = XMLToParse.replace(XMLWorkbookHeader,"");
                            XMLToParse = XMLToParse.replace(XMLWorkbookHeader2,"");
                            var XMLData2 = new XML(XMLToParse);
                            XMLToParse = null;
                } else {
                        alert("Error opening XML file.");
    refFile2.open("w");
    refFile2.encoding = "UTF8";
    refFile2.writeln (XMLHeader+XMLData2.toXMLString());
    refFile2.close();
    What is the correct control to write the XML tree?
    Thank you

    I would like to used the class "namespace". 
    Currently I use it like this:
    default xml namespace = 'http://www.idpf.org/2007/opf';
    but I also have to put the two following
    unique - identifier = "bookid" version = "2.0".
    But my its too short deep.
    Thank you

  • EP6 sp2: Editing authschemes.xml file for Client Certificates - Urgent

    Urgent Help Needed..
    I am trying to modify the authschemes.xml file so that i can have Client Certificate Authentication. Has anyone done this before? I am unable to get client certificate authentication working. I also need to get rid of form based logon screen?
    Please help.
    regards
    anton

    Hi detlev,
    I followed all the instructions i can find but nothing explains what exactly i need to implment to request client certificates in the xml file.
    I want portal to request the client cert as soon as they hit the portal webpage. I am also going through IIS6 with iisproxy module installed.
    I am using verisign certificates, i configured J2ee engine to request the root cert for the client cert for the SSL port but that does not work. I get the dialog box requesting in IE asking me to choose a cert but i can make any selection its greyed out. After i say yes it connects to me to the portal logon screen.
    Here is the authscheme that i am using.
    <authschemes>
            <!--  authschemes, the name of the node is used -->
            <authscheme name="uidpwdlogon">
                <!-- multiple login modules can be defined -->
                <loginmodule>
                    <loginModuleName>com.sap.security.core.logon.imp.CertLoginModule</loginModuleName>
                    <controlFlag>SUFFICIENT</controlFlag>
                    <options></options>
                </loginmodule>
                <loginmodule>
                    <loginModuleName>com.sap.security.core.logon.imp.DefaultLoginModule</loginModuleName>
                    <!-- specifying whether this LoginModule is REQUIRED, REQUISITE, SUFFICIENT, or OPTIONAL -->
                    <controlFlag>REQUISITE</controlFlag>
                    <options></options>
                </loginmodule>
                <priority>21</priority>
                <!-- the frontendtype TARGET_FORWARD = 0, TARGET_REDIRECT = 1, TARGET_JAVAIVIEW = 2 -->
                <frontendtype>2</frontendtype>
                <!-- target object -->
                <frontendtarget>com.sap.portal.runtime.logon.default</frontendtarget>
            </authscheme>

  • Write XML file in application server

    Experts,
    I'm using a transformation to generate a xml file:
      CALL TRANSFORMATION zdatafechomes
      SOURCE ficheiroexecucao = gt_source[]
      RESULT XML  xml_result.
    It's working fine. But i'm having problems in putting the "xml_result" (it's a type xtring) into the application server.
    Anyone knows how to do it ? Transaction cg3z it's different because the file comes from C:
    Best Regards,
    Mário.

    Hello Mario
    I do not see why the following logic should not work:
    *& Report  ZUS_SDN_XML_XSTRING_APPLSERVER
    REPORT  ZUS_SDN_XML_XSTRING_APPLSERVER.
    DATA:
      gd_dsn            type string,
      gd_xstring        type xstring,
      gt_kna1           type STANDARD TABLE OF kna1.
    start-of-selection.
      select * from kna1 into table gt_kna1 up to 10 rows.
      BREAK-POINT.
      call TRANSFORMATION id
        source itab = gt_kna1
        result xml = gd_xstring.
        gd_dsn = '/tmp/xml_as_xstring.file'.
        open DATASET gd_dsn for OUTPUT in BINARY MODE.
        check ( syst-subrc = 0 ).
        TRANSFER gd_xstring to gd_dsn.
        CLOSE DATASET gd_dsn.
    end-of-SELECTION.
    Regards
      Uwe

  • File Adapter write XML file with special characters

    Hi,
    I have a BPEL processes which use DB adapter to retrieve record and output in a XML document using File Adapter.
    In the table, some records contain these special characters - ">" , "<" , "." . I was expecting the file adapter will convert it to escape characters, but it didn't happen. it just put the same value back to the XML file, which cause other system to reject the file. Do anyone know how to resolve this ?
    The version of SOA is 10.1.3.4
    Thanks for the help.
    Calvin
    Edited by: user12018221 on May 25, 2011 1:48 PM

    one option is to specify validateXML on the partnerlink (that describes the file adapter endpoint) such as shown here
    <partnerLinkBinding name="StarLoanService">
    <property name="wsdlLocation"> http://<hostname>:9700/orabpel/default/StarLoan/StarLoan?wsdl</property>
    <property name="validateXML">true</property>
    </partnerLinkBinding>
    hth clemens

  • Read and Write XML files

    I work on a Flex application that will be used to record time entries for manufacturing plan. I have two problems to solve:
    1- Can I read an XML file from a local drive? (C: /temp/file)
    2- If the system where I call the web service is offline, I must create local file that are going to be read later vwhen the system will be up again. How can I create local file from Flex?

    A web-based app cannot access the local drive w/o user permission.
    Sometimes, folks upload local files to a server (also requiring user
    permission) and then request the file from the server.
    You can use local SharedObject to store data, although there are limits to
    how much data.
    The recommended option is to create an AIR app.  It will be able to access
    the local drive once it is installed.

  • How to write xml files

    I have a simple jsp page having name and id field, when user submits the page, it will create a xml file having datas of the user entered.and later if another user add his data, then it will update the xml file

    Extract the name, id whatever fields from the jsp page into a bean after submit. Then you can use DOM or SAX parser implementation to create a new xml file for the values you are now in your bean from jsp page.
    You can create the XML using DOM or SAX parsers. The implementation of those are almost easy. For better work you can also use JAXB if the application is complex or the XML format is complex and huge.
    -Sachin
    I have a simple jsp page having name and id field,
    when user submits the page, it will create a xml
    file having datas of the user entered.and later if
    another user add his data, then it will update the
    xml file

  • Write PDF file to client's machine using Applet

    Hi all,
    I want to use Java Applet to write a PDF file into the client's computer when he/she double click the URL in browser. Can I do that and HOW. I heard that i need to signed the applet and make security manager enable, but how to do it?
    Also, is it any different to do this for IE5X and NS4X browser?
    Thanks for your information.

    Hi,
    I don't know how to do that with a signed applet (excepting if you want to write in the PDF format), but you can do this with a script (like asp) and an active X written with VB. You can build and manipulate Word or Excel Object with VB and so build dynamically your document.
    When your document is ready (in the active X), you can use the distiller from acrobat (you need a license to use it) and you can create a new file on your hard drive (server side).
    Your script will do the following:
    1) load (createobject) the active X
    2) call the method in the active x
    3) redirect the client to the correct page (the new document you created)
    I don't have any code to give you, but I did the same thing last year and it worked...
    I think that you can also interact between an applet and an active X (I saw something like that in the forum)...
    Of course this solution is running server side (the file will be created server side) but the client will be able to see his document in his browser and will be able to save it.
    I hope that it can help you even if it is not with java...
    Blaise

  • Can Sax not write xml file?Thanks!

    Thanks!

    http://java.sun.com/xml/jaxp/dist/1.1/docs/tutorial/sax/2a_echo.html
    this example just writes the xml to System.out. it's not hard to write the xml to a file instead.

Maybe you are looking for

  • Work Center Utiliztion Report

    Dear Guruji In which tansaction code i can get report.It is compolsury to click on Capacity Durring Process order creation.i searching standard report Thanks Pankaj Kapadia

  • Creating external table - from a file with multiple field separators

    I need to create an external table from a flat file containing multiple field separators (",", ";" and "|"). Is there any way to specifiy this in the CREATE TABLE (external) statement? FIELDS TERMINATED BY "," -- Somehow list more than just comma her

  • Which table could i get the information of Sales org. and DC relationship?

    Thanks! And could you tell in what way could i found the corresponding table corresponding to any SPRO transactions?? Thanks

  • Error using OLAP Bridge

    I have recently began trying to use the OLAP bridge to transfer data from OWB to be used by BI Beans applications (ROLAP, not MOLAP/AW). I have set up the bridge to run, but I always get the following error on my first dimension. Am I missing a step?

  • Problem with m3u files and Quicktime

    Hello: I have made one update with Quicktime software (version 7.6.9 1680.9). The problem is that Quicktime player reproduces mp3 files but when I try to play m3u files the sound is very bad. It sounds like gargling. For example: This files play ok: