Writing to XML files need help

Guys,
I need to pull out data from the database and write it to multiple flat files in XML.
I can't do it on the database server using utl_file, I need to do it on the client.
Can you tell me the best way to achieve it.
I am giving you a sample plsql that we have built.
I have to create one file for each deptno.
Your values suggestions/inputs would be appreciated.
Dhiren
declare
queryCtx dbms_xmlquery.ctxType;
cursor c1 is select * from dept;
result clob;
begin
for c1rec in c1
loop
queryCtx := DBMS_XMLquery.newContext('select .... from emp where deptno = c1.deptno');
result := DBMS_XMLquery.getXML(queryctx);
DBMS_XMLquery.closecontext(queryctx);
end loop;
end;

use the above pl/sql to generate xml.
next step would be to create a folder on the xmldb repository.
this has to be done with SYS user.
DECLARE
l_success      BOOLEAN := FALSE;
l_resourceURL  resource_view.any_path%TYPE := '/public/scott';
BEGIN
IF (NOT DBMS_XDB.EXISTSRESOURCE(l_resourceURL)) THEN
     l_success := DBMS_XDB.CREATEFOLDER(l_resourceURL);
     COMMIT;
END IF;
END;
/so now you have your folder as /public/scott under which you can create resources.
resources in XMLDB is nothing but files.
so the generated xml can be saved as xml file under the above path.
to create a resource, you need xmldata and the resource name.
eg.
dbms_xdb.createresource('/public/scott/myxml.xml', l_xml_data);
commit;
now you can ftp the resource to the client,
open <server name> 2100
user scott tiger
get /public/scott/myxml.xml c:\temp\myxml.xml
close
bye
that's it.
good luck.
check the port of the ftp . normally by default it is 2100 unless it is changed by your admin,

Similar Messages

  • How to create Inbound Idoc from XML file-Need help urgently

    Hi,
    can any one tell how to create inbound Idoc from XML file.
    we have xml file in application server Ex. /usr/INT/SMS/PAYTEXT.xml'  we want to generate inbound idoc from this file.we are successfully able to generate outbound XML file from outbound Idoc by using the XML port. But not able to generate idoc from XML file by using we19 or we16.
    Please let me know the process to trigger inbound Idoc with out using  XI and any other components.
    Thanks in advance
    Dora Reddy

    Hi .. Did either of you get a result on this?
    My question is the same really .. I am testing with WE19 and it seems SAP cannot accept an XML inbound file as standard.
    I see lots of mention of using a Function Module.
    Am I correct in saying therefore that ABAP development is required to create a program to run the FM and process the idoc?
    Or is there something tht can be done with Standard SAP?
    Thanks
    Lee

  • Java through javawebstart not loading the xml file.-- need help

    Dear All,
    I am using jdk1.2.06, tomcat 5.25
    In tomcat- inside webapps--mydirectory-- load.xml, applet1.java is present
    in the browser applet1.java is called through javawebstart,
    load.xml is loaded in applet1.java,where parsing is done in applet1.java,
    but my problem is load.xml is not loaded in applet1.java through java webstart
    Whether i want to do any pplicy file setting.. please clearly mention it..
    thanks in advance

    this is not the 'right' way to do it... but I think it should
    work. I didn;t change the function name although I think its
    supposed to be
    getdetailsfrmXML instead of getetailsfrmXML
    public function getEmpDetailsFrmXML() {
    var xmlFileName:String = "emp.xml";
    var employee_xml:XML = new XML();
    employee_xml['externalScope']=this;
    employee_xml.ignoreWhite = true;
    employee_xml.load(xmlFileName);
    employee_xml.onLoad = function(success) {
    if (success) {
    var xmlData = this;
    this.externalScope.getetailsfrmXML.call(this.externalScope,xmlData);
    } else {
    trace("file not found");
    public function getetailsfrmXML(details) {
    trace(employee_xml.toString()+" mkmop");

  • Is Stack configuration XML file needed for EHP4 installaton on ERP 6.0 SR2

    Hello ALL,
    Is Stack configuration XML file needed for EHP4 installaton on ERP 6.0 SR2,THE GUIDE SAYS IT IS OPTONAL
    is it?
    Rohit

    The central installation note
    Note 1143022 - Installation of SAP Enhancement Package 4 on SAP ERP 6.0
    says, that the Solution Manager Maintenance Optimizer should be used to generate the stack file to avoid any problems.
    Markus

  • Can't import xml file: "need translation document/template" - - help please

    Hi there,
    Someone edited a project with fcp 5.1. I have fcp 5.0. I've been asked to tweak the project (for no charge, which is fine with me; it's for a tiny 3rd-world charity organization).
    He sent me the project files as xml documents... but when I double click on them I get a window saying they "need translation document file", or translation template. Nothing in my fcp folder or app seems to do the trick.
    Can someone please advise me on this?
    I did a search before posting, and noticed that someone advised someone else that xml version 2 is the better xml file to work with. I don't know whether the xml files this guy sent me are v. 1 or 2.
    Any help would be very much appreciated!
    Malcolm

    Thank you Studio X. I've just sent off the request. I'll let you know if it works.
    IF it doesn't work... should I upgrade to FCStudio2, do you think? I didn't want to have to do that (I'm not being paid for this work, so I don't really want to go out of pocket), but if this XML2 thing doesnt' work, I'm not going to be able to do this project at all, it would seem. Which I would feel badly about.
    The other thing is, I've been sort of thinking that some day I'm going to have to get FCStudio2, so maybe I should just push that day up a bit.
    It would really bother me, though, if I go to the expense of getting FCStudio2, and then I still can't open these files.
    Cheers,
    Malcolm

  • I fouled up; erased library .itl and .xml files; need a little help

    I think I see what I did wrong (my issue relates to this reply post I submitted earlier today >> https://discussions.apple.com/message/16254985#16254985 but I don't think there's any need to go back and read that post to get the gist of my problem).
    So, after knocking around and reading a whole bunch of forum posts and Apple support pubs, I now know I did something dumb.
    Simply put, last night, in the course of attempting to delete from my MacBook Pro the iTunes library file residing there (the one designed to contain actual media files, i.e., music, books, podcasts, etc.), I also deleted the iTunes Library.itl and iTunes Library.xml files.  Yes, doh! is right.
    [BTW, the idea behind deleting the media library on the MBP was because my media files are -- and have been for some time -- located on an external hard drive.  So the good news is I still have all my media.  Of course, the bad news is I lost all playlists and a host of song-specific information and I'm sure a bunch of other stuff that is organized on the iTunes Library.itl file.  (Apple's helpful info sheet on the .itl and .xml files at >> http://support.apple.com/kb/HT1660)]
    So  I opened up iTunes today and there is nothing there, i.e., looks like just opened for the first time ever.  I now know that in the absence of the .itl and .xml files (which I trashed yesterday), iTunes went ahead and created new, empty versions of these files.
    HERE'S THE QUESTION: what should or can i do now to rebuild my library?  My media files still reside on my external HD and there they must stay because there isn't remotely enough room on the MBP hard drive itself.
    I'm just sort of stumped.  And skittish.  I don't want to make another dumb mistake that will make things even worse.  Any ideas?

    Hey, sorry to hear that, but good to know  that you have all your "stuff" and its just a matter of getting it all back together in the right place.  So, I have some ideas why it happened to me and maybe why this happened to you, which may be relevant later, but first I'll first explain how I got out of this jam.
    After much investigating, I finally did a search for .itl files and ended up "finding" one in the Media folder itself, specifically in the Music folder (yeah, should have done this much earlier).  Looking around, I also found the other files and folders that are supposed to be at same directory level as "iTunes Media." 
    At this point, I just moved them back to where they were supposed to be and opened iTunes and, voila, there was my stuff (albeit not quite all of it or exactly as it should be).  Then, after making sure my Media folder was properly identified in Advanced Preferences, I checked the boxes under File -> Library -> Organize Library and iTunes started doing some activity that seemed like it was reorganizing or rechecking the organization (you can see I am no expert here).
    So like I indicated, it wasn't exactly the way it was when I last used iTunes before I had the problems (e.g., various podcasts, books, etc. werent there -- so i just added them into the Library manually, i.e., File -> Add To Library, etc.).
    Anyway, I hope this helps if you haven't already fixed your problem.  If not, I might have some other ideas I came across while still searching for solution to my problem.  Best of luck.

  • XML Huge database files, NEED HELP !!!

    Hello to the community.
    We need to store about ONE MILLION XML FILES inside the database.
    BUT we need to use all functionality of XML Structure to look for
    information inside these files (CONTAINS).
    My question is:
    What is the best way to store them:
    like XML files inside CLOB ?
    or fragment the files inside tables ?
    Using ConText Option ?
    Using CONTAINS functions ?
    Is ConText Option supports CONTAINS function ?!?
    We have many queries with text searching...
    What is the best way to store this so we have best velocity to
    acces to the info ?
    Thanks to answer soon
    MasterPh
    null

    Let me try and answer your question. First the CONTAINS
    operator in Intermedia Text (formerly Context) will allow you to
    search for data between tags of an XML document stored as a
    CLOB. Whether you should distribute your XML documents across
    tables is largely a function of how you want the data searched
    retrieved. Currently the XML search function operates within a
    column and thus if you want the entire doc back it would be best
    to store it as a whole. Once iFS is released you will be able
    to distribute the doc across tables and return it as a whole or
    in parts.
    Chack out http://www.oracle.com/database/options/ifs.htm and
    http://www.oracle.com/database/options/intermedia.htm for more
    details.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Philippe Thomassigny (guest) wrote:
    : Hello to the community.
    : We need to store about ONE MILLION XML FILES inside the
    database.
    : BUT we need to use all functionality of XML Structure to look
    for
    : information inside these files (CONTAINS).
    : My question is:
    : What is the best way to store them:
    : like XML files inside CLOB ?
    : or fragment the files inside tables ?
    : Using ConText Option ?
    : Using CONTAINS functions ?
    : Is ConText Option supports CONTAINS function ?!?
    : We have many queries with text searching...
    : What is the best way to store this so we have best velocity to
    : acces to the info ?
    : Thanks to answer soon
    : MasterPh
    null

  • Need to contcat 10 xml files - Please help me its an URgent requirment

    Gurus,
    We have requirment to load 10 xml files into a target table(oracle). So thought to concat using ODIXMLCONCAT in a package
    Below are the Parameters i am passing:
    OdiXMLConcat "-FILE=D:/FILE_FOLDER/Trial_Average/Trial_Average*.xml" "-TOFILE=D:/FILE_FOLDER/IVBL_AGV_TRIAL_BAL.xml" "-XML_ELEMENT=GLXAVTRB" "-IF_FILE_EXISTS=overwrite" "-KEEP_XML_PROLOGUE=all"
    Only first xml file is loading and its failing with below error:
    java.lang.RuntimeException: Error while writting output xml
         at com.sunopsis.dwg.tools.xml.XMLJoiner.writtingException(XMLJoiner.java:260)
         at com.sunopsis.dwg.tools.xml.XMLJoiner$JoinerXMLFilterOutput.addEvent(XMLJoiner.java:39)
         at com.sunopsis.dwg.tools.xml.XMLFilter.process(XMLFilter.java:84)
         at com.sunopsis.dwg.tools.xml.XMLJoiner.join(XMLJoiner.java:195)
         at com.sunopsis.dwg.tools.XMLConcat.actionExecute(XMLConcat.java:133)
         at com.sunopsis.dwg.function.SnpsFunctionBase.execute(SnpsFunctionBase.java:276)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java:3437)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeOdiCommand(SnpSessTaskSql.java:1509)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:44)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
         at java.lang.Thread.run(Thread.java:662)
    Caused by: javax.xml.stream.XMLStreamException: Trying to output second root, <GLXAVTRB>
         at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1473)
         at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1480)
         at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1508)
         at com.ctc.wstx.sw.BaseNsStreamWriter.checkStartElement(BaseNsStreamWriter.java:444)
         at com.ctc.wstx.sw.SimpleNsStreamWriter.writeStartOrEmpty(SimpleNsStreamWriter.java:260)
         at com.ctc.wstx.sw.BaseNsStreamWriter.writeStartElement(BaseNsStreamWriter.java:319)
         at com.ctc.wstx.sw.SimpleNsStreamWriter.writeStartElement(SimpleNsStreamWriter.java:198)
         at com.ctc.wstx.evt.WstxEventWriter.add(WstxEventWriter.java:137)
         at com.sunopsis.dwg.tools.xml.XMLJoiner$JoinerXMLFilterOutput.addEvent(XMLJoiner.java:35)
         at com.sunopsis.dwg.tools.xml.XMLFilter.process(XMLFilter.java:84)
         at com.sunopsis.dwg.tools.xml.XMLJoiner.join(XMLJoiner.java:195)
         at com.sunopsis.dwg.tools.XMLConcat.actionExecute(XMLConcat.java:133)
         at com.sunopsis.dwg.function.SnpsFunctionBase.execute(SnpsFunctionBase.java:276)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java:3437)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeOdiCommand(SnpSessTaskSql.java:1509)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:44)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:561)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         ... 1 more

    I get the reason, you don't specify -HEADER and -FOOTER parameters, so ODI don't know what is the root node
    I created a package for demo
    1)
    OdiSqlUnload "-FILE=C:\Users\tinawang\Documents\1.xml" "-DRIVER=com.mysql.jdbc.Driver" "-URL=jdbc:mysql://localhost/employees?relaxAutoCommit=true" "-USER=root" "-PASS=aIyXe.NkGEUSr.G,WE1g" "-FILE_FORMAT=XML" "-ROW_SEP=\r\n" "-DATE_FORMAT=yyyy/MM/dd HH:mm:ss" "-CHARSET_ENCODING=UTF8" "-XML_CHARSET_ENCODING=UTF-8" "-FETCH_SIZE=10000"
    select * from employees where emp_no<10008
    2)
    OdiXMLSplit "-FILE=C:\Users\tinawang\Documents\1.xml" "-TOFILE=C:\Users\tinawang\Documents\xml\emp_*.xml" "-XML_ELEMENT=row" "-CHARSET_ENCODING=UTF-8" "-IF_FILE_EXISTS=overwrite" "-KEEP_XML_PROLOGUE=all"
    3)
    OdiXMLConcat "-FILE=C:\Users\tinawang\Documents\xml\emp_*.xml" "-TOFILE=C:\Users\tinawang\Documents\2.xml" "-XML_ELEMENT=row" "-CHARSET_ENCODING=UTF-8" "-IF_FILE_EXISTS=overwrite" "-KEEP_XML_PROLOGUE=all" "-HEADER=<table>" "-FOOTER=</table>"
    in step3) if you don't specify "-HEADER=<table>" "-FOOTER=</table>", you will get the same issue as you encounter.

  • How to load XML files ? HELP!

    Hi folks.
    We have an old Oracle database 7.3..
    So we need to load XML files into its tables.
    As we understand Oracle Loader doesn't help us.
    Is the way to load that files?
    Thanks in advance
    Alex

    I know you realize 7.3 is old but this is sort of like trying trying to view a DVD when you only have a VCR. Simple answer would be buy a DVD player, i.e. upgrade to a more recent version of Oracle where you will get many features to handle XML.
    How do you want the XML loaded, all as a single object? That could be a CLOB column if 7.3 had them, I am not sure. You would probably have to write PL/SQL and something with UTL_FILE (if 7.3 had that) to load it.
    If you want to put it multiple columns based on its tags, you would be better off parsing it using PERL (or something) into a CSV and loading that in SQL*Loader.
    I assume as this is using XML it is a reasonably recent design, combining that with an ancient version of the database is just going to lead to endless headaches.

  • Loading data from xml file - please help

    Hi, I am new to attempting to get data from an xml file load
    in flash. I followed a tutorial in a new fla and it seemed to work
    fine, I then tried to adapt it to my own needs which worked fine.
    But then when trying to implement this into my news section it
    doesn't seem to work.
    I am trying to make a news section, that displays the date
    and news article. This is in within a movie clip, I even tried
    putting it in the timeline of the scene but still nothing.
    - I have 2 dynamic text boxes, date_txt and news_txt
    - The xml file is named news.xml,
    - both the fla and the xml are in the same folder
    This is the actionscript I am using:
    function loadXML(loaded) {
    if (loaded) {
    _root.thedate =
    this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
    _root.thenews =
    this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
    date_txt.text = _root.thedate;
    news_txt.text = _root.thenews;
    } else {
    trace("file not loaded!");
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("news.xml");
    This is what I have in the xml document:
    <?xml version="1.0"?>
    <news>
    <article>
    <date>date</date>
    <news>newentry.</news>
    </article>
    <article>
    <date>Doug Engelbart</date>
    <news>Invented the mouse at the Stanford Research
    Institute</news>
    </article>
    </news>
    Does anyone perhaps have any ideas of what the problem could
    be?
    Help much appreciated.

    Hi
    _root refers to the Main Timeline, if your date_txt and
    news_txt are in a movieclip ie: news_mc
    then your path should read _root.news_mc.date_txt.text and
    _root.news_mc.news_txt.text
    You will also need to embed the characters you wish to use
    inside your dymanic text for it to show.
    Hope it helps

  • XML Files - PLEASE help!!

    Hi guys!
    Am desperately seeking some help on an XML issue please!!
    Am just wondering if anyone knows any limitations of having large XML files within B2B applications. Everywhere I look seems to suggest that there's no limit on the size of an XML file - this is grand, but is anyone aware of a performance downgrade when dealing with large files? And if so, what is the maximum recommended file size before performance is affected. Are there any other issues upon which file size would have a negative impact? Sorry if this sounds like a bit of a silly question but am a newbie to the design implications of XML and am in bad need of assistance!
    thanks a mill for all your help
    cheers
    bronniebee

    Well no, there's no limit on the size of an XML file by the specification, but in practice you will find that you almost always have to load the XML file into memory. This means that the larger the file, (a) the longer it takes to load and (b) the more likely it is you will run out of memory. I have seen it suggested that 10 megabytes is a practical upper limit for the size of an XML file to be processed in this way, but of course that would be just a rough guideline. If you have files much larger than that, you will have to use a SAX parser (which processes the XML sequentially) if you want to be able to handle it.
    But if you are talking about B2B, then most of your XML files will be transaction packets, right? Probably you wouldn't have a purchase order that large, for example. And you will be processing them asynchronously, right? (Nobody sitting at the browser waiting for a response.) That simplifies things because you don't have response time as an overriding requirement.

  • Writing a XML file

    Hello
    I have a question regarding XML.
    First of all, i have a simple Java application. It reads from a text file. The values are comma separated.
    James;54;painter
    Anna;20;teacher
    Joe;32;driverSo my java app creates 3 objects which contain above mentioned information (name, age, occupation).
    Now i need to create a XML file using that same application and it should also hold the above mentioned information . Standard Java API's are allowed.
    Which are my options? How i start? Any hints (besides "search from google)?
    Best Regards

    The SAX parser won't help you in creating XML docs -- only parsing.
    Typically people simply write the XML tags themselves, e.g.:
    String xmlOut = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + "<myclass><name>" + anObj.getName() + "</name></myclass>";
    Axis2 has some methods for generating XML from specially created objects, but it is a lot of work. I hear XMLBeans also has some methods for this, also a lot of work. Which is why most people fall back to the not very elegant method above.

  • Writing an XML file using a Servlet

    Hello, I'm trying to code a servlet that receives a POST from a HTTP and output its data to a XML file, the problem is that I get the following error:
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    XML document must have a top level element. Error processing resource 'http://localhost:8080/XMLSender/xmlsend'.
    I don't know what happens, because I'm NOT trying to show the content, just to save it, I post my code here so anyone can help me, please. Thanks in advance.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class xmlsender extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/xml");
    String cadenanumero = req.getParameter("numero");
    String cadenaoperadora = req.getParameter("operadora");
    String cadenabody = req.getParameter("mensaje");
    String cadenashortcode = req.getParameter("shortcode");
    File f1 = new File("salida.xml");
    FileWriter writer = new FileWriter(f1);
    writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    writer.write("<root>");
    writer.write("<tlf>" + cadenanumero + "</tlf>");
    writer.write("<op>" + cadenaoperadora + "</op>");
    writer.write("<sc>" + cadenashortcode + "</sc>");
    writer.write("<body>" + cadenabody + "</body>");
    writer.write("</root>");
    writer.close();
    }

    Yes, in fact what I want is the file to be in the server, now, I modificated my code to the following:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class xmlsender extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/HTML");
    String cadenanumero = req.getParameter("numero");
    String cadenaoperadora = req.getParameter("operadora");
    String cadenabody = req.getParameter("mensaje");
    String cadenashortcode = req.getParameter("shortcode");
    File f1 = new File ("salida.xml");
    FileWriter writer = new FileWriter(f1);
    /*salida.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    salida.println("<root>");
    salida.println("<tlf>" + cadenanumero + "</tlf>");
    salida.println("<op>" + cadenaoperadora + "</op>");
    salida.println("<sc>" + cadenashortcode + "</sc>");
    salida.println("<body>" + cadenabody + "</body>");
    salida.println("</root>"); */
    salida.println("Finalizado");
    f1.createNewFile();
    writer.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    writer.write("<root>");
    writer.write("<tlf>" + cadenanumero + "</tlf>");
    writer.write("<op>" + cadenaoperadora + "</op>");
    writer.write("<sc>" + cadenashortcode + "</sc>");
    writer.write("<body>" + cadenabody + "</body>");
    writer.write("</root>");
    writer.close();
    It still do not create my file "salida.xml", still don't know why. Any help is welcome.

  • Writing an XML file from JSP

    Hi
    for some this question will seem to be a stupid, but i am really confused how can i write an XML file from with in JSP code. should i have to use same FileOutPutStream.
    Actually i am trying to make reports using Jasper api. It demands for an XML file which will then b converted into PDF file. Can any one help me in it.

    Jasper converts a JSP into a servlet - and cannot be used to generate PDFs.
    Assuming this is for a web application I would
    1. Generate the XML
    2. Generate the PDF from the XML
    3. Send the PDF to the client from a servlet (i.e. forget the JSP).
    Step 2 is actually quite complicated - you could do this manually with the IText API (http://www.lowagie.com/iText/) or use an XSL approach with Apache FOP (http://xmlgraphics.apache.org/fop/)

  • PARSING HTML ELEMNETS IN XML FILE?,Help please very urgent

    I am getting the input in this form
    <ul>
    <li>Strategies</li>
    <li>Planning</li>
    <li>Value</li>
    <li>Total Investment</li>
    </ul>
    I want to convert it into below format so that ContentHandler parse the HTML tages.The HTML elements are dynamic,
    contentHandler.startElement("", "ul", "ul", attrs);
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.characters(value.toCharArray(), 0, value.length());
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.characters(value.toCharArray(), 0, value.length());
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.characters(value.toCharArray(), 0, value.length());
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.characters(value.toCharArray(), 0, value.length());
    contentHandler.startElement("", "li", "li", attrs);
    contentHandler.endElement("", "ul", "ul");
    Is their any library through which we can convert HTML tags into ContentHandler elements.
    Thanks in Advance
    Thanks
    Lakhi

    Actually i am parsing XML file,but i have HTML elements inside XML elements:
    <section id='2'><header><line>Agenda( Slide2 )</line></header>
    <line>
    <h3>Agenda</h3>
    <ol>
    <li>Overview of ABC Company inc.</li>
    <li>Defining and Measuring Employee Engagement</li>
    <li>Foresight's Survey Methodology</li>
    <li>Online Tools</li>
    <li>Standard and Custom Reporting Capabilities</li>
    <li>Action Planning and Best Practices</li>
    </ol></line></section>
    And i am using Contenthandler interface to parse,
              attrs.addCDATAAttribute("id",""+i);
                   contentHandler.startElement("", "section", "section", attrs);
                   attrs.clear();
                   contentHandler.startElement("", "header", "header", attrs);
                   contentHandler.startElement("", "line", "line", attrs);
                   contentHandler.characters(key.toCharArray(), 0, key.length());
                   contentHandler.endElement("", "line", "line");
                   contentHandler.endElement("", "header", "header");
                   contentHandler.startElement("", "line", "line", attrs);
    /*HERE I need to Generate java instruction for HTML elements as i mailed before.for elements like <li>Overview of ABC Company inc.</li>
    <li>Defining and Measuring Employee Engagement</li>...................</ol>
                   contentHandler.characters(value.toCharArray(), 0, value.length());
                   contentHandler.endElement("", "line", "line");
                   contentHandler.endElement("", "section", "section");

Maybe you are looking for