473,467 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

text to xml conversion

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 <?xmlline 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 '07 #1
2 2520
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
Jun 22 '07 #2
se***********@yahoo.ca 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
Jun 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Rare Book School | last post by:
RARE BOOK SCHOOL 2005 Rare Book School is pleased to announce its schedule of courses for 2005, including sessions at the University of Virginia, the Walters Art Museum/Johns Hopkins University...
40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
10
by: st4 | last post by:
Help, As part of my family history web site i need to get 150 pages of typed text into some format to display. It just text right now but I would like to add some graphics (photos) and make the...
5
by: Lenard Gunda | last post by:
hi! I have the following problem. I need to read data from a TXT file our company receives. I would use StreamReader, and process it line by line using ReadLine, however, the following problem...
10
by: Nikolay Petrov | last post by:
How can I convert DOS cyrillic text to Unicode
3
by: Francesc | last post by:
Hi, I'm new at this newsgroup and I want do ask some questions and opinions about this subject. I'm developing an application focused in a very specific task: clean and labelling text documents...
4
by: George | last post by:
Hi, I am puzzled by the following and seeking some assistance to help me understand what happened. I have very limited encoding knowledge. Our SAP system writes out a text file which includes...
2
by: kinarism | last post by:
Sorry for posting on multiple groups with this, I am new to the groups and didnt know the possibility of "cross-posting" was possible. Anyway, my post in the "upgrade" group hasnt gotten any...
6
by: rohit | last post by:
Hi All, I am new to C language.I want to read integers from a text file and want to do some operation in the main program.To be more specific I need to multiply each of these integers with another...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.