Need help converting txt to XML


 
Thread Tools Search this Thread
# 1  
Need help converting txt to XML

I have a table as following

Archive idLineAuthorTime Text
1fjj34 375jk5l 03:20 this is an evidence regarding ...
1fjj34 4gjhhtrd03:21 we have seen those documents before
1fjj34 10645jmdvvb04:00 Will you consider such an offer?
3a530367rdnsa01:17 Will you consider such an offer?

but my separators are "|" so my plain text files looks like

Quote:
Archive id|Lie|Author|Time|Text
1fjj34|3|75jk5l|03:20|this is an evidence regarding xxx
1fjj34|4|gjhhtrd|03:21|we have seen those documents before
1fjj34|10|645jmdvvb|04:00|Will you consider such an offer?
3a530|3|67rdnsa|01:17|Will you consider such an offer?
I have absolute no ideal when where to start in relation to convert it to XML and my data is nested so bit confused. I would be grateful if you can help me.Smilie

the output structure is
Code:
< archives>
	
	< archive id="1fjj34">
		<file line="3">
			<author>75jk5l</author>
			<time>03:20</time>
			<text> this is an evidence regarding xxx </text>
		</file>
		<file line="4">
			<author>gjhhtrd</author>
			<time>03:21</time>
			<text> we have seen those documents before </text>
		</file>
		
		<file line="10">
			<author>645jmdvvb</author>
			<time>04:00</time>
			<text> Will you consider such an offer? </text>
		</file>
	</archive>
	
	< archive id="3a530">
		<file line="3">
			<author>67rdnsa</author>
			<time>01:17</time>
			<text> Will you consider such an offer? </text>
		</file>
	</ archive>
	
< archives>

note: the data has originally been in XML, I have received the help from this forum to convert in to txt which you can see in here. I have done all the calculation and filtering I needed and wished to convert it back to XML

Thank you in advance for your help
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #56
Difficulty: Easy
A flip-flop circuit stores 1 bit of data.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Converting XML to CSV

Hello, For i while i have been using XMLStarlet to convert several XML files to CSV files. So far this always went fine. Today however i got a new XML format however but i cannot find out how to get the data i need. Below is part of the code where it shows the different format. What... (10 Replies)
Discussion started by: SDohmen
10 Replies

2. Shell Programming and Scripting

Using awk for converting xml to txt

Hi, I have a xml script, I converted it to .txt with values comma seperated using awk function. But I want the output values should be inside double quotes My xml script (Workorders.xml) is shown like below: <?xml version="1.0" encoding="utf-8" ?> <scbm-extract version="3.3">... (8 Replies)
Discussion started by: Viswanatheee55
8 Replies

3. UNIX for Dummies Questions & Answers

Converting txt output to rows and columns and send report via mail.

Hi All, I would like to send below output in a tabular column ( xml or excel ) and send a mail. vinay unix anil sql vamsee java request to suggest a solution. (1 Reply)
Discussion started by: Girish19
1 Replies

4. Shell Programming and Scripting

Weird issue in converting XLSX to TXT

Hi Guys, I have used Perl scripting to convert XLSX file to TXT file using Perl module Spreadsheet::XLSX. I processed one XLSX file having one column and 65k rows of data . Strangely ,It is merging data for every 2047 row and I could see data in TXT file as Ex: Suppose in XLSX file ,if... (2 Replies)
Discussion started by: Rajk459
2 Replies

5. Shell Programming and Scripting

Converting txt file into CSV using awk or sed

Hello folks I have a txt file of information about journal articles from different fields. I need to convert this information into a format that is easier for computers to manipulate for some research that I'm doing on how articles are cited. The file has some header information and then details... (8 Replies)
Discussion started by: ksk
8 Replies

6. Shell Programming and Scripting

Converting txt file in csv

HI All, I have a text file memory.txt which has following values. Average: 822387 7346605 89.93 288845 4176593 2044589 51883 2.47 7600 i want to convert this file in csv format and i am using following command to do it. sed s/_/\./g <... (3 Replies)
Discussion started by: mkashif
3 Replies

7. Shell Programming and Scripting

converting .txt to comma delimeted file

Dear all, I have a file with 5L records. one of the record in the file is as shown below. MARIA THOMAS BASIL 1000 FM 1111 MD GHANA YY 77354 4774 99999999 1234567 I need to convert this record in below format "","","","","MARIA","THOMAS","BASIL","","1000 FM 1111 MD","STE... (1 Reply)
Discussion started by: OSD
1 Replies

8. UNIX for Advanced & Expert Users

Cutting two colums and converting them to ascii (.txt) format

Hello Gurus, I have a file in which two columns contains binary data i want to cut those two binary columns convert them to ascii and process the file. i tried using cut command..i am able to cut but how can i convert them from binary to ascii and paste them in their original position. ... (1 Reply)
Discussion started by: mora
1 Replies

9. UNIX for Dummies Questions & Answers

converting txt files in linux to windows

HI.. i have this problem..i want to copy a text file from linux and import it into an access file..but so many junk characters are coming in between..what i have to do.. plz help.. thanx in advance, (4 Replies)
Discussion started by: newbuddy
4 Replies

10. UNIX for Dummies Questions & Answers

converting .txt

Hello, I transferred some .txt files from windows to Unix. When i used the editor in Unix to open up the file, all the <cr> show up. How to I get rid of all of them? (4 Replies)
Discussion started by: laila63
4 Replies
XML::LibXML::NodeList::Iterator(3pm)			User Contributed Perl Documentation		      XML::LibXML::NodeList::Iterator(3pm)

NAME
XML::LibXML::NodeList::Iterator - Iteration Class for XML::LibXML XPath results SYNOPSIS
use XML::LibXML; use XML::LibXML::NodeList::Iterator; my $doc = XML::LibXML->new->parse_string( $somedata ); my $nodelist = $doc->findnodes( $somexpathquery ); my $iter= XML::LibXML::NodeList::Iterator->new( $nodelist ); # more control on the flow while ( $iter->nextNode ) { # do something } # operate on the entire tree $iter->iterate( &operate ); DESCRIPTION
XML::LibXML::NodeList::Iterator is very similar to XML::LibXML::Iterator, but it does not iterate on the tree structure but on a XML::LibXML::NodeList object. Because XML::LibXML::NodeList is basicly an array the functionality of XML::LibXML::NodeList::Iterator is more restircted to stepwise foreward and backward than XML::LibXML::Iterator is. SEE ALSO
XML::LibXML::NodeList, XML::NodeFilter, XML::LibXML::Iterator AUTHOR
Christian Glahn, <phish@cpan.org> COPYRIGHT
(c) 2002-2007, Christian Glahn. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.0 2007-09-28 XML::LibXML::NodeList::Iterator(3pm)

Featured Tech Videos