Need help with generating XML files

Discussions

EJB programming & troubleshooting: Need help with generating XML files

  1. Need help with generating XML files (8 messages)

    I have a file with the following representation:

    Joe|Leduc|34 avenue|Montreal

    need to take the file and transform is into XML like:

    <record>
      <fname>Joe</fname>
      <lname>Leduc</lname>
      <street>34 avenue</street>
      <city>Montreal</city>
    </record>

    I would thank anyone in advance for any help or ideas? Thanks fellow programmers.

    Threaded Messages (8)

  2. Need help with generating XML files[ Go to top ]

    1. create a class say Person:

    class Person {
     String fname;
     String lname;
     String street;
     String city;
    }

    2. parse the file and populates data read into a Person object.

    3. pass this Person object to a XMLGenerator class which create an XML files.

    4. The XMLGenerator class create the XML file using reflection. In that way, it supports any object that u pass to it.

    i've a class that does something similar to XMLGenerator. it creates a DOM document instead of a XML file.

    if u are interested, i can send u the src.

    alex









  3. Need help with generating XML files[ Go to top ]

    please send it to me. I would really appreciate it.
    I have another question, if I want to copy a file from a server locally. How do I do it?
  4. Need help with generating XML files[ Go to top ]

    pl give me ur email addr.

    alex
  5. Need help with generating XML files[ Go to top ]

    My email is the following
    rassaad at hotmail dot com
    Anything to give me some help would do. Thanks.
  6. Can you send the document to me?
    mail-id: prabinkumar dot mahapatra at in dot efunds dot com


    Thanx.
    Prabin
  7. Take the previous example. I just need some help to start coding. Thanks.
  8. Need help with generating XML files[ Go to top ]

    For creating your file, you can also use the following UNIX shell script line :

    cat yourfile|sed '/|/s//<\/fname><lname>/' | sed '/|/s//<\/lname><street>/'|sed '/|/<\/street><city>/'|awk '{print "<record><fname>" $0 "</city></record>"}

    It's quick and easy isn't it ?
  9. Need help with generating XML files[ Go to top ]

    Thanks for your help. But I need to do it in a Java Application.