The nicest way to generate xml-files by Java???

I have to generate huge and quite complex xml files by Java. I have to fetch the data from a Oracle database. What I really don't know is a proper and reliable way to this? I could of course create a String and concatenate all the tags, attributes and data but it doesn't feel right. I guess this is a quite common task and there are many established ways to this by Java. My question is what is the best way to this? What is your suggestion?
Thank you for any clues...

Hi,
Since you have access to the database, I think one of the best way is to create stored procedures that will generate those files for you (using SQL/XML functions preferably) and return the content to the Java caller.

Similar Messages

  • What the best way to create XML files from JAVA application?

    Hi to all,
    I need to edit and to create new filex in format of xml. I know to parse, but what would be the best way to do:
    1. - Create new file, create like simle text file, or there is some clases that know to do it in more simple way
    2.a - Edit XML file, to take some data and add it to the XML in the place I want to.
    2.b - Also Edit, but not to add fields, just update some of them.
    Code examples or links to samples woul be welcomed.
    Best regards, Nick.

    I have tried working with XML directly using the Java classes but this was a pain. I then looked at DOM4J and JDOM and found JDOM easier to use.

  • Do i required to generate XML file for JAVA upgrade.

    Dear frnds,
    I am in process of upgrading EP 6.0 to  EP 7.0 EHP1 for SR1.
    I am following document   Upgrade Guide SAP NetWeaver 7.0 Java Including Enhancement Package 1
    As of media list guide i have selected .
    51036889_1/2 for UPG MASTER BS7 SR1
    51037093_1,2,3 for NW 7.0 EHP1 SR1 java SW components 1/2
    51036767_2 for BS7 UC kernel 7.01 AIX 64 bit.
    Well, i have a query here when i am doing upgrade on ABAP stack ECC 5.0 to ECC 6.0 EHP4 SR1  i alowed to select required compoenets , which eventually will generate mea XML file in Solution manager system.
    But, When i have planned to UPGRADE only  JAVA Stack for EP 6.0 to EP 7.0 EHP1 SR1.  When i selected my system in Solution manager i am not getting option for UPGRADE.
    If it is so how about my XML file  during JAVA upgrade is not mandatory or not .. Please advice me on this.
    regards,
    rahul

    Hi Rahul,
    Yes, for Java Upgrade to EHP1 you need xml file. Normally you should be able to download xml file from solution manager from MOPZ.
    If you are not able to download it from solman then you can also download the xml file from service market place and this is only for EHP1.  Follow below procedure to download xml file from SMP for EHP1:
    Go to https://websmp205.sap-ag.de/sp-stacks
    Click on SP Stack download.
    Select SP Stack Netweaver 7.0 (New window will open)
    Then on New Window Select Source Stack, Target Stack and usgae type. Then Click Next.
    On Next screen Select Kernel and IGS. Then Go Next.
    On that screen you will get a option to Save as File. Then save as xml.
    This is the xml file that you can use in upgrade.
    For EHP4 you cannot download it from service market place.
    Thanks
    Sunny

  • What's the best way to create XML file with a schema from a database table?

    Hi,
    I want to create an XML file from a database table (which has over 600 columns) using XML schema (.xsd file). I want to know the best way to do this.
    The output XML file is NOT a direct data dump from the DB table, there�re some logic around it, such as the XML file has some hierarchy with repeating tags.
    I have done this using JAXB by creating Java classes form XML schema, but I don�t want to map 600 DB columns to these Java classes manually, and loop through the record set to create repeating tags.
    I know there are few tools around now like MapForce (Altova), how do people do these now?
    Thanks,
    Chandi

    Can you use a schema when we compose XML doc from Database tables?
    Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me.

  • How to Read and Generate XML file from java code.

    hi guys,
    how to read the xml file (Condition :we know only DTD or Shema only).
    How to Generate the new xml file ?(using Shema )
    And one more how directly Generate the xml from DB?
    Pleas with code or any URL

    Using XMLbeans you can generate Java objects from an XSD schema (perhaps DTDs aswell)
    Then you can create an instance of the Document object and ask it to write itself.
    This will create an XML document complient to the schema.
    XMLBeans generates a "type" safe DOM where you can only ever have a structure compilent to you schema.
    matfud

  • How to Generate XML File from Java Code.

    I want to generate the xml file from the java code.
    Could you plz suggest any webSite address with example?

    Here is the code
    import java.io.File;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    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.w3c.dom.Element;
    public class CreateXML {
         private DocumentBuilderFactory factory = null;
         private DocumentBuilder builder = null;
         private Document document = null;
         public CreateXML() {
              try {
                   factory = DocumentBuilderFactory.newInstance();
                   builder = factory.newDocumentBuilder();
                   document = builder.newDocument();
              } catch (FactoryConfigurationError e) {
                   e.printStackTrace();
              } catch (ParserConfigurationException e) {
                   e.printStackTrace();
         /** Creates the document for xml. */
         public Document createDocument(){
              try{               
                   Element root = document.createElement("Root");
                   Element child = document.createElement("child");
                   root.appendChild(child);
                   document.appendChild(root);
              }catch(RuntimeException e){
                   e.printStackTrace();
              return document;
         /** Saves the document as xml. */
         public void saveDocument(Document document){
              try{
                   TransformerFactory transFactory = TransformerFactory.newInstance();
                   Transformer transformer = transFactory.newTransformer();
                   DOMSource source = new DOMSource(document);
                   StreamResult stream = new StreamResult(new File("sample.xml"));
                   transformer.transform(source, stream);
                   System.out.println("XML Created !!");
              }catch(TransformerConfigurationException e){
                   e.printStackTrace();
              } catch (TransformerException e) {
                   e.printStackTrace();
         public static void main(String args[]){
              CreateXML createXML = new CreateXML();
              Document document = createXML.createDocument();
              createXML.saveDocument(document);
    }

  • How can I load and process an HTML5 file with Javascript in the same way as an XML file?

    I maintain a diary in local weekly files that I am converting to HTML5 from XHTML. I wish to extract all the "articles" about particular topics from these files and display them in different orders. It is possible to load an XHTML file using the loadXMLDoc function described at http://www.w3schools.com/dom/dom_loadxmldoc.asp but the same function detects a parsing error when it reads an HTML5 file. (For example, the parser expects an empty element's tag to end with />). How do I persuade Firefox 16.0.1 to use an appropriate parser?

    A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.<br>
    You need to register at the MozillaZine forum site in order to post at that forum.

  • Accessing XML files through java

    Can any one explain me the easiest way of accessing XML files from Java.

    Hi,
    If you want to only access the XML file, use the SAX parser It will be very easy to handle and identify the element and value.
    else if u want to change the XML value also, then better go with DOM, Which has very good flexiblity.
    use according to the need, let me know if any help is required......
    With Cheers
    PrasannA

  • Most effecient way to generate XML output

    What is the most effecient way to generate XML output using ORACLE.
    Presently I am aware of the following:
    1)DBMS_XMLQUERY
    2)DBMS_XMLGEN
    3)SQLX functions
    We are using the first 2 in our database to generate hierarchical XML. Once the XML is generated the XML file is ftp'd to a UNIX box. Because of the file size restrictions in our UNIX bix we decided not to transform the XML output into XML Attributes.
    The attributes are assigned from an XSLT file and the raw XML file is transformed to a file which has attributes.
    My question is:
    In the Oracle Database release 9.2 is there a better efficient way to genarate the final XML file with Attributes from the database side without using the XSLT. If yes, please give an example how to do this?
    Thank You

    In general the SQL/XML publishing functions are the most efficient way..
    DBMS_XMLQUERY is a legacy technology imlimented in Java. The main advantage is that it can be run outside the database in the mid-tier is required.
    DBMS_XMLGEN is a re-implementation of DBMS_XMLQUERY in 'C' which runs inside the database. In most cases it should be much faster than DBMS_XMLQUERY. It provides some features that are still not availalble in the SQL/XML standard such as the ability to generate XML based on a cursor, and the ability to generate recursive output from a connect by query. It is hoped that future versions of the SQL/XML publishing functions will address these issues.
    Both DBMS_XMLGEN and DBMS_XMLQUERY are somewhat limited in terms of generating complex XML documents with multiple levels of nesting.
    The SQL/XML publishing functions are the preferred way of generating XML from relational data. THey provide the ability to generate extremely complex XML structures from relation data and provide full control over element / attributes names, levels of nested etc. Future development projects will focus on enhancing the performance and functionality of the SQL/XML publishing functions rather than the PL/SQL packages
    In general if you can use SQL/XML publishing functions you should do so.
    Does this help....

  • How to generate XML file from SQL file !

    I am new to XML publisher. I known one way to generate XML file is register one report file in concurrent manager.
    But I want to generate XML file from sql file.
    Could someone show me how to code in sql file, how to register is in concurrent manager.
    Thanks !

    Hi
    Phew ... not sure we have the space here. So I can point you in the right direction:
    1. XML data generation - there are two packages in the db you can use with a plsql procedure, XMLGEN and SQL XML. You can also use java APIs too. Try checking the db documentation and search for the above methods.
    2. Registering the report - the system administrators guide will provide this info. Hooking the program up with XMLP is covered here - http://www.oracle.com/technology/products/applications/publishing/resource/CM%20Whitepaper5.0.pdf
    Regards, Tim

  • What is the best way to find a file on the servers disk without using web.xml?

              What is the best way to find a file on the servers disk without using web.xml?
              I want to find a configuration file not contained within the war file I have
              created. Is there a way to pass information into the ServletContext with out
              rebuilding the ear or war files? Tomcat 4.0 can do this in its server configuration
              files. Does BEA have the equivalent?
              Regards,
              Eric
              

    You can specify the path to the file as a system property
              eg
              java -Dconfig.file.location=./mydirecotry/myfile.txt com.test.MyApp
              "Eric White" <[email protected]> wrote in message
              news:[email protected]..
              >
              > What is the best way to find a file on the servers disk without using
              web.xml?
              > I want to find a configuration file not contained within the war file I
              have
              > created. Is there a way to pass information into the ServletContext with
              out
              > rebuilding the ear or war files? Tomcat 4.0 can do this in its server
              configuration
              > files. Does BEA have the equivalent?
              >
              > Regards,
              > Eric
              

  • How to send the dynamically generated XML file to other site for further processing?

    I have a question regarding exchanging data between two systems
    using XSQL servlet. The situation is descrbed as the follows:
    Assume that we have a simple XSQL page named "emp.xsql"
    <?xml version="1.0"?>
    <?-- XSQL page file "emp.xsql" -->
    <xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo" >
    SELECT * FROM EMP
    </xsql:query>
    and we can access it through the HTTP request likes
    http://web_server_name/xsql/emp.xsql.
    Usually we will the returned dynamic XML file and show it on the
    screen. Now the problem is that we don't want to show the
    generated XML file on the calling screen. Instead, we want to
    send the generated XML file to other website for further
    processing, say, using JSP or ASP likes
    http://other_web_server_name/XMLProcessing.jsp?.....
    How can it be implemented using XSQL servlet?
    Any hint and outline of the solution is appreciated.
    Thanks

    Ike,
    Do you have a sample. I am searched so much in this forum for samples. I looked on SAX Parser. I did not find any samples.
    Please help me.
    Thank you for your posting.
    Padma.

  • Using servlet to generate XML file

    What I want to do is simple but can't work. Hope you guys can give me a hint.
    I succesfully generate XML file in command line using Oracle XML parser and class generator. Then I was trying to do it using servlet. it compiles fine but generate NullPointer exception at the line:
    Emp e1= new Emp(); //Emp is the root of XML
    I suspect the Emp constructor can't correctly find the globalDTD in its superclass -CGDocument. Please note this only happens in servlet setting, not is command line setting. Any suggestion to get arounf this?
    Another unrelated question is that when I create a XML file using the Oracle XML parser, it seems all the elements a file has to be added once, otherwise the compiler will compalain about the missing element. this will be inconvinient when I constructing a big XML file, which I 'd liek to split into small piece and add them up. Maybe there is a good way but I just don't know it.
    my email: [email protected]

    Hi,
    I'm running into the same problem deploying the classes generated by the class generator. Code works fine from JDeveloper, but had to put my DTD in the directory where my classes are. Deploying the classes with Apache's JServ gives me a NullPointer exception on the first addNode method. I guess it can't find the DTD. I tried to put the DTD in many locations but this didn't fix the problem. Any suggestions?
    Steve,
    Did you fix this problem? Thanx!
    null

  • How to generate xml-file for SAP Fiori (UI add-on) with Solution Manager 7.0.1?

    Hello Guru,
    could you please help with my issue with Fiori Installation.
    We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
    Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
    But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
    But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option  "install Add-on" as it written in Guide for ui add-on installation.
    Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
    If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
    Thanks in advance for any help!!!
    Bets regards,
    Natalia.

    Hello Guru,
    could you please help with my issue with Fiori Installation.
    We want to install SAP Fiori Front-End (GW+UI) on the Sandbox system with SAP Netweaver 7.3.1. (SP14)
    Gateway component (SAP GW CORE 200 SP10) was installed without any problems.
    But I need to install UI-add-on (NW UI Extensions v1.0) and when I try to install it via SAINT, transaction said me that I need to generate xml-file for it (as in General notes for UI add-on mentioned).
    But I have Solution Manager 7.0.1 and in MOPZ for this version I do not have option  "install Add-on" as it written in Guide for ui add-on installation.
    Could you please help me with advice how to generate xml-file for UI add-on installation on SolMan v.7.0.1?
    If where is no way, but only to upgrade Solution Manager, maybe somebody could give me xml-file for your system (for NW 731) and I will change it to my needs, I will be very grateful!
    Thanks in advance for any help!!!
    Bets regards,
    Natalia.

  • Aperture doesn't generate xml file

    Aperture 3.5.1 is supposed to generate an ApertureDatabase.xml file to use images in third-party software. I have the Preference set to generate this file whenever Aperture closes, but my main Aperture library does not generate this file. I tried setting the Preference to Always and that also doesn't work.
    My smaller, newer Aperture libraries do generate the xml file as they're supposed to. Only the older, much larger Aperture library does not generate it. This same problem exists on my iMac as well as on a copy of the library on my MacBook Air.
    I created a new Aperture library that did generate the xml file. Then I imported the older library into it (took forever) but this library no longer generated the xml file.
    Can I get Aperture to do what it's supposed to do?

    I was asking the OP, it is usually best to start your own thread becuse, as this case shows, posting to another's thread can cause confusion.
    You are looking at the preferences when the library in question is opened, correct? As I wrote this  is one (if not the only) preference that is set on a per library basis. If you look at it while a different library is opened you might not be seeing the correct setting.
    You could try the steps shown in Aperture 3: Troubleshooting Basics, that is always a good place to start.
    Having said that, and while not having the XML file can be a problem, I don;t understand why Hazel would need the XML file to import into Aperture. Aperture is responsible for writing the XML file and it does that to reflect the state of the library.
    If you are looking for a simple way to import into Aperture you should look at Automator. A simple one or two action workflow does it.
    regards

Maybe you are looking for