|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Extract data from XML file
Hi , I have input file as XML. following are input data #complex.xml Code:
<?xml version="1.0" encoding="UTF-8"?>
<TEST_doc xmlns="http://www.w3.org/2001/XMLSchema-instance">
<ENTRY uid="123456">
<protein>
<name>PROT001</name>
<organism>Human</organism>
<class>cytoplasmic</class>
</protein>
<xrefs>
<xref>
<database>Ensembl</database>
<accn>ENSG00000105829</accn>
</xref>
<xref>
<database>UNIPROT</database>
<accn>Q12345</accn>
</xref>
</xrefs>
</ENTRY>
<ENTRY uid="45678">
<protein>
<name>PROT002</name>
<organism>Human</organism>
<class>nuclear</class>
</protein>
<xrefs>
<xref>
<database>Ensembl</database>
<accn>ENSG00000105333</accn>
</xref>
<xref>
<database>UNIPROT</database>
<accn>Q14789</accn>
</xref>
</xrefs>
</ENTRY>
</TEST_doc>i want to extract data from this file and i tried below query. cat complex.xml | xml sel -t -m //xref -v "concat(../../protein/name,' ',../../protein/class,' ',./database,' ',./accn)" -n but it is not giving any output...but this query is working when instead of xmlns i am writing xmlns:xsi="...." but my input file is having only xmlns="..." please help me ... Last edited by fpmurphy; 02-28-2013 at 08:53 AM.. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Please use code tags. Please post the output you are expecting from your sample input.
|
| Sponsored Links | ||
|
![]() |
| Tags |
| query result |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Data Extract from XML Log File | raghunsi | Shell Programming and Scripting | 9 | 08-27-2010 11:13 PM |
| Extract data from an XML file & write into a CSV file | ss_ss | Shell Programming and Scripting | 2 | 04-18-2010 09:21 PM |
| sed or awk to extract data from Xml file | yeclota | Shell Programming and Scripting | 1 | 03-12-2009 08:15 AM |
| Help with shell script to extract data from XML file | yajaykumar | Shell Programming and Scripting | 5 | 09-04-2008 12:28 AM |
| extract specific data from xml format file. | 60doses | Shell Programming and Scripting | 7 | 01-16-2008 02:26 AM |
|
|