Converting jtree to xml

hi, i am currently working on a project where i construct a jtree using a java gui....once the user clicks on save button, the jtree has to be read and converted into an xml document....
for eg, the jtree looks like this
- process
----reply
----receive
etc..
the xml document should be as follows:
<process>
<reply> </reply>
<receive></receive>
</process>
i need your help in this regard....kindly help
Regards
Lalitha

Chapter 23 of the book, constructs a tree XMl editor, and it saves among other things...
http://www.manning.com/sbe/

Similar Messages

  • Convert JTree to XML file

    Hi ,
    Can anyone help me in converting a JTree to XML file.
    The Jtree is build from an xml file, the user can add, delete nodes in JTree and save to the xml file. Is there any way I can update the same xml file.
    Suggestions are greatly appreciated.
    Thanks,
    SS..

    Hi ,
    Can anyone help me in converting a JTree to XML file.
    The Jtree is build from an xml file, the user can add, delete nodes in JTree and save to the xml file. Is there any way I can update the same xml file.
    Suggestions are greatly appreciated.
    Thanks,
    SS..

  • Converting string to XML

    Dear All,
    I am using PI 7.1
    I am trying to invoke a third party SOAP API which accepts request in the form of a string which has embedded xml and also return a string which has xml embedded in it.
    To send the xml as string, I used the feature "Retun as XML" in mapping and it worked fine.
    But the response which has xml embedded, needs to be converted back to XML message.
    I understand that we can write parsers in java, ABAP and also do XSLT mapping.
    Just wanted to know that is there any "out of the box" feature to do the same.
    Please refrain from providing links to java mappings or xslt as I have gone through them already.
    regards,
    Piyush

    Hi Piyush,
                      All parsers will fail to parse the XML message you are getting. Since you are getting the following tag twice within the XMl
    "<?xml version="1.0"?>"
    This tag can be present in an document only once in begining of the document. First you need to remove this tag from appearing in source.
    Suppose you are able to do that then your XML structure will become something like this
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <ns1:AuthenticateResponse xmlns:ns1="urn:Login" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    <return xsi:type="xsd:string"><MessageResponse sessionid=";jsessionid=FxZLTxtJnXJttpW6gMhJ06kyn00tfSgjt9ZwbzJ55CXGn92S8L6f!-444760742!1311845684753" status="SUCCESS" topicprefix="ND-DSK-117.CXL_HMEL_DB"><Entity name="REF_PERSON"><Property name="last_access_dt" value="20110728145937" type="DATE"/><Property name="modify_person_num" value="21" type="INTEGER"/><Property name="persontopic" value="350523952" type="STRING"/><Property name="login_result_ind" value="0" type="INTEGER"/><Property name="login_result_reason" value="" type="STRING"/><Property name="bypass_drafts" value="0" type="STRING"/><Property name="stl_check_swap_option_pricing_end" value="1" type="BOOLEAN"/><Property name="stl_update_provisional_cashflows" value="0" type="BOOLEAN"/><Property name="stl_autoinvoice_costs" value="1" type="BOOLEAN"/><Property name="stl_allow_payments_from_agents" value="0" type="BOOLEAN"/><Property name="stl_payment_allocation_at_invoice_detail_level" value="1" type="BOOLEAN"/><Property name="last_db_reloaded_on" value="" type="DATE"/><Property name="xl_mode_ind" value="0" type="INTEGER"/><Property name="Xchange_enabled" value="1" type="INTEGER"/><Property name="Xchange_server" value="XCHANGE" type="STRING"/><Property name="ipaddress" value="10.60.4.80" type="STRING"/><Property name="appname" value="CommodityXL" type="STRING"/><Property name="version" value="7.XL7.08.17E" type="STRING"/><Property name="econfirm.server.enabled" value="0" type="BOOLEAN"/></Entity></MessageResponse></return>
    </ns1:AuthenticateResponse>
    Then you can use the following java mapping code to remove the SOAP envelop.
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class RemoveSoapEnvelopSDN implements StreamTransformation{
    public void execute(InputStream in, OutputStream out)
    throws StreamTransformationException {
    try
         DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
         DocumentBuilder builderel=factory.newDocumentBuilder();
         /*input document in form of XML*/
         Document docIn=builderel.parse(in);
         /*document after parsing*/
         Document docOut=builderel.newDocument();
         TransformerFactory tf=TransformerFactory.newInstance();
         Transformer transform=tf.newTransformer();
         Element root;
         Node p;
         NodeList l;
         int mm,n1;
         //if you need to include namespace use next two lines
         //root=docOut.createElement("ns0:MessageResponse");
         //root.setAttribute("xmlns:ns0","http://connectsystems.be/MAINFR/AccDocument");
         root=docOut.createElement("MessageResponse");
         p=docIn.getElementsByTagName("MessageResponse").item(0);
         l=p.getChildNodes();
         n1=l.getLength();
         for(mm=0;mm<n1;++mm)
              Node temp=docOut.importNode(l.item(mm),true);
              root.appendChild(temp);
         docOut.appendChild(root);
         transform.transform(new DOMSource(docOut), new StreamResult(out));
    catch(Exception e)
         e.printStackTrace();
    public void setParameter(Map arg0) {
    public static void main(String[] args) {
    try{
         RemoveSoapEnvelopSDN genFormat=new RemoveSoapEnvelopSDN();
         FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\sdn6.xml");
         FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\removedEnvelopSdn6.xml");
         genFormat.execute(in,out);
    catch(Exception e)
    e.printStackTrace();
    You can add attributes to the tags as per your requirement. I have commnented those lines in the java code.
    The output will look like this
    http://postimage.org/image/2b2czww90/
    Hope this helps.
    Regards
    Anupam

  • Converting String To XML Format and send as attachment

    Hi
    My requirement is to convert String into XML Format and that XML File i have to send as an attachment
    can any one one give solution for this Problem.
    Thank you
    Venkatesh.K

    hi,
    i m filling the itab first and converting to xml
    itab contaning these data
    GS_PERSON-CUST_ID   = '3'.
    GS_PERSON-FIRSTNAME = 'Bill'.
    GS_PERSON-LASTNAME  = 'Gates'.
    APPEND GS_PERSON TO GT_PERSON.
    GS_PERSON-CUST_ID   = '4'.
    GS_PERSON-FIRSTNAME = 'Frodo'.
    GS_PERSON-LASTNAME  = 'Baggins'.
    APPEND GS_PERSON TO GT_PERSON.
    after conversion data is coming like that
    #<?xml version="1.0" encoding="utf-16"?>
    <CUSTOMERS>
      <item>
        <customer_id>0003</customer_id>
        <first_name>Bill</first_name>
        <last_name>Gates</last_name>
      </item>
      <item>
        <customer_id>0004</customer_id>
        <first_name>Frodo</first_name>
        <last_name>Baggins</last_name>
      </item>
    </CUSTOMERS>
    but errors are  1) # is coming at the first
                            2)for 'encoding="utf-16"?>', it is not coming perfectly, some other data (iso-8859-1) should come here
    can anybody plz solve it.
    regards,
    viki

  • Converting string to XML format

    Hi All,
    I have a requirement to convert string to xml format and download it. Atpresent, I have a string which is a collection of xml tags. I want to convert this string to xml format like <VALUE004>20387899.437</VALUE004>
    <VALUE005>20387899.437</VALUE005>
    <VALUE006>20387899.437</VALUE006>
    Is there any function module for this.

    Chk this thread.
    Re: Regd: File Conversion to XML format

  • Converting string to xml in xslt

    Hi we are trying to convert string to xml in xslt but it is getting errored out.
    We have followed the procedure mentioned at http://download.oracle.com/docs/cd/A91202_01/901_doc/appdev.901/a88894/adx04xsl.htm under the section "How Do I Convert A String to a Nodeset in XSL?".
    Standard procedure mentioned by oracle is not working. Is it a known bug?

    Chk this thread.
    Re: Regd: File Conversion to XML format

  • Methods in bapi used to convert data into XML

    Methods in bapi used to convert data into XML,
    how to implement those also,
    points will be rewarded
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi
    Check this
    http://www.sap-img.com/abap/sample-xml-source-code-for-sap.htm
    https://forums.sdn.sap.com/click.jspa?searchID=2889167&messageID=3406594
    Reward points for useful Answers
    Regards
    Anji

  • Convert Excel to XML file

    Hi Guys,
    I need to generate the XML from Excel file. The XML file will have the definition like this:
    <people_list>
    <name>Fred Bloggs</name>
    <birthdate>27/11/2008</birthdate>
    <gender>Male</gender>
    </people_list>
    The Excel file will look like this:
    A B C
    1 Fred Bloggs 10/21/2008 Male
    2 ABC 12/23/2008 Female
    3 XYZ 07/16/2008 Male
    All the values in name,birthdaye,gender will come from the Excel file. I am having 100 rows in the Excel file with the data and I want to parse this excel file and create the XML file with the above template.
    Any ideas how to do this?
    Thanks,
    Mahesh

    Hi Mahesh,
    there are tons of ways to do what you need. It all depends on how your workflow is organized and how complicated it may become.
    Alternative 1:
    Export your Excel file as a cvs and convert cvs to XML (which shouldn't be so hard).
    Pro: Relative easy transformation.
    Con: Every time you want to convert the Excel file to XML you first needs to export it out of Excel by a manual step.
    Alternative 2:
    Save you Excel file as XML (e. g. the new *.xslx documents) and transform it as you like.
    Pro: Very clean way to do this. You can access the single source Excel file directly from Java. No further steps needed.
    Con: It's very very hard to program because the Excel xml structure is ridiculously complex.
    Alternative 3:
    You can create a little Excel VBA Script which generates the XML File.
    Pro: Easy programing.
    Con: Needs some experience in Visual Basic 6 programming.
    Alternative 4:
    Use http://jexcelapi.sourceforge.net/ or any other Excel-API to Access the Excel application out of Java.
    Pro: Clean way to do it. You need no further manual actions to prepare something. (maybe the most flexible and at the same time easyest way)
    Con: Additional license.
    Best Wishes
    esprimo

  • Convert FMB to XML File on Unix

    Hello,
    I want to convert a FMB-File to XML in my HP-UX-Middletier-Environment.The Script frm2xml.sh is only shipped with IDS.
    Can someone upload the frmf2xml.sh from a linux or Solaris IDS-Enviroment?
    Robert

    So if we were to keep text-based source files, the process would have to be:
    - check-out to local working copy
      - convert XML to FMB
        - make changes using Forms Developer
      - convert FMB to XML
    - commit to svn
    I'm concerned about the side-effects of the conversion process (edge-cases, incompatibilities), and I also expect that even with some automation, the above will be a pretty slow process that will slow the team down. I guess we'll probably stick with fmb.
    I guess as a compromise, it may be worthwhile generating the xml or fmt alongside the fmb and committing both. At least we'd then have a text-based file to compare revisions with. So the process then becomes:
    - check-out to local working copy
      - make changes using Forms Developer
      - generate XML from FMB
    - commit both to svn
    I'm still baffled as to why Oracle has chosen a binary source format, even 15 years ago. This basically precludes a vast number of tools and techniques that are essential to the software craft :(

  • Step by step bapi to convert SAP to XML please its urgent

    step by step bapi to convert SAP to XML please its urgent
    full points if with full example and coding in ABAP,
    Thank you,
    Regards,
    Jagrut Shukla

    yes i want to convert Catsdb table into xml format and safely in server, i.e secured  place

  • Convert XMLList to XML in AS3?

    Hello,
    I am trying to figure out how to convert an XMLList that I
    retreived from an XML instance back into well-formed XML in Flash
    CS3. Here is what I am doing.
    - I have an XML document loaded and I am displaying the
    contents in a datagrid component (which is working well).
    - I am then filtering the XML to obtain a subset of data by
    first obtaining an XMLList representing all elements of my XML
    instance and then filtering the list on a particular element (this
    is working well).
    - Now I want to display my filtered results in the datagrid
    and here lies the problem because the datagrid can't use an XMLList
    as a dataprovider. How do I convert this XMLList back into well
    formed XML so I can use it as my grid's dataprovider? I need to
    somehow get a root tag back on.
    Could I somehow use toXMLString() and then convert that to
    XML?
    Thank you in advance for any advice.
    TH

    I solved this so I thought I would post how I did it in case
    anyone would find this useful.
    1. First, convert your XMLList to an xml string:
    var yourXMLString:String = yourXMLList.toXMLString();
    2. Next, add a root tag to the beginning and end of your xml
    string.
    yourXMLString=
    "<your_root_tag>"+yourXMLString+"</your_root_tag>";
    3. Convert the string to xml.
    var yourNewXML:XML=new XML(yourXMLString);
    yourNewXML is now well-formed xml and will work as a
    dataprovider.
    TH

  • Converting IDOC to XML

    Hi,
    I have an application where i have to convert an IDOC to XML format so that it can be handled by webmethods.
    I want to know how to convert IDOC to XML. I have seen that in SAP there are two port types, XML and XML HTTP. Are they used for posting an IDOC in XML format at defined port.
    When i tried to generated a test IDOC with port type as XML, it has created an xxx.XML file in application server but i an unable to display it.
    1). Can any one pls. tell me how to convert IDOC to
    XML??? What are the different methods ( if available)
    2). DO i need to have any extra component for this??
    3). what are XML and XML http ports are for.
    Pls. help me as this is very urgent.
    Thanks in advance.
    Pratik

    Hi,
    Does xxx.XML contain no data? Or you are just not able to display it (try opening it in notepad).
    1 - You are doing it right. Using XML port should be enough.
    2 - You don't need anything additional.
    3 - XML port gives you an option like a file port (you get the idoc in an XML file) for batch type interface. XML http will let you post the XML data realtime to an web server that accepts XML messages.
    If your partner system can take http messages, you can use http port to send the IDOC directly to that system, else you can create the XML file and send it in batch mode.
    hope this helps,
    cheers,
    Ajay

  • Converting audio to xml form

    hi
    i need to know how to convert audio to xml form.. can any one help me on this...

    take a look at this article:
    http://www.javaworld.com/javaworld/javatips/jw-javatip117.html?tip

  • [Q] convert DOM to XML Document

    Hi,
    Is there any class or library which convert DOM to XML document?
    ----- java program ------------
    import org.w3c.dom.*;
    import org.apache.crimson.tree.XmlDocument;
    public class Sample {
      public static void main(String args[]) {
        // create a document and root element
        Document doc = new XmlDocument();
        Element root = doc.createElement("html");
        doc.appendChild(root);
        // append a data
        Element body = doc.createElement("body");
        root.appendChild(body);
        body.appendChild(doc.createTextNode("Hello"));
        // convert DOM to XML Document
    }----- expected result ----------
    <html>
    <body>
      Hello
    </body>
    </html>Could you help me?

    Hi,
    Look at the package javax.xml.transform
    or
    try the following code:
    I tried the following code.
    ----- java program ------------
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import javax.xml.transform.*;
    import javax.xml.transform.dom.*;
    import javax.xml.transform.stream.*;
    import java.io.OutputStream;
    public class Sample {
      public static void main(String[] args) {
        try {
          // create a document and root element
          Document doc = DocumentBuilderFactory.newInstance()
                                .newDocumentBuilder()
                                .newDocument();
          Element root = doc.createElement("html");
          doc.appendChild(root);
          // append a data
          Element body = doc.createElement("body");
          root.appendChild(body);
          body.appendChild(doc.createTextNode("Hello"));
          Element ul = doc.createElement("ul");
          String[] list = {"foo", "bar", "baz"};
          for (int i=0; i<list.length; i++) {
           Element li = doc.createElement("li");
           li.appendChild(doc.createTextNode(list));
         ul.appendChild(li);
    body.appendChild(ul);
    // convert DOM to XML Document
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer();
    //OutputStream stream = new FileOutputStream("output.xml");
    OutputStream stream = System.out;
    transformer.transform(new DOMSource(doc), new StreamResult(stream));
    } catch (Exception ex) {
         ex.printStackTrace();
    ----- result ------------
    <html>
    <body>Hello<ul>
    <li>foo</li>
    <li>bar</li>
    <li>baz</li>
    </ul>
    </body>
    </html>Great! Very thanks!

  • Using ABAP Web Service tor convert IDoc to XML and transfer to SOAP Server

    Hi all,
    I have a problem to use ABAP Web Service to convert IDoc's to XML and then send them to a SOAP Server.
    Currently we have the following landscape:
    SAP->XI->Archive
    The sap-system (ECC6.0) sends an IDoc to the Exchange Infrastructe. The XI maps the IDoc and converts it to the required XML format, used by the archive. Afterwards, the XML documents are sended to the SOAP Server.
    So I'm trying to replace the Exchange Infrastructure with ABAP Web Service.
    I've read a lot of posts and documents reagarding ABAP Web Serivce, converting IDoc's to XML, RFC and so on, but I'm not able to do the replacement.
    I don't know how to start and which steps are required.
    The required roles and authorizations at the sap-system and the service for soamanager and the Web Service Viewer are available.
    First I thought to create the RFC and partner profiles and then the report to convert IDoc to XML as a BAPI. With this BAPI I supposed to create and define a Web Service. The problem is, I don't know how to trigger the report if the Idoc should be send to the archive.
    Hopefully, someone has an idea or a how-to for me.
    Thanks in advance.
    Regards,
    Christoph
    Edited by: BigTicket on May 12, 2010 9:36 AM

    Hi BigTicket.
    A suggestion to trigger the BAPI / WebService at the IDoc receiving is to use a user exit or enhanced inside the idoc function module. When the idoc arrived to the idoc port the system start the related function module and then your user exit/enhanced in which you invoke your BAPI.
    I hope this help.
    Ciao.
    Nicola

Maybe you are looking for