Java code to generate XML File from XML Schema

Hi I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
Thankz in advance...

JAXB has been available as an early release download for some time. There are also XML Binding packages available from Borland (JBuilder) and Castor. These tools create Java classes from a source document, xml,dtd etc. You can use these classes to marshal-unmarshal XML documents.
Dave

Similar Messages

  • Hi I need this asap... "Java code to generate XML File from XML Schema"

    Hi all....
    I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
    Thankz in advance...
    PS: I already posted in the afternoon... this is the second posting.

    take look at :
    http://sourceforge.net/projects/jaxme/
    this might help...

  • I want to produce an XML file from XML Publisher and Burst it as XML

    Hi,
    I have XML data and I want to make a template that will generate an XML file from this data so I will be able to burst it.
    The output file of the bursting needs to be XML.
    Can anyone help me?
    Thanks,
    Chen.

    If you used your computer as part of the VHS to DVD process, then you'll have a digital audio file that we can find, but I'm guessing you used a VHS to DVD standalone recorder. If so, you can use some free software called MPEG Streamclip:
    - insert your DVD, and Quit from the DVD Player if it starts automatically.
    - start MPEG Streamclip and open the DVD; then open the Video TS folder and open the first of the .VOB files (repeat this step until you find the file you're interested in).
    - use the Export to AIFF option and you'll have the audio file.
    - you'll be able to bring this file into iTunes, burn it to CD, etc.
    John

  • JAVA code to Convert Excel file To XML file

    Hi,
    I am new to java ,Any one please share me the code to convert Excel file in to xml file.
    Thanks in advance.

    Here is a sample code for reading an Excel file. It uses JExcel API:
    package com.quicklyjava;
    import jxl.*;
    import jxl.read.biff.BiffException;
    import java.io.File;
    import java.io.IOException;
    public class JavaExcelRead {
    * @param args
    public static void main(String[] args) {
    try {
    //Create a workbook object from the file at specified location.
    //Change the path of the file as per the location on your computer.
    Workbook wrk1 = Workbook.getWorkbook(new File("C:/test.xls"));
    //Obtain the reference to the first sheet in the workbook
    Sheet sheet1 = wrk1.getSheet(0);
    //Obtain reference to the Cell using getCell(int col, int row) method of sheet
    Cell colArow1 = sheet1.getCell(0, 0);
    Cell colBrow1 = sheet1.getCell(1, 0);
    Cell colArow2 = sheet1.getCell(0, 1);
    //Read the contents of the Cell using getContents() method, which will return
    //it as a String
    String str_colArow1 = colArow1.getContents();
    String str_colBrow1 = colBrow1.getContents();
    String str_colArow2 = colArow2.getContents();
    //Display the cell contents
    System.out.println("Contents of cell Col A Row 1: \""+str_colArow1 + "\"");
    System.out.println("Contents of cell Col B Row 1: \""+str_colBrow1 + "\"");
    System.out.println("Contents of cell Col A Row 2: \""+str_colArow2 + "\"");
    } catch (BiffException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    You can further process this to convert the data extracted into XML. Hope this helps!

  • Java code for converting EDI file to XML file

    Dear friends,
                     Can you please help me in getting the java code for converting to EDI file to XML file.

    Hi,
    You can convert the EDI file to XML in any of the ways
    1) Using third party seeburger adapters
    2) Conversion agent
    3) Stylus studio.
    I think using java code it will be very difficult.
    Thnx
    Chirag

  • Generation of xml file from java code

    hi,
    I want to manipulate data in a xml file with java code.I have read data from xml file and also changed it. But i am unable to covert it again in xml file from java code. Can you please tell me how i can do this?

    Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html

  • Java Code to transfer a file through FTP

    I am writing a java code to transfer a file from local machine to a server on another machine.
    While uploading i am encountering with an exception which is showing as
    java.net.ConnectException: Connection refused: connect
    The file is getting transferred sucessfully if i am transferring it through command prompt instead of java code.
    Please help me out.

    Actually the code i have written is working fine when the two machines are local.
    But it is not working when the two syastems are connected through avantail.
    Then it is giving an exception
    java.net.ConnectException: Connection refused: connect
    while uploading

  • 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 to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • How to generate .java file from xml?

    Does anyone have an idea of how i can generate .java file from xml file? Tools like jakrata digester, JOX are there but both of them are useful in populating java beans from xml. My requirement is to generate .java file from .xml with getters and setters methods for xml elements/attributes. I also tried JAXB. But JAXB generates bunch of files and most of them are interfaces, which is not going to work for me.
    For e.g. i have following xml file and i want to generate Address.java file with getters/setters. Any ideas?
    <?xml version='1.0' encoding='UTF-8' ?>
    <Address>
    <FirstName type="String"/>
    <PoBox type="int"/>
    </Address>
    Thanks,
    Vicky

    Crosspost.
    http://forum.java.sun.com/thread.jsp?thread=475564&forum=4&message=2205846

  • Reference faces-config.xml file from java code.

    I would like to reference the navigation rules I have set up in my faces-config.xml file from inside my source code.
    For example:
    Navigation Rule:
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>pricingEngine</from-outcome>
    <to-view-id>/faces/template/t_pricing_engine.jsf</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>
    I would like do some sort of lookup by 'pricingEngine' and get '/faces/template/t_pricing_engine.jsf' back.
    Any ideas?

    I would like to reference the navigation rules I have set up in my faces-config.xml file from inside my source code.
    For example:
    Navigation Rule:
    <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
    <from-outcome>pricingEngine</from-outcome>
    <to-view-id>/faces/template/t_pricing_engine.jsf</to-view-id>
    <redirect/>
    </navigation-case>
    </navigation-rule>
    I would like do some sort of lookup by 'pricingEngine' and get '/faces/template/t_pricing_engine.jsf' back.
    Any ideas?

  • 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

  • Best Practices:: How to generate XML file from a ResultSet

    Hi all,
    Could someone please suggest the best practices of how to generate an XML file from a resultset? I am developing a web application in Java with Oracle database and one of my tasks is to generate an XML file when the user, for example, click a "download as XML" button on the JSP. The application is basically like an Order with line items. I am using Struts and my first thought has been to have an action class which will extend struts's DownloadAction and through StAX's Iterator API to create an XML file. I intend to have a POJO which will have properties of all columns of my order and line items tables so that for each order I get all line items and:
    1. Write order details then
    2. Through an iterator write line items of that order to an XML file.
    I will greatly appreciate for comments or suggestions on the best way to do this through any pointers on the Web.
    alex

    Use a OracleWebRowSet in which an XML representation of the result set may be obtained.
    http://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/files/oracle10g/webrowset/Readme.html
    http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/jcrowset.htm

  • How to edit the existing data in the XML file from java programming.

    Hi all
    i am able to create XML file with the sample data as below from java programming.
    i need sample code on how to edit the existing data in the XML file?
    for example
    <?xml version="1.0"?>
       <mydata>
               <data1>
                         <key1>467</key1>
                        <name1>Paul</name1>
                        <id1>123</id1>
              </data1>
              <data2>
                         <key2>467</key2>
                        <name2>Paul</name2>
                        <id2>123</id2>
              </data2>
        </mydata>
    i am able to insert the data in the XML.
    now i need sample code on how to modify the data in the above XML file from the java programming for only key2,name2,id2 tags only. the remaining tags data in the XML file i want to keep same data except for key2,name2,id2 which are i want to modify from java code
    Regards
    Sunil
    [points will be always rewardable]

    hi
    u need a parser or validate the xml file for to read the xml file from java coding u need for this
    xml4j.jar u can download this file  from here
    http://www.alphaworks.ibm.com/tech/xml4j
    or we can use the SAX(simple API for XML)
    some sample applications for this
    http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html
    http://www.developertutorials.com/tutorials/java/read-xml-file-in-java-050611/page1.html
    http://www.xml-training-guide.com/e-xml44.html
    let me know u need any other info
    bvr

  • Generate an XML file from a DOM tree

    Hi,
    I'm trying to generate an XML file from a DOM tree that I obtained from another XML file with the Xerces library. I used the following operation :
    public static void writeXmlFile(Document doc, String filename) {
    try {
    Source source = new DOMSource(doc);
    File file = new File(filename);
    Result result = new StreamResult(file);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    xformer.transform(source, result);
    } catch (TransformerConfigurationException e) {
    System.err.println(e);
    System.exit(1);
    } catch (TransformerException e) {
    System.err.println(e);
    System.exit(1);
    But I have this Windows/Linux problem. When I execute this on Windows, everything is correct. But if I try on Linux (every distribution does the same thing), I obtain an XML file where everything is written on just ONE LINE : there is neither identation nor carriage return at the end of a line ... And that is pretty annoying 'cause I need to SEE what I generate ...
    Thanks for your answer,
    Blueberryfin.

    Actually I would think that no indents and no new-lines would be more correct, but maybe it's an option for parsers to do it either way if you don't specify it. If you want to specify it, look at this post from last month:
    http://forum.java.sun.com/thread.jsp?forum=34&thread=383400

Maybe you are looking for

  • Ringtone not showing up for songs I bought on iTunes

    Ok, so I get that I can only create ringtones for songs bought through the iTunes store. Most of my songs are non-iTunes, but there are some that I had previously bought and want to turn into ringtones. However, after I turned the ringtone view optio

  • Row+colum

    How would go about accessing and changing these fields of the GridBagLayout class? How come this is not working... import java.awt.*; public class GBag extends Panel { public GBag() { GridBagConstraints c = new GridBagConstraints(); Font f = new Font

  • Does using "location services" constitute data useage from AT&T

    I travel between Seattle and Vancouver, BC almost every weekend. At the border, I always switch to Airplane Mode since I don't wish to be hit by huge data bills from AT&T through Rogers Wireless, the iPhone carrier in Canada. I then turn on WiFi and

  • Cannot view the concurrent program.

    After the user schedule for the concurrent program, there is nothing appear in the concurrent program window. Actually, the concurrent program is running, but just the users cannot see it. How to solve this problem?

  • Upgrading a customized bpel worklist application after patch update

    Hi, We have a customized worklist application running developed on SOA 10.1.3.1. Now that we are migrating to version 10.1.3.3. I have 2 related queries: 1. Is there any documentation on whatsnew in the worklist application provided by oracle as part