text to xml conversion

Discussion in 'XML' started by sethridge1991@yahoo.ca, Jun 21, 2007.

  1. Guest

    Hi Everyone,

    I am trying to send a XML file via SFTP staying completely in UNIX.

    The data in the file will vary everytime I create and send it. This is
    not a simple address book dump.

    This is what I am trying to do:

    1. Access my Unix DataBase
    2. Depending on the situation, different data, some of it repeating,
    gets dumped into a UNIX text file. Because of the potential
    combinations of required data, I am embedding the corresponding data
    tags around the individual data items when I am deciding which data
    should be sent. The data comes from several related DB Files.
    My first line in my text file is -<header>.
    3. I want to execute a UNIX script that will convert the text file,
    login to a SFTP server in batch mode and send the converted file to
    the SFTP server.

    The SFTP part is ok. It is the conversion to XML that is the problem.
    All the examples I see on the Net, involve typical data.

    Here is a simple stripped down example of what my text file would look
    like (bare in mind, this does not reflect the complexity of the
    decision making or data):

    -<header>
    -<personal_info>
    -<name>John Smith</name>
    -<address1>123 Main Street</address1>
    -<address2>Any City, XX 9999999</address2>
    -<status>employed</status>
    -<occupation>plumber</occupation>
    -<salary>60000</salary>
    </personal_info>
    -<personal_info>
    -<name>Jane Doe</name>
    -<address1>100 Maple Street</address1>
    -<address2>First City, YY 8888888</address2>
    -<status>housewife</status>
    </personal_info>
    </header>

    In this example, people who are employed also require occupation and
    salary. The data is not typical. Trying to dump the data comma
    separated, in this example, may look easy, but my actual situation
    does not lend itself to null fields.

    Is there a point where I can start in the conversion and take
    advantage of the fact the embedded data tags already exist?

    The <?xml> line will be version 1.0, encoding UTF-8, standalone Yes.

    I have the full XML Library in my UNIX version (SCO Openserver 5.7).

    Any ideas or suggestions would be greatly appreciated.

    Regards,
    Steve
     
    , Jun 21, 2007
    #1
    1. Advertising

  2. Decide how you want the XML structured to represent your data.

    Gather the data from your database.

    Wrap the XML structure around it -- either via text manipulation
    (sloppy, has hazards, not recommended) or via the DOM or SAX APIs
    feeding into an XML serializer to create the XML file.

    Transmit as appropriate.

    > The data is not typical.


    I have no idea what you mean by "not typical" in this context. That
    looks like a typical-to-the-point-of-being-pedestrian application...


    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Jun 22, 2007
    #2
    1. Advertising

  3. Peter Flynn Guest

    wrote:
    > Hi Everyone,
    >
    > I am trying to send a XML file via SFTP staying completely in UNIX.
    >
    > The data in the file will vary everytime I create and send it. This is
    > not a simple address book dump.
    >
    > This is what I am trying to do:


    This is extremely confusing.

    Sending a file by sftp is trivial. Using scp is even easier.

    > 1. Access my Unix DataBase




    > 2. Depending on the situation, different data, some of it repeating,
    > gets dumped into a UNIX text file. Because of the potential
    > combinations of required data, I am embedding the corresponding data
    > tags around the individual data items


    How? Manually in an editor? Using a programming language? XSLT?

    > when I am deciding which data
    > should be sent. The data comes from several related DB Files.
    > My first line in my text file is -<header>.


    I hope not. That hyphen is an artifact of viewing the XML document in a
    browser.

    > 3. I want to execute a UNIX script that will convert the text file,


    You want to convert some kind of unmarked plaintext file to XML, right?

    > login to a SFTP server in batch mode and send the converted file to
    > the SFTP server.
    >
    > The SFTP part is ok.


    So skip this.

    > It is the conversion to XML that is the problem.
    > All the examples I see on the Net, involve typical data.


    I don't know what "typical" data is.

    > Here is a simple stripped down example of what my text file would look
    > like (bare in mind, this does not reflect the complexity of the
    > decision making or data):
    >
    > -<header>
    > -<personal_info>
    > -<name>John Smith</name>
    > -<address1>123 Main Street</address1>
    > -<address2>Any City, XX 9999999</address2>
    > -<status>employed</status>
    > -<occupation>plumber</occupation>
    > -<salary>60000</salary>
    > </personal_info>
    > -<personal_info>
    > -<name>Jane Doe</name>
    > -<address1>100 Maple Street</address1>
    > -<address2>First City, YY 8888888</address2>
    > -<status>housewife</status>
    > </personal_info>
    > </header>


    OK. That looks straightforward.

    > In this example, people who are employed also require occupation and
    > salary. The data is not typical. Trying to dump the data comma
    > separated, in this example, may look easy, but my actual situation
    > does not lend itself to null fields.


    This data is not comma-separated, it's XML. Are you trying to convert
    comma-separated data to XML, or XML data to comma-separated?

    > Is there a point where I can start in the conversion and take
    > advantage of the fact the embedded data tags already exist?


    Show us an example of your raw data, as dumped out of the database.

    > Any ideas or suggestions would be greatly appreciated.


    Can you explain what it is you are trying to do, with an example of the
    input and an example of how the output ought to look? Then we might be
    able to help.

    ///Peter
     
    Peter Flynn, Jun 22, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raghavendra Mahuli
    Replies:
    2
    Views:
    398
    shaun
    Nov 3, 2005
  2. Francesc
    Replies:
    3
    Views:
    560
  3. Peter Flynn
    Replies:
    3
    Views:
    472
  4. =?iso-8859-1?q?Benjamin_B=E9car?=

    XML <=> Text conversion platform requiring high performance

    =?iso-8859-1?q?Benjamin_B=E9car?=, Aug 24, 2006, in forum: XML
    Replies:
    8
    Views:
    351
    =?iso-8859-1?q?Benjamin_B=E9car?=
    Aug 25, 2006
  5. Oleg

    Text to XML conversion

    Oleg, May 25, 2007, in forum: XML
    Replies:
    6
    Views:
    601
    Ian Wilson
    Jun 14, 2007
Loading...

Share This Page