KSH Script to Get the <TAG Values> from an XML file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting KSH Script to Get the <TAG Values> from an XML file
# 1  
Old 11-05-2008
KSH Script to Get the <TAG Values> from an XML file

Hi All,
I am new to Unix I need a KSH script to get the values from XML file to write to a temp file.
Like the requirement is from the below TAG

<MAPPING DESCRIPTION ="Test Mapping" ISVALID ="YES" NAME ="m_test_xml" OBJECTVERSION ="1" VERSIONNUMBER ="1">

I need the MAPPING DESCRIPTION and the NAME = m_test_xml" to be written to a file.
Thanks in advance
perlamohan
# 2  
Old 11-05-2008
read <TAG> values from xml files

hi,
I need to get the values from the XML TAG like here is the requirment
<MAPPING DESCRIPTION ="Test Mapping" ISVALID ="YES" NAME ="m_test_xml" OBJECTVERSION ="1" VERSIONNUMBER ="1">

while reading the XML file the tag values
MAPPING DESCRIPTION
ISVALID
NAME
OBJECTVERSION
VERSIONNUMBER
should be written to a temp file.

Thanks
Perlamohan
# 3  
Old 11-05-2008
How can I query and sort this XML file ?

<CIM><INSTANCE CLASSNAME="CIM_DataFile"><PROPERTY NAME="FileSize" TYPE="uint64"><VALUE>247296</VALUE>
</PROPERTY>
<PROPERTY NAME="Name" TYPE="string"><VALUE>e:\tool\gawk.exe</VALUE>
</PROPERTY>
</INSTANCE>
<INSTANCE CLASSNAME="CIM_DataFile"><PROPERTY NAME="FileSize" TYPE="uint64"><VALUE>220</VALUE>
</PROPERTY>
<PROPERTY NAME="Name" TYPE="string"><VALUE>e:\tool\i.txt</VALUE>
</PROPERTY>
</INSTANCE>
<INSTANCE CLASSNAME="CIM_DataFile"><PROPERTY NAME="FileSize" TYPE="uint64"><VALUE>9</VALUE>
</PROPERTY>
<PROPERTY NAME="Name" TYPE="string"><VALUE>e:\tool\run.bat</VALUE>
</PROPERTY>
</INSTANCE>
<INSTANCE CLASSNAME="CIM_DataFile"><PROPERTY NAME="FileSize" TYPE="uint64"><VALUE>0</VALUE>
</PROPERTY>
<PROPERTY NAME="Name" TYPE="string"><VALUE>e:\tool\temp.xml</VALUE>
</PROPERTY>
</INSTANCE>
</CIM>

The XML file is above, how can I query the information into this format:
PROPERTY NAME
TYPE
# 4  
Old 11-05-2008
please help me in writing a ksh script for validating xml files

hi all unix experts,
please help me in writing a ksh script for validating xml files where we need to capture the information like
<TAG ....Values.....>
...
...
...

..

</TAG>
i would be thankful if you could drop in your contact details so that i can explain the exact requirment...
thanks a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grepping multiple XML tag results from XML file.

I want to write a one line script that outputs the result of multiple xml tags from a XML file. For example I have a XML file which has below XML tags in the file: <EMAIL>***</EMAIL> <CUSTOMER_ID>****</CUSTOMER_ID> <BRANDID>***</BRANDID> Now I want to grep the values of all these specified... (1 Reply)
Discussion started by: shubh752
1 Replies

2. Shell Programming and Scripting

Moving XML tag/contents after specific XML tag within same file

Hi Forum. I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script. Any feedback will be greatly appreciated. ... (19 Replies)
Discussion started by: pchang
19 Replies

3. Shell Programming and Scripting

Extract values from xml file script

Hi, please help on this. I want extract values of xml file structure and print in determined way. <ProjectName> --> only appears once <StructList> --> is the top node <Struct> node --> could be more than 1 NameID, STX, STY, PRX, PRY --> appears only 1 time within each <Struct> node... (10 Replies)
Discussion started by: Ophiuchus
10 Replies

4. Shell Programming and Scripting

To search for a particular tag in xml and collate all similar tag values and display them count

I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help File: <xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies

5. Shell Programming and Scripting

Find out values between xml tag

Find out values between xml tag ....... ABC><name></ABC><xyz>test</xyz>..here some other tag... <ABC><NUMBER></ABC><xyz>12345</xyz>.... ....... I want to take between bewtween ABC><NUMBER></ABC><xyz> to </xyz> that is 12345 (3 Replies)
Discussion started by: Jairaj
3 Replies

6. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

7. Shell Programming and Scripting

XML tag replacement from different XML file

We have 2 XML file 1. ORIGINAL.xml file and 2. ATTRIBUTE.xml files, In the ORIGINAL.xml we need some modification as <resourceCode>431048</resourceCode>under <item type="Manufactured"> tag - we need to grab the 431048 value from tag and pass it to database table in unix shell script to find the... (0 Replies)
Discussion started by: balrajg
0 Replies

8. Shell Programming and Scripting

Change values in Log4j.xml using ksh script

Hi, I am new to UNIX and shell scripting. I have to create a shell script(ksh) which parses log4j.xml file for a given webservice name and change the corresponding value from INFO to DEBUG or vice-versa. My log4j.xml looks like:- <!-- Appender WEBSERVICENAME--> <appender... (3 Replies)
Discussion started by: sanjeevcseng
3 Replies

9. Shell Programming and Scripting

Extracting tag values from XML using perl

Hi All, I'm trying to extract the values for the 'src' and 'alt' tags within an xml file. In the files that I'm searching, the tags are always enclosed within an 'img' tag. Typically: <img src="diwiz01.gif" width="576" height="254" alt="Out-of-process and In-process COM Objects"><bookmark... (3 Replies)
Discussion started by: Steve_altius
3 Replies

10. Shell Programming and Scripting

Parsing and getting data from XML file using ksh script

Hi All, I have a xml file for example as described below <xml> <address> <street><street> <address/> <isbn>426728783932020308393930303</isbn> <book> <name> </name> </book> . . . </xml> My problem is to get the isbn number from the above described file using ksh script. Could... (6 Replies)
Discussion started by: vinna
6 Replies
Login or Register to Ask a Question