How do i marshall to send the xml?

i have to send a xml
through JMS
i have the lib where i can build the object, but
how do i marshall it into a XML?...
for sending?
i am using 1.5

There's a bit in here on marshalling.
http://java.sun.com/webservices/docs/1.4/tutorial/doc/index.html
Problem with JAXB (and I could be wrong - try posting on the Web Services / XML forum) is that you can only marshal the generated classes. This may mean that you need to create the object, and populate it using the setter / getter methods.
Castor is much more friendly for this as it can marshall objects using reflections. You may also want to look into XMLBeans (which I have no exp of)

Similar Messages

  • How to send the  XML  format SOAP request to retrieve the Opportunity

    Hello,
    Can any body suggest me how to send the SOAP request to CRM OnDemand in the format of XML to retrieve the Opportunity ?.
    Thanks,
    --bdr_09                                                                                                                                                                                                                                                                                                                               

    I'm afraid you can't.
    If you want to export/import, you should consider using loader, insert (no sqldev needed for import) or even csv (sqldev needed for import) . If you have a lot of data, consider external tools like Data Pump.
    Have fun,
    K.

  • How to create a errortag in the XML-Output ?

    Hey
    who can help me creating a error-tag in my XML-output of a PL/SQL procedure ?
    Enviroment:
    Oracle DB is 8.1.7 with installed XDK-package (in a few
    weeks perhaps Oracle 9i). I've no problems to use the dbms_xmlquery-functions and -procedures.
    I've to develop a PL/SQL procedure which is called via JDBC from a JAVA program. The procedure execute a Select-Statement. The result is transformed in XML and stored in a CLOB, which is given back to the calling JAVA-program.
    There exist 2 possible result-situations.
    -1- one or more rows are found
    -2- no row is found
    Problem:
    For each of these situation the XML-Output should have a different structure and my main problem is to integrate the errortag !!!
    for -1-
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <data>
    <error err_code="NoError"/>
    <record num="1">
    </record>
    <record num="2">
    </record>
    </data>
    for -2-
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <data>
    <error err_code="NoDataFound"/>
    </data>
    Hope somebody can help me ???
    Andre

    Hey Rajat,
    thanks for your answer, but the errortag is needed by another department. They use it for their processing.
    Have you got any idea, how to integrate the errortag with the functions or procedures of the dbms_xmlquery package ??? I've got only a few days experience with the dbms_xmlquery-package, so some code examples or advices would be great !!!
    I've tried the following coding:
    out_xmlresult OUT CLOB; -- OUT Parameter of the PLSQL-Proc
    c1 CLOB;
    queryctx dbms_xmlquery.ctxtype;
    -- create XML-context
    queryctx:=dbms_xmlquery.newcontext(<selectstatement>);
    -- delete the rowsettag (use 'data' later on)
    dbms_xmlquery.setrowsettag(queryctx,'');
    -- create new tag 'data' which enclose an empty header
    -- and the data section
    dbms_lob.createTemporary(c1, TRUE );
    c1:=EMPTY_CLOB();
    dbms_xmlquery.setDataHeader(queryctx,c1,'data');
    -- rename rowtag
    dbms_xmlquery.setrowtag(queryctx,'record');
    -- set encoding tag
    dbms_xmlquery.setEncodingTag(queryctx,'ISO-8859-1);
    -- create XML-Output
    out_xmlresult := dbms_xmlquery.getxml(queryctx);
    ...but I haven't got any success !!!
    Andre

  • How to use rule and send the same email to multiple recipents

    Hi,
    My requirement is to send the workitem to the multiple recipents. one of my reiend suggest me to use the rule but i don't know how to use that .
    can any one of you suggest me how to use rule in workflow.
    Also i want to send the same email to multiple recipent .how can i do it by using the multiline variable...please advice me with example if possible..
    Note :- Is it necessary to saparate the email id with comma or i will add all the email next one another..
    Please suggest.
    Thanks in advance ,
    Anand

    Hi Anand,
    I would suggest you first follow the guidelines of the forum and a little searching. One of your questions has been asked just a few threads below.
    Regards,
    Martin

  • How to Handle Error in sending the 100000 fields from a table

    Hi,
           Suppose i have 100000 records in a table ,and  when i transfer the table   ,i could only send 5000 records..
    what is the reason for such behavior and how to send all the records at a time?????
    Thank you..

    Hi,
          I was asked this in an interview.. I was told while sending the 100000 records ,only 5000 can be sent ??what is the error and how to send all the 100000 records @ time...
    Edited by: lavanya c on May 13, 2010 8:29 AM
    Edited by: lavanya c on May 13, 2010 8:42 AM

  • How to use XmlModify to sort the XML Data?

    Hello,
    I saw some examples explain how to use XmlModify in BDB XML package. I want to sort the XML data by several elements but my Java program could not work correctly.
    <CustomerData>
    <Transaction>
    <DLSFIELDS>
    <ADR_PST_CD>12345</ADR_PST_CD>
    <CLT_IRD_NBR>002</CLT_IRD_NBR>
    </DLSFIELDS>
    </Transaction>
    <Transaction>
    <DLSFIELDS>
    <ADR_PST_CD>12345</ADR_PST_CD>
    <CLT_IRD_NBR>102</CLT_IRD_NBR>
    </DLSFIELDS>
    </Transaction>
    // many nodes like transaction ...
    </CustomerData>
    My XQuery script was executed successfully in the shell. The script looks as follows:
    "for $i in collection('sample.dbxml')/CustomerData/Transaction order by xs:decimal($i//ADR_PST_CD), xs:decimal($i//CLT_IRD_NBR) return $i".
    The Java code :
    // create XmlManager
    XmlManager manager = // ...;
    // open XmlContainer
    XmlContainer container = // ...;
    XmlQueryContext context = manager.createQueryContext(XmlQueryContext.LiveValues, XmlQueryContext.Eager);
    XmlQueryExpression expression = manager.prepare("for $i in collection('sample.dbxml')/CustomerData/Transaction order by xs:decimal($i//ADR_PST_CD),xs:decimal($i//CLT_IRD_NBR) return $i", context);
    XmlModify modify = manager.createModify();
    XmlUpdateContext uc = manager.createUpdateContext();
    XmlDocument xmldoc = container.getDocument("sample.xml");
    XmlValue value = new XmlValue(xmldoc);
    long numMod = modify.execute(value, context, uc);
    System.out.println("Peformed " + numMod     + " modification operations");
    Could you point out the errors above or offer some suggestion?
    Thanks.

    I have other question of the sorting issue. Here are a large XML need to sort so I have to split it to multiple small XML files. After importing these files, I will use the XmlModify and XQuery to sort them. I'm not clear on the multiple XML files processing.
    1. Can the BDB XML ensure that all these XML files were sorted or how to update all documents with same logic.
    2. If I want export all these sorted documents, how can I ensure these files processed in sequence? Which document needs process first?
    The export method:
    public void export(String outputfile)throws Exception{
    final int BLOCK_SIZE = 5 * 1024 * 1024; // 5Mb
    try{
    File theFile = new File(outputfile);
    FileOutputStream fos = new FileOutputStream(theFile);
    byte[] buff= new byte[BLOCK_SIZE];                         
    XmlResults rs = container.getAllDocuments(new XmlDocumentConfig());               
    while(rs.hasNext()){
         XmlDocument xmlDoc = rs.next().asDocument();
         XmlInputStream inputStream = xmlDoc.getContentAsXmlInputStream();                    
         long read=0;
         while(true){
         read = inputStream.readBytes(buff, BLOCK_SIZE);
    fos.write(buff,0,(int)read);                    
         if(read < BLOCK_SIZE) break;
    inputStream.delete();
    xmlDoc.delete();
    rs.delete();
    //MUST CLOSE!
    fos.close();               
    catch(Exception e){
    System.err.println("Error exporting file from container " + container);
    System.err.println(" Message: " + e.getMessage());
    Thanks.

  • How to acheive this output during the XML conversion ?.

    I am converting the data into XML. I am using Oracle8i.
    create table emp(empno number,
    ename varchar2(20),
    deptno number);
    insert into emp values(101,'Krish',10);
    insert into emp values(102,null, 10);
    insert into emp values(103,'Scott',20);
    commit;
    CREATE OR REPLACE PROCEDURE STP_TEST_XML AS
    v_context DBMS_XMLQUERY.CTXTYPE;
    v_document CLOB;
    v_error_code VARCHAR2(3) := 'OK';
    BEGIN
    v_context:= DBMS_XMLQUERY.NEWCONTEXT('SELECT * FROM EMP');
    DBMS_XMLQUERY.USENULLATTRIBUTEINDICATOR(v_context,TRUE);
    DBMS_XMLQUERY.SETROWSETTAG(v_context,'EMPIMPORT');
    DBMS_XMLQUERY.SETROWTAG(v_context,'EMP');
    v_document := DBMS_XMLQUERY.GETXML(v_context);
    DBMS_XMLQUERY.CLOSECONTEXT(V_context);
    PRINT_XML(v_document);
    END;
    CREATE OR REPLACE PROCEDURE print_xml(result IN OUT NOCOPY CLOB) is
    xmlstr varchar2(32767);
    line varchar2(2000);
    begin
    xmlstr := dbms_lob.SUBSTR(result,32767);
    loop
    exit when xmlstr is null;
    line := substr(xmlstr,1,instr(xmlstr,chr(10))-1);
    dbms_output.put_line('| '||line);
    xmlstr := substr(xmlstr,instr(xmlstr,chr(10))+1);
    end loop;
    end;
    The output is showing as below.
    <?xml version = '1.0'?>
    <EMPIMPORT>
    <EMP num="1">
    <EMPNO>101</EMPNO>
    <ENAME>Krish</ENAME>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="2">
    <EMPNO>102</EMPNO>
    <ENAME NULL="YES"/>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="3">
    <EMPNO>103</EMPNO>
    <ENAME>Scott</ENAME>
    <DEPTNO>20</DEPTNO>
    </EMP>
    </EMPIMPORT>
    But my requirement needs my output should be as below. Please let me know how to achieve this output.
    <?xml version = '1.0'?>
    <EMPIMPORT>
    <EMP num="1">
    <EMPNO>101</EMPNO>
    <ENAME>Krish</ENAME>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="2">
    <EMPNO>102</EMPNO>
    <ENAME/>
    <DEPTNO>10</DEPTNO>
    </EMP>
    <EMP num="3">
    <EMPNO>103</EMPNO>
    <ENAME>Scott</ENAME>
    <DEPTNO>20</DEPTNO>
    </EMP>
    </EMPIMPORT>

    can you please tell me how to acheive 1,2,3  instead of the chars.
    Also if I use virtual characteristic can I able to access the query structure in the user exit like the restricted key figures etc or just the records how they appear in the cube.
    Thank you guys for the quick response.

  • How to reference a file with the XML Forms Builder?

    Hello,
    I've created a form at the XML Form builder (I am using NW 04). This enables the users to create new topic.
    I've created at at the "Edit" form an option to upload a file along with the new topic. The file is being saved in a subfolder of the topics main folder.
    My question is how to create a link to the specific file that has been uploaded with it's specific topic at the "Show" Form? Note that the subfolder contains files of many topics, I want to link to this specific file uploaded with it's relevant topic when created. How do I do that?

    Hi Roy,
    > I've created at the "Edit" form an option
    > to upload a file along with the new topic.
    What I expect that you have done is to add a browse functionality which browses within KM with the possibility to upload an image into KM?! As done within SAP Demo News?!
    If that's the way, just compare the SAP Demo News: Create /DataSchema/News/image and map it to the browser, whereas in the show form part you'll map it to an image.
    If I didn't understand you right and the issue is still open, please report...
    Hope it helps
    Detlev

  • Given some xml and an xsd, how to remove extra stuff in the xml.

    Hi. I have a question. I am trying to use the various XML libraries to parse/validate an xml file given an XSD schema. I want to remove the extra stuff in the xml to output a new xml. The problem is as I validate or parse the SAXParseException it produce only gives me the localName. Is there a way I can keep track of something detail like the XPath as I validate or parse??? Thank for the help in advanced

    forgot to mention. Basically, I want to try to validate and find all the errors in the an old xml, then be able to fix the errors to end up having an valid xml file.

  • How to write inline DTD  to the xml file?

    Hi All,
    I have java program which outputs a xml file! Currently I need to alter this program to insert inline DTD code in the output xml file.
    I want the xml file to look like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE students[
    <!ELEMENT firstname (#PCDATA)>
    <!ELEMENT ssn (#PCDATA)>
    <!ELEMENT student (ssn, firstname)>
    <!ELEMENT students (student+)>
    ]>
    <students>
    <student>
    <ssn>444111110</ssn>
    <firstname>Jacob</firstname>
    </student>
    </students>
    Existing file is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE students SYSTEM "StudentsDTDfile.dtd">
    <students>
    <student>
    <ssn>444111110</ssn>
    <firstname>Jacob</firstname>
    </student>
    </students>
    The DOCTYPE line can be inserted into the xml using transfomer output key but then that always is for external dtd.
    It brings in the line <!DOCTYPE name SYSTEM " path"> .
    But i need an internal DTD. SO it should look like
    <!DOCTYPE name [<ELEMNETS>]>
    I am using DocumentBuilder class.
    Thanks in advance,
    Mathew
    Edited by: Mathew_Jacob on Jul 12, 2008 12:49 AM

    Or If Labview schema is acceptable, it is fairly straight forward.
    Beginner? Try LabVIEW Basics
    Sharing bits of code? Try Snippets or LAVA Code Capture Tool
    Have you tried Quick Drop?, Visit QD Community.

  • HT5085 How come every time I send the Apple ID verification email I never get it. Because it's been a week or two.

    I have been sending the Apple ID verification to myself so I can download apps yet I don't get one. Why is a that?

    yes, lots of option and learing curve steep.
    When you have spot healing brush active look at the toolbar that shows size of brush, mode, etc.  Mode should be in Normal unless you want special effects.
    Also, since this is an auto program, if you have the brush size too large it will sample a larger area, which can introduce artifacts you don't want.

  • How to create custom forms in the xml form builder

    Hi all ,
    can anyone give the brief on
    when we creat a project we get defaulty edit ,show and renderlist forms . what are list edit and listshow forms . what is the use of those forms.
    how can we create out own customised forms ? and how can we call the customized and listedit and list show form in the Portal.
    thanks
    Rajeev

    Hi,
    Edit form
    You use this form to create or change individual documents (for example, single news items). Typically, this form contains input fields in which you can create content (for example, the title or text for a news item).
    Show form
    You use this form to display a single document. Typically, the Show form displays all elements of a document (for example, the title, author, and all the text contained in a news item). Do not use entry controls on the Show form.
    RenderListItem form
    You use this form to define the layout of a list entry in a folder in the flexible user interface. Typically, you display some of the elements of a document, such as the title and summary of a news item, on this form. You call up the Show form if you want to display the entire document.
    You do not create pushbuttons or links for creating, changing, or deleting XML documents in the RenderListItem form. You define which commands are to be displayed using command groups of the flexible user interface. You can create several iViews for displaying the same XML documents with different command groups.
    ListEdit form
    You use this form to change a list of documents. Typically, this form contains pushbuttons for creating, changing, and deleting entries. You call up the Edit form if you want to change or create content. You call up the Show form if you want to display all entries.
      ListShow form
    You use this form to display a list of documents. Typically, this form only displays part of a document element (for example, the title of a news item). You call up the Show form if you want to display the entire document.
    Refer this documents
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/ee639033-0801-0010-0883-b2c76b18583a
    Regards,
    Kumar

  • How can i send a XML document object over the JMS wire

              HI,
              does anybody has anyidea about sending the XML Document over the JMS and receiving
              it n the other side..
              regards,
              Akhil
              

    Is this the full stack trace?
              Akhil Nagpal wrote:
              > HI ,
              > Sorry the excepiotn is of deserialization...this is the stack trace...mistake...
              >
              > weblogic.jms.common.JMSException: Error deserializing object
              > at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:140)
              > at com.sds.kb.cm.CMMDBReceiver.onMessage(CMMDBReceiver.java:143)
              > at weblogic.ejb20.internal.MDListener.execute(MDListener.java:356)
              > at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:290)
              > at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:271)
              > at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2303)
              > at weblogic.jms.client.JMSSession.execute(JMSSession.java:2226)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
              > ----------- Linked Exception -----------
              > weblogic.jms.common.JMSException: Error deserializing object
              > at weblogic.jms.common.ObjectMessageImpl.getObject(ObjectMessageImpl.java:140)
              > at com.sds.kb.cm.CMMDBReceiver.onMessage(CMMDBReceiver.java:143)
              > at weblogic.ejb20.internal.MDListener.execute(MDListener.java:356)
              > at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:290)
              > at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:271)
              > at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2303)
              > at weblogic.jms.client.JMSSession.execute(JMSSession.java:2226)
              > at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
              > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
              >
              >
              > Akhil
              >
              >
              > "Akhil Nagpal" <[email protected]> wrote:
              >
              >>HI,
              >> Actually i have created my own class which implements serializable.
              >>I set the
              >>object of this class in the ObjectMessage and send it across. Sometime
              >>i have
              >>to send some vector,sometimes string and sometime a XML document. So
              >>i can set
              >>these type of objects in my custom serializable object and send it. For
              >>sending
              >>XML , either i can send it as a string or as u said as Document object.
              >>But i
              >>want to do send it as a Document object. So i have created a an object
              >>of "org.jdom.Document"
              >>which implement serializable and setting this object into my custom object
              >>and
              >>sending this custom object in the objectmessage. But then weblogic throws
              >>some
              >>exceptions which has nothing to do with serialization.I am printing the
              >>exception
              >>below. (without the object of org.jdom.Document this custom object reaches
              >>safely
              >>and happily:))...this exception is something related to transactions.....can
              >>you
              >>or anybody tell me what could be the reason..
              >>I am not able to think why this kind of exception comes only when i try
              >>to send
              >>the jdom's Document object and never in other cases..
              >>
              >>java.sql.SQLException: XA error: XAER_RMERR : A resource manager error
              >>has occured
              >>in the transaction branch start() failed o
              >>n resource 'oraclePool': XAER_RMERR : A resource manager error has occured
              >>in
              >>the transaction branch
              >>oracle.jdbc.xa.OracleXAException
              >> at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:483)
              >> at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:190)
              >> at weblogic.jdbc.jta.VendorXAResource.start(VendorXAResource.java:41)
              >> at weblogic.jdbc.jta.DataSource.start(DataSource.java:569)
              >> at weblogic.transaction.internal.ServerResourceInfo.start(ServerResourceInfo.java:1165)
              >> at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:1108)
              >> at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:287)
              >> at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:391)
              >> at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1146)
              >> at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1101)
              >> at weblogic.jdbc.jta.Connection.getXAConn(Connection.java:145)
              >> at weblogic.jdbc.jta.Connection.createStatement(Connection.java:204)
              >> at weblogic.jdbc.rmi.internal.ConnectionImpl.createStatement(ConnectionImpl.java:130)
              >> at weblogic.jdbc.rmi.SerialConnection.createStatement(SerialConnection.java:71)
              >> at com.sds.kb.cm.CMMDBReceiver.onMessage(CMMDBReceiver.java:134)
              >> at weblogic.ejb20.internal.MDListener.execute(MDListener.java:356)
              >> at weblogic.ejb20.internal.MDListener.transactionalOnMessage(MDListener.java:290)
              >> at weblogic.ejb20.internal.MDListener.onMessage(MDListener.java:271)
              >> at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:2303)
              >> at weblogic.jms.client.JMSSession.execute(JMSSession.java:2226)
              >> at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
              >> at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
              >>
              >> at weblogic.jdbc.jta.DataSource.enlist(DataSource.java:1151)
              >>
              >>
              >>any help will be appriciated..
              >>Akhil
              >>
              >>
              >>
              >>Raj <[email protected]> wrote:
              >>
              >>>wrap it up as an object message(I think DocumentImpl is Serializable).
              >>>This way you
              >>>wont be vendor specific and can retrieve it at the other end.
              >>>
              >>>Akhil Nagpal wrote:
              >>>
              >>>
              >>>>HI Raj,
              >>>> thanks for the response..actually we dont want our application
              >>>
              >>to
              >>
              >>>be weblogic
              >>>
              >>>>specific...
              >>>> there should be some other way arround....
              >>>>
              >>>>REgards
              >>>>Akhil
              >>>>
              >>>>"Raj" <[email protected]> wrote:
              >>>>
              >>>>>There is a weblogic specific XMLMessage similar to ObjectMessage,
              >>>>
              >>>BytesMEssage
              >>>
              >>>>>etc.. Try using that to wrap ur XML document and send it across.
              >>>>>
              >>>>>-Raj
              >>>>>
              >>>>>"Akhil Nagpal" <[email protected]> wrote:
              >>>>>
              >>>>>>HI,
              >>>>>>does anybody has anyidea about sending the XML Document over the
              >>>>>
              >>>JMS
              >>>
              >>>>>>and receiving
              >>>>>>it n the other side..
              >>>>>>regards,
              >>>>>>Akhil
              >>>>>
              >
              

  • How do I Send a xml to client?

    Hi friends:
    It is possible to send a xml to client without a xml file in the server?
    I create a Document in the server and the code is :
                                                                   DocumentBuilderFactory df=DocumentBuilderFactory.newInstance();
                   DocumentBuilder db=df.newDocumentBuilder();
                   Document  doc=db.newDocument();
                   Element el=doc.createElement("root");
                   doc.appendChild(el);
                   Comment co=doc.createComment("This is a comment");
                   el.appendChild(co);I want to write the Document to a Stream and send the XML stream to client ,so the client can display a xml.
    The code is:
                                                                   resp.setContentType("text/xml");
                   resp.setContentLength(200);
                   resp.setHeader("Content-Disposition","inline;filename=address.xml");
                   ServletOutputStream so=resp.getOutputStream();
                   PrintStream ps=new PrintStream(so);
                   System.out.println(doc);
                   ps.print(doc);
                   so.flush();
                   ps.close();I don't want to create a xml in the server so I can do this only use stream .But what client get is a momery address! It is org.dom.xml....@sd7fs87d What wrong with my code ? How to send the xml to client without create the xml file in server?
    Thks in advanced!

    Yashnoo,
    What XML package that you used?
    It should have a class for outputing xml
    example using JDOM
    XMLOutputter writer = new XMLOutputter(Format.getPrettyFormat());
    OutputStream out = new FileOutputStream("dummy.txt");
    writer.output(doc, out);
    //this case it write to a file but in your case you can pass in ServletOutputStream
    or ByteArrayOutPutStream then use method writeTo() to send it to ServletOutputStream
    another thing, make sure to set your content length corretly,
    resp.setContentLength(200);
    how do you know its length is 200
    if you are going to use ByteArrayOutPutStream, it will give you the correct length
    for instance
    ByteArrayOutPutStream out = new ByteArrayOutPutStream ();
    XMLOutputter writer = new XMLOutputter(Format.getPrettyFormat());
    writer.output(doc, out);
    int len = out.size();
    now you can do this
    resp.setContentLength(len);
    finally,
    out.writeTo(resp.getOutputStream());
    it should send a stream out to the client.
    bottom line is, find out your package API or you can post the package you use, I can take a look
    here is a sample of using JDOM to create a document then output it out to System.out
    good luck
    public static void createXMLFile()
              Element root = null;
              Document doc = new Document();
              try
                   String[] arr = {"MainElement ","SubElement1","SubElement2","SubElement2"};
                   String[] arr1 = {"MainElement ","SubElement111","SubElement22","SubElement332"};     
                   root = new Element("root");
                   doc.setRootElement(root);
                   //for each array do the following
                   Element e = new Element(arr[0].trim());
                   root.addContent(e);     //<MainElement>
                   for (int i = 1; i < arr.length; i++)
                        e.addContent(new Element(arr.trim()));     //<SubElement1>
                   //finally output to a file as your choice
                   XMLOutputter writer = new XMLOutputter(Format.getPrettyFormat());
    //               OutputStream out = new FileOutputStream("dummy.txt");
                   writer.output(doc, System.out);
    //               out.flush();
    //               out.close();
              catch (Exception e)
                   e.printStackTrace();

  • How to send/receive XML using JSP

    Hi,
    I'm new to all this JSP/XML stuff so apologies if this is trivial.
    I'm trying to send an XML file via HTTP POST using JSP. Anyone know how to do this?
    Once the XML has been sent, how do you use JSP to request the XML file? I've figured out how to parse it already.
    Also, is it possible to call xsql directly within JSP?
    Thanks!

    I'm trying to send an XML file via HTTP POST using JSP. Anyone know how to do this?The question is, does anybody understand what you mean by this. Let me take a guess. You want to upload an XML file to a server. If this guess is right, then the answer is don't use JSP to do that. JSP is for generating output to be sent to a client. Use a servlet to handle an upload. And you don't need to write it yourself, there are already several file-upload servlets available on the web.
    Second guess: you have a POST request that asks your server to send an XML file back to the client. If it's a static XML file you don't need a JSP or a servlet or anything, just let your web server handle it just like any other static file. If it's dynamically generated then there's an answer worth giving, but I doubt that this is your question. But if it is, let us know.

Maybe you are looking for

  • Biggest display of incompetence and awful customer...

    Dear BT: CAN I PLEASE GET MY USERNAME AND PASSWORD SO THAT THE ENGINEER CAN INSTALL THE BROADBAND WHICH I ORDERED WELL OVER A MONTH AGO AND HAVE ENCOUNTERED NOTHING BUT DISMAL INCOMPETENCE EVER SINCE. Here’s the whole story: On Feb 10th I ordered Inf

  • Incorporating Crystal Reports for Eclipse into a Maven build

    Is there a way to support or work around Maven dependencies for Crystal Reports? I'm working on a project in MyEclipse 8.5 and building it into an ear file using the integrated Maven support. We just recently started incorporating Crystal Reports int

  • Intel Mac Mini video outpot to component video

    I am looking for an adapter/converter that allows me to connect the video output of my Mac Mini to a component video receiver. I currently use a Marantz S8001 receiver with multi-room capability but unfortunately the multi-roon video switching capabi

  • Playback of iTunes Contents Stored in iMac mid-2010 (upgraded to Mountain Lion) using Apple TV

    I am not 100% certain that upgrading to ML is giving me issues with Apple TV playback (not mirroring) but I AM having trouble with playback of music and movie stored in iTunes/iMac mid-2010.  I have an iMac mid-2010, 3rd generation Apple TV, cable br

  • SQL query performance issues.

    Hi All, I worked on the query a month ago and the fix worked for me in test intance but failed in production. Following is the URL for the previous thread. SQL query performance issues. Following is the tkprof file. CURSOR_ID:76  LENGTH:2383  ADDRESS