Need help reading XML file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need help reading XML file
# 1  
Old 11-16-2005
Need help reading XML file

If someone out there could help me out with this problem. I would really

appreciate it.

My requirement is :Read XML and put data in Test.txt file.Using Shell script(bourn)


My xml file:

<root>

<header>
<HeaderData1>header1</HeaderData1>
<HeaderData2>header2</HeaderData2>
</header>

<detailsRecord>
<DetailRecord1>detail1</DetailRecord1>
<DetailRecord2>detail2</DetailRecord2>
<detailsRecord>

<detailsRecord>
<DetailRecord1>detail3</DetailRecord1>
<DetailRecord2>detail4</DetailRecord2>

<detailsRecord>

<trailer>
<trailer>trailer1</trailer>
</trailer>

</root>





My File Test.txt

Header Record : header1 header2
DetailsRecord : detail1 detail2
DetilsRecord : detail3 detail4
Trailer Record: trailer1



Fixed lengths in Test.txt FILE:

header1(1-7) header2(14-20)
detail1(1-7) detail2( 18-24)
detail3(1-7) detail4( 18-24)
trailer(1-7)






I can't use whitespace as a delimiter.


Thanks you guys very much,
I really appreciate it.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

How to write in other language in text/xml file by reading english text/xml file using C++?

Hello Team, I have 2 files.one contains english text and another contains Japanese. so i have to read english text and replace the text with Japanesh text in third file. Basically, I need a help to write japanese language in text/xml file.I heard wstring does this.Not sure how do i write... (2 Replies)
Discussion started by: SA_Palani
2 Replies

2. UNIX for Dummies Questions & Answers

XML reading and parsing! Please help

See test.xml file attached (7 Replies)
Discussion started by: JulioAmerica
7 Replies

3. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies

4. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

5. Shell Programming and Scripting

Reading XML file and extracting value

Dear All, I am reading one XML file to extract value from the particular tag:- Sample xml is below:- <KeyValuePairs> <Key>TestString</Key> <Value>Test12_Pollings</Value> </KeyValuePairs> I want to read the value for the KEY tag and there will be multiple key tags :- awk... (4 Replies)
Discussion started by: sharsour
4 Replies

6. Shell Programming and Scripting

Reading XML and replacing a string

Hi All, My thanks in advance for you guys reading this and for any posts. I'm having 100 XML files, I need script which replace a specific string. It must be incrementing in 100 xml files.. Sample XML files: <hwIPHostName type="attrib">DEMO1</hwIPHostName> I need Demo1 to be... (4 Replies)
Discussion started by: karty2129
4 Replies

7. Shell Programming and Scripting

Reading XML data in a FLAT FILE

I have a requirement to read the xml file and split the files into two diffrent files in Unix shell script. Could anyone please help me out with this requirement. Sample file --------------- 0,<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Information... (3 Replies)
Discussion started by: kmanivan82
3 Replies

8. Shell Programming and Scripting

Reading only particular TAG from XML

Hi, I have an XML file with following structure. Between following tags I have pipedelimited records with newline characters (Data1|1|2|3) <!]> I need to read the data between above tags so that my output is a flat file with pipedelimited records. <BOS> <Header> <TTC>ABC</TTC> ... (9 Replies)
Discussion started by: dsrookie
9 Replies

9. Shell Programming and Scripting

Reading filenames with extension .xml

Hi, I want to write a script to read all the filenames with extension .xml in a directory and pass the name of the file, one by one, to another function. Please help me out. Regards. Saurabh (3 Replies)
Discussion started by: bhalotias
3 Replies
Login or Register to Ask a Question
MKDoc::XML::Decode(3pm) 				User Contributed Perl Documentation				   MKDoc::XML::Decode(3pm)

NAME
MKDoc::XML::Decode - Expands XML entities SYNOPSIS
use MKDoc::XML::Decode; my $decode = new MKDoc::XML::Decode qw/xml xhtml numeric/; # $xml is now "Chris' Baloon" my $xml = MKDoc::XML::Decode->process ("Chris&apos; Baloon"); SUMMARY
MKDoc::XML::Decode is a very simple module with pluggable entity decoding mechanism. At the moment there are three modules: xml - Decodes &apos; &quot; &gt; &lt; and &amp; xhtml - Decodes XHTML entities such as &eacute; numeric - Decodes numeric entities such as &#65; That's it. This module and its counterpart MKDoc::XML::Encode are used by MKDoc::XML::Dumper to XML-encode and XML-decode litterals. API
my $decode_object = new MKDoc::XML::Decode (@modules); Constructs a new decode object using the modules specified in @modules. my $decoded = $decode_object->decode ($stuff); Decodes $stuff and returns it into $decoded. Any entity which is not recognized will be returned as is but will trigger a warning. AUTHOR
Copyright 2003 - MKDoc Holdings Ltd. Author: Jean-Michel Hiver This module is free software and is distributed under the same license as Perl itself. Use it at your own risk. SEE ALSO
MKDoc::XML::Encode perl v5.10.1 2004-10-06 MKDoc::XML::Decode(3pm)