Sponsored Content
Top Forums Shell Programming and Scripting Read block of lines from xml file Post 302238872 by fpmurphy on Monday 22nd of September 2008 08:43:56 AM
Old 09-22-2008
A better way might be to use a XSLT processor with a XSL stylesheet containing the xsl-copy-of element as shown by the following example
Code:
$ cat demo.xml
<ROOT>
  <EXAMPLE>
     <DECLARATION>
        <DECLGROUP>
           <VALUE.OBJECT>
             <DEMO>demontrate xsl:copy-of</DEMO>
           </VALUE.OBJECT>
        </DECLGROUP>
     </DECLARATION>
  </EXAMPLE>
</ROOT>

Code:
$ cat demo.xsl
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:template match="/ROOT/EXAMPLE/DECLARATION">
   <xsl:copy-of select="." />
</xsl:template>

</xsl:stylesheet>

Code:
$ xslproc demo.xsl demo.xml

     <DECLARATION>
        <DECLGROUP>
           <VALUE.OBJECT>
             <DEMO>demontrate xsl:copy-of</DEMO>
           </VALUE.OBJECT>
        </DECLGROUP>
     </DECLARATION>

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read xml file

Iam new to shell script. How to read xmlfile using shellscript(without awk),and Store record by record in file . My xml file: <root> <header> <HeaderData1>header1</HeaderData1> <HeaderData2>header2</HeaderData2> </header> <detailsRecord> ... (2 Replies)
Discussion started by: ram2s2001
2 Replies

2. Shell Programming and Scripting

Read elements of a xml file??????

Hi, What is a good way to read elements of an xml file? i did try xmllint it doesnt provide a function to output values of a tree. In the below example when i specify from Family2 I need the name of the father then the output should be DAVE. Appreciate any help provided in this regards. Many... (6 Replies)
Discussion started by: ahmedwaseem2000
6 Replies

3. Shell Programming and Scripting

Read data in XML file

Hello Everybody, I have a question on reading the data from XML file through KSH shell script. In the below file I need to collect the patient control no and its respective insured id. I need to have pair of these values in single line separated by some special character, so that I could use... (2 Replies)
Discussion started by: swame_sp
2 Replies

4. Shell Programming and Scripting

read and write to xml file

hi i am quite new to shell scripting and need help in reading and writing in xml file i have an xml file with format: <main> <store> <name>ABC</name> <flag>0</flag> <size>123<size> </store> <store> <name>DEF</name> ... (2 Replies)
Discussion started by: kichu
2 Replies

5. Shell Programming and Scripting

script to read XML file

Dear All, I have one log file and it contains lot of XML as below. ... (1 Reply)
Discussion started by: murtujak
1 Replies

6. Shell Programming and Scripting

Help on awk to read xml file

Hello, I have a xml file as shown below. I want to parse the file and store data in variables. xml file looks like: <TEST NAME="DataBaseurl">jdbc:oracle:thin:@localhost:1521:ora10</TEST> <TEST NAME="Databaseuser">Pradeep</TEST> ...... and many other such lines i want to read this file and... (2 Replies)
Discussion started by: pradeepmacha
2 Replies

7. UNIX for Dummies Questions & Answers

When reading a csv file, counter to read 20 lines and wait for minute then read next 20 till end

Hello All, i am a newbie and need some help when reading a csv file in a bourne shell script. I want to read 10 lines, then wait for a minute and then do a reading of another 10 lines and so on in the same way. I want to do this till the end of file. Any inputs are appreciated ... (3 Replies)
Discussion started by: victor.s
3 Replies

8. Shell Programming and Scripting

Read file excluding XML in it

Hi , I have a file like below.I want all the content in a single line excluding the XML.How can i proceed? t=21 y=23 rg=xyz ..... <xmlstarts> . . <xmlends> lk=99 lo=09 (3 Replies)
Discussion started by: chetan.c
3 Replies

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

10. Red Hat

How to read an xml file through shell script?

Hey , can we read an xml file and make changes in it through shell script. Thanks (4 Replies)
Discussion started by: ramsavi
4 Replies
MEINPROC4(8)							 KDE User's Manual						      MEINPROC4(8)

NAME
meinproc4 - KDE translator for XML SYNOPSIS
meinproc4 [--help] [Generic-options] [Qt-options] [KDE-options] [--cache file] [--check] [--htdig] [--srcdir] [--param key=value] [[-o | --output] file] [--stdout] [--stylesheet xsl] docbook_file DESCRIPTION
meinproc4 converts DocBook files to HTML. GENERIC OPTIONS
--author Show author information. --help Show help about options. --help-all Show all options. --help-kde Show KDE specific options. --help-qt Show Qt specific options. --license Show license information. -v--version Show version information APPLICATION OPTIONS
--cache file Create a cache file for the document --check Check the document for validity The output can be a bit daunting, since one small mistake can cause a cascade of errors. The trick is to look at the first error, fix that error, save the file, and run meinproc4 again. --htdig Create a ht://dig compatible index -o, --output file Output whole document to file. --stdout Output whole document to stdout. --stylesheet xsl Stylesheet to use --srcdir dir Set the root directory to look for kdelibs --param key=value Set parameters to pass to the stylesheet. USAGE
The most common way to run meinproc4 is simply as meinproc4 docbook-file where docbook-file is usually index.docbook. This command creates HTML pages from the DocBook file. Note that these pages are only view- able in KDE-based browsers (like Konqueror). If you need to view the HTML output in another browser (for example, if you're placing it on line), use meinproc4 --stylesheet stylesheet-name docbook-file where stylesheet-name is the full path to one of the XSL stylesheets in $KDEDIR/share/apps/ksgmltools/customization. To produce output suitable for the web, you can use kde-web.xsl or kde-chunk-online.xsl. See the README file in that directory for more details. SEE ALSO
kdeoptions(7), qtoptions(7) BUGS
There are probably tons of bugs. Use bugs.kde.org: http://bugs.kde.org to report them. 2008-10-03 MEINPROC4(8)
All times are GMT -4. The time now is 01:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy