Sponsored Content
Top Forums Shell Programming and Scripting Tabulate nodes and subnodes of XML file script Post 302895958 by Ophiuchus on Thursday 3rd of April 2014 12:47:32 PM
Old 04-03-2014
Hello shamrock,

Thanks for answer.

That is the input I have. What I can do is showing with colors as below.

I show the nodes I have to print, ABx, CDy, MJp. But CDy and MJp could belong to 2 different subnodes (RN, JN) because of that
in the output desired I put in column 2 RN as first header and in column 4 JN. And as second header I put CDy and MJp corresponding
to nodes RN and JN.

I'm attaching the output in HMTL format. And an image of the output showing in colors the header and subheader and cells in grey
are CDy's for RN and cells in green are MJp's for JN. Cells in orange are the ABx's.

I hope make sense.

Thanks in advance.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<TUPH>
	<KIND>
		<ABx>Event 1</ABx>
			<RN>
				<MO>
					<CDy>11</CDy>
					<CDy>5</CDy>				
				</MO>	
				<MO>
					<MJp>6</MJp>
					<MJp>7</MJp>
					<MJp>9</MJp>				
				</MO>				
			</RN>
			<JN>
				<MO>
					<CDy>8</CDy>				
				</MO>	
				<MO>
					<MJp>1</MJp>
					<MJp>3</MJp>			
				</MO>			
			</JN>		
	</KIND>
	<KIND>	
		<ABx>Event 2</ABx>
			<RN>
				<MO>
					<CDy>3</CDy>
				</MO>	
				<MO>
					<MJp>5</MJp>
				</MO>				
			</RN>
			<JN>
				<MO>
					<CDy>6</CDy>
				</MO>	
				<MO>
					<MJp>2</MJp>
				</MO>					
			</JN>
	</KIND>	
</TUPH>

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to map XML nodes

Hi folks, I'm a bit of a novice at this but here goes. I want to read in nodes from an XML file, and map the path to each. eg the file is structured <node><nodename>.</nodename> <node><nodename>topnode</nodename> <node><nodename>subnode1</nodename></node> ... (1 Reply)
Discussion started by: mark14
1 Replies

2. Shell Programming and Scripting

How to remove xml namespace from xml file using shell script?

I have an xml file: <AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Table1> <Data1 10 </Data1> <Data2 20 </Data2> <Data3 40 </Data3> <Table1> </AutoData> and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only. I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies

3. Shell Programming and Scripting

Script for showing only selected nodes

Dear all, I am bit confused lately, I have a xmlfile here: file: book.xml <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> ... (2 Replies)
Discussion started by: penyu
2 Replies

4. Shell Programming and Scripting

Run script on HACMP nodes?

Hello All, Anybody knows how can I run script on the AIX HACMP offline node, without logon a offline node? I would like to run a script on the online node and at same time or after the online node on the offline node. Any IDEA? :confused: (3 Replies)
Discussion started by: kalaso
3 Replies

5. Shell Programming and Scripting

KSH - help needed for creating a script to generate xml file from text file

Dear Members, I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input. The contents of a single cell of INFO column is like: Area:app - aam Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies

6. Shell Programming and Scripting

Strip xml element nodes based on conditions

Hi Gurus, I have a xml in which I have to remove unused element nodes. Here are the requirements 1. Remove StoreAddresses & Contacts complex element directly 2. Remove StoreItemCharacteristic element based on CharacteristicName="Organic" Here is the sample xml <?xml version="1.0"... (0 Replies)
Discussion started by: kumars_49
0 Replies

7. Shell Programming and Scripting

Interacitve script for Healthcheckup of nodes

Hi This is my first post to this site.:D I want to develop a script with following steps: 1.Script1,2,3 placed at particular path on local server 2.ask for an IP and will directly pick up the correct script matching to the IP (IP could be defined in same script or a new script could be called).... (10 Replies)
Discussion started by: veronica
10 Replies

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

9. Shell Programming and Scripting

Tabulate data in a table.

I have about a million tables stored as .txt files in a directory. The content of the files look like this: ages-eligible-for-study: genders-eligible-for-study: accepts-healthy-volunteers: CONTINUE 18-months-to-36-months both yes CONTINUE DONEOther examples, CONTINUE... (8 Replies)
Discussion started by: shoaibjameel123
8 Replies
XML::LibXML::Comment(3) 				User Contributed Perl Documentation				   XML::LibXML::Comment(3)

NAME
XML::LibXML::Comment - XML::LibXML Comment Class SYNOPSIS
use XML::LibXML; # Only methods specific to Comment nodes are listed here, # see XML::LibXML::Node manpage for other methods $node = XML::LibXML::Comment->new( $content ); DESCRIPTION
This class provides all functions of XML::LibXML::Text, but for comment nodes. This can be done, since only the output of the node types is different, but not the data structure. :-) METHODS
The class inherits from XML::LibXML::Node. The documentation for Inherited methods is not listed here. Many functions listed here are extensively documented in the DOM Level 3 specification (http://www.w3.org/TR/DOM-Level-3-Core/ <http://www.w3.org/TR/DOM-Level-3-Core/>). Please refer to the specification for extensive documentation. new $node = XML::LibXML::Comment->new( $content ); The constructor is the only provided function for this package. It is required, because libxml2 treats text nodes and comment nodes slightly differently. AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas VERSION
2.0008 COPYRIGHT
2001-2007, AxKit.com Ltd. 2002-2006, Christian Glahn. 2006-2009, Petr Pajas. perl v5.16.2 2012-10-22 XML::LibXML::Comment(3)
All times are GMT -4. The time now is 08:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy