How to parse xml file in variable-string?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to parse xml file in variable-string?
# 1  
Old 06-19-2012
How to parse xml file in variable-string?

In the wake of the post: how-parse-following-xml-file
Thank you for the very useful chakrapani response 302355585-post4 !

A close question.
How to pass a file to xmllint in variable?
For example, let it be:
Code:
NEARLY_FILE='<?xml version="1.0" encoding="iso-8859-1"?><html><set label="09/07/29" value="1241.90"/></html>'

Then I want to do something like this:
Code:
echo 'cat /html' | xmllint --shell $NEARLY_FILE

and get:
Code:
<html><set label="09/07/29" value="1241.90"/></html>

Thanks in advance!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse XML File.

HI Guys I have Below XML File : <xn:SubNetwork id="XYZ"> <xn:SubNetwork id="C01"> <xn:MeContext id="CO1"> <xn:ManagedElement id="1"> <un:RncFunction id="1"> <un:UtranCell id="NY431"> ... (2 Replies)
Discussion started by: pareshkp
2 Replies

2. UNIX for Dummies Questions & Answers

Parse xml file

HI Guys, Input .XML <xn:MeContext id="L0307"> <xn:ManagedElement id="1"> <xn:VsDataContainer id="1"> <xn:attributes> <xn:vsDataType>vsDataENodeBFunction</xn:vsDataType> ... (3 Replies)
Discussion started by: pareshkp
3 Replies

3. Shell Programming and Scripting

parse xml file

Hello all, Given the following extract from a xml file with multiple <JOB> .... </JOB> entries <JOB APPLICATION="APP" APR="0" AUG="0" AUTHOR="AUT" AUTOARCH="0" CMDLINE="/tmp/test1 %%var" CONFIRM="1" CREATION_DATE="20100430" CREATION_TIME="130739" ... (2 Replies)
Discussion started by: cabrao
2 Replies

4. Shell Programming and Scripting

How can I parse xml file?

How can I parse file containing xml ? I am sure that its best to use perl - but my perl is not very good - can someone help? Example below contents of file containing the xml - I basically want to parse the file and have each field contained in a variable.. ie. I want to store the account... (14 Replies)
Discussion started by: frustrated1
14 Replies

5. Shell Programming and Scripting

Parse String from a Variable

Hello, Is there a quick way to parse the values from a variable? The variable has the following sample input: TA= The values of the TA variable is not fixed/hardcoded Basically I need to get the IV_Test and PF_SAPP_FWK values. I created a script that first use sed to remove ,... (3 Replies)
Discussion started by: racbern
3 Replies

6. Shell Programming and Scripting

Parse a string in XML file using shell script

Hi! I'm just new here and don't know much about shell scripting. I just want to ask for help in creating a shell script that will parse a string or value of the status in the xml file. Please sample xml file below. Can you please help me create a simple script to get the value of status? Also it... (46 Replies)
Discussion started by: ayhanne
46 Replies

7. Shell Programming and Scripting

Parse String in XML file

Hello All, I am new to this and I need to parse an XML file. Here's the XML Input File: <Report version="1.2"> <summary fatals="0" testcases="1" expected_fails="0" unexpected_passes="0" warnings="9" tests="21" errors="0" fails="1" passes="20" /> <testresult... (4 Replies)
Discussion started by: racbern
4 Replies

8. Shell Programming and Scripting

Parse XML file

Hi, I need to parse the following XML data enclosed in <a> </a> XML tag using shell script. <X> ..... </X> <a> <b> <c>data1</c> <c>data2</c> </b> <d> <c>data3</c> </d> </a> <XX> ... </XX> (5 Replies)
Discussion started by: viki
5 Replies

9. Shell Programming and Scripting

parse a string variable

Hello all, need a little help. I have an input variable such as ARGV which equals something like /use/home/name/script/test.dat I need to be able to get just the "test.dat" (i.e. the file name) at the end of the directory and the directory can be anything and any length. To put it another... (3 Replies)
Discussion started by: methos
3 Replies

10. Shell Programming and Scripting

How to parse a XML file using PERL and XML::DOm

I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)
Discussion started by: girigopal
0 Replies
Login or Register to Ask a Question
GLIB-COMPILE-RESOU(1)						   User Commands					     GLIB-COMPILE-RESOU(1)

NAME
glib-compile-resources - GLib resource compiler SYNOPSIS
glib-compile-resources [OPTION...] {FILE} DESCRIPTION
glib-compile-resources reads the resource description from FILE and the files that it references and creates a binary resource bundle that is suitable for use with the GResource API. The resulting bundle is then written out as-is, or as C source for linking into an application. The XML resource files normally have the filename extension .gresource.xml. For a detailed description of the XML file format, see the GResource documentation. OPTIONS
-h, --help Print help and exit --target=TARGET Store the compiled resources in the file TARGET. If not specified a filename based on the FILE basename is used. --sourcedir=DIRECTORY The files referenced in FILE are loaded from this directory. If not specified, the current directory is used. --generate Write the output file in the format selected for by its filename extension: .c C source .h C header .gresource resource bundle --generate-source Instead of a writing the resource bundle in binary form create a C source file that contains the resource bundle. This can then be compiled into an application for easy access. --generate-header Generate a header file for use with C code generated by --generate-source. --generate-dependencies Prints the list of files that the resource bundle references to standard output. This can be used to track dependencies in the build system. For example, the following make rule would mark test.gresource as depending on all the files that test.gresource.xml includes, so that is is automatically rebuilt if any of them change: test.gresource: test.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies test.gresource.xml) Note that this may or may not be portable to non-GNU make. --c-name Specify the prefix used for the C identifiers in the code generated by --generate-source and --generate-header. --manual-register By default code generated by --generate-source uses automatic initialization of the resource. This works on most systems by using the compiler support for constructors. However, some (uncommon) compilers may not support this, you can then specify --manual-register, which will generate custom register and unregister functions that your code can manually call at initialization and uninitialization time. --internal By default code generated by --generate-source declares all initialization functions as extern. So they are exported unless this is prevented by a link script or other means. Since libraries usually want to use the functions only internally it can be more useful to declare them as G_GNUC_INTERNAL which is what --internal does. ENVIRONMENT
XMLLINT The full path to the xmllint executable. This is used to preprocess resources with the xml-stripblanks preprocessing option. If this environment variable is not set, xmllint is searched in the PATH. GDK_PIXBUF_PIXDATA The full path to the gdk-pixbuf-pixdata executable. This is used to preprocess resources with the to-pixdata preprocessing option. If this environment variable is not set, gdk-pixbuf-pixdata is searched in the PATH. GIO
GLIB-COMPILE-RESOU(1)