Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Reading Xml file and print the values into the text file in columnwise? Post 302950270 by sravanreddy on Thursday 23rd of July 2015 03:13:44 AM
Old 07-23-2015
Thanks a lot Don Cragun...This code is working exactly..........thank you...
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

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>... (0 Replies)
Discussion started by: ram2s2001
0 Replies

2. Shell Programming and Scripting

Comparing files columnwise and print the differences in third file

Hello Everybody!!!!!!!!! Request you to help me with the below mentioned issue: I have 2 files say, File 1: a|4|7 b|3|2 c|8|8 d|8|9 File 2: a|4|6 b|2|2 c|8|8 d|9|8 The third file(output file) should have: Data mismatch in row 1 column 3 Data mismatch in row 2 coumn 2 Data... (3 Replies)
Discussion started by: abhijeet1409
3 Replies

3. Shell Programming and Scripting

Help with reading file with values and updating another file

Hi I need some help with a task, i am an absolute newbie to any form of shell scripting and request guidance. Task: 1. Read a config file in form of name value pair ex host=www.test.com port=8080 binding="dynamic" or "other" or "something else" key1=value1 key2=value2 key3=value4... (4 Replies)
Discussion started by: mk7074
4 Replies

4. Shell Programming and Scripting

remove values of a file one by one from 2nd file and then print the remaining values of 2nd file

Hi all, I have 2 files. One contains only 1 column and other one contains 2 columns, let say 1_col.txt and 2_col.txt respectively. Here, I will try to explain with an example. Input files : 1_col.txt 2_col.txt a a b x a c p ... (5 Replies)
Discussion started by: AshwaniSharma09
5 Replies

5. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

6. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Match text to lines in a file, iterate backwards until text or text substring matches, print to file

hi all, trying this using shell/bash with sed/awk/grep I have two files, one containing one column, the other containing multiple columns (comma delimited). file1.txt abc12345 def12345 ghi54321 ... file2.txt abc1,text1,texta abc,text2,textb def123,text3,textc gh,text4,textd... (6 Replies)
Discussion started by: shogun1970
6 Replies
MKDoc::XML::Token(3pm)					User Contributed Perl Documentation				    MKDoc::XML::Token(3pm)

NAME
MKDoc::XML::Token - XML Token Object SYNOPSIS
my $tokens = MKDoc::XML::Tokenizer->process_data ($some_xml); foreach my $token (@{$tokens}) { print "'" . $token->as_string() . "' is text " if (defined $token->text()); print "'" . $token->as_string() . "' is a self closing tag " if (defined $token->tag_self_close()); print "'" . $token->as_string() . "' is an opening tag " if (defined $token->tag_open()); print "'" . $token->as_string() . "' is a closing tag " if (defined $token->tag_close()); print "'" . $token->as_string() . "' is a processing instruction " if (defined $token->pi()); print "'" . $token->as_string() . "' is a declaration " if (defined $token->declaration()); print "'" . $token->as_string() . "' is a comment " if (defined $token->comment()); print "'" . $token->as_string() . "' is a tag " if (defined $token->tag()); print "'" . $token->as_string() . "' is a pseudo-tag (NOT text and NOT tag) " if (defined $token->pseudotag()); print "'" . $token->as_string() . "' is a leaf token (NOT opening tag) " if (defined $token->leaf()); } SUMMARY
MKDoc::XML::Token is an object representing an XML token produced by MKDoc::XML::Tokenizer. It has a set of methods to identify the type of token it is, as well as to help building a parsed tree as in MKDoc::XML::TreeBuilder. API
my $token = new MKDoc::XML::Token ($string_token); Constructs a new MKDoc::XML::Token object. my $string_token = $token->as_string(); Returns the string representation of this token so that: MKDoc::XML::Token->new ($token)->as_string eq $token is a tautology. my $node = $token->leaf(); If this token is not an opening tag, this method will return its corresponding node structure as returned by $token->text(), $token->tag_self_close(), etc. Returns undef otherwise. my $node = $token->pseudotag(); If this token is a comment, declaration or processing instruction, this method will return $token->tag_comment(), $token_declaration() or $token->pi() resp. Returns undef otherwise. my $node = $token->tag(); If this token is an opening, closing, or self closing tag, this method will return $token->tag_open(), $token->tag_close() or $token->tag_self_close() resp. Returns undef otherwise. my $node = $token->comment(); If this token object represents a declaration, the following structure is returned: # this is <!-- I like Pie. Pie is good --> { _tag => '~comment', text => ' I like Pie. Pie is good ', } Returns undef otherwise. my $node = $token->declaration(); If this token object represents a declaration, the following structure is returned: # this is <!DOCTYPE foo> { _tag => '~declaration', text => 'DOCTYPE foo', } Returns undef otherwise. my $node = $token->pi(); If this token object represents a processing instruction, the following structure is returned: # this is <?xml version="1.0" charset="UTF-8"?> { _tag => '~pi', text => 'xml version="1.0" charset="UTF-8"', } Returns undef otherwise. my $node = $token->tag_open(); If this token object represents an opening tag, the following structure is returned: # this is <aTag foo="bar" baz="buz"> { _tag => 'aTag', _open => 1, _close => 0, foo => 'bar', baz => 'buz', } Returns undef otherwise. my $node = $token->tag_close(); If this token object represents a closing tag, the following structure is returned: # this is </aTag> { _tag => 'aTag', _open => 0, _close => 1, } Returns undef otherwise. my $node = $token->tag_self_close(); If this token object represents a self-closing tag, the following structure is returned: # this is <aTag foo="bar" baz="buz" /> { _tag => 'aTag', _open => 1, _close => 1, foo => 'bar', baz => 'buz', } Returns undef otherwise. my $node = $token->text(); If this token object represents a piece of text, then this text is returned. Returns undef otherwise. TRAP! $token->text() returns a false value if this text happens to be '0' or ''. So really you should use: if (defined $token->text()) { ... do stuff... } NOTES
MKDoc::XML::Token works with MKDoc::XML::Tokenizer, which can be used when building a full tree is not necessary. If you need to build a tree, look at MKDoc::XML::TreeBuilder. 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::Tokenizer MKDoc::XML::TreeBuilder perl v5.10.1 2004-10-06 MKDoc::XML::Token(3pm)
All times are GMT -4. The time now is 06:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy