XML File Generation - Template Help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers XML File Generation - Template Help
# 1  
Old 07-07-2014
Question XML File Generation - Template Help

Hi,

I have hit a bit of a brick wall.Smilie

need the following code edited:
Code:
echo "<?xml version=\"1.0\"?><dailyBalance_ROWSET>" > ${DataDir}/${extract_script}${ApplicationDate}.${Suffix}
RunSQL ${extract_script} ${ActionFlag} 
echo "</dailyBalance_ROWSET>" >> ${DataDir}/${extract_script}${ApplicationDate}.${Suffix}

So that the header of the XML file is:
Code:
<?xml version="1.0" encoding="UTF-8" ?><bk:PharosElectronicValue xsi:schemaLocation="Doveria.Pharos.ElectronicValue.xsd" xmlns:bk="Doveria.Pharos.ElectronicValue.xsd" xmlns:xsi="URL Goes Here">

and the trailer is:
Code:
</bk:PharosElectronicValue>

I am totally new to Unix and am unfamiliar with the syntax, my attempts to modify the code keep failing as I hit a nice syntax error.

The header and trailer allow for the SQL code I wrote to be displayed as desired.

Please advise if theres anything else required. PS I cannot provide any output examples as the information is confidential.

Thanks in advance! Smilie


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by Xergxes7; 07-07-2014 at 11:39 AM..
# 2  
Old 07-07-2014
Why not try to get a simplified version running which doesn't require any confidential data (or SQL queries for that matter) ie try modifying the following until it throws noe errors and then re-insert the call to your "RunSQL" function...
Code:
echo "<?xml version=\"1.0\"?><dailyBalance_ROWSET>" > ${DataDir}/${extract_script}${ApplicationDate}.${Suffix}
echo "<daily_balance>The daily balance results will be here</daily_balance>" >>${DataDir}/${extract_script}${ApplicationDate}.${Suffix}
echo "</dailyBalance_ROWSET>" >> ${DataDir}/${extract_script}${ApplicationDate}.${Suffix}

# 3  
Old 07-08-2014
Hey I figured it out:

Code:
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><bk:PharosElectronicValue xsi:schemaLocation=\"Doveria.Pharos.ElectronicValue.xsd\" xmlns:bk=\"Doveria.Pharos.ElectronicValue.xsd\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" > ${DataDir}/${extract_script}${ApplicationDate}.${Suffix}
      RunSQL ${extract_script} ${ActionFlag} 
      echo "</bk:PharosElectronicValue>" >> ${DataDir}/${extract_script}${ApplicationDate}.${Suffix}

The SQL bit i was hoping would be ignored but thanks for trying to help.

All I needed to do was set the language on Notepad++ to Shell and I could see the formatting properly xD Such a noob
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to pull multiple XML tags from the same XML file in Shell.?

I'm searching for the names of a TV show in the XML file I've attached at the end of this post. What I'm trying to do now is pull out/list the data from each of the <SeriesName> tags throughout the document. Currently, I'm only able to get data the first instance of that XML field using the... (9 Replies)
Discussion started by: hungryd
9 Replies

2. Shell Programming and Scripting

Splitting a single xml file into multiple xml files

Hi, I'm having a xml file with multiple xml header. so i want to split the file into multiple files. Sample.xml consists multiple headers so how can we split these multiple headers into multiple files in unix. eg : <?xml version="1.0" encoding="UTF-8"?> <ml:individual... (3 Replies)
Discussion started by: Narendra921631
3 Replies

3. Shell Programming and Scripting

Split xml file into multiple xml based on letterID

Hi All, We need to split a large xml into multiple valid xml with same header(2lines) and footer(last line) for N number of letterId. In the example below we have first 2 lines as header and last line as footer.(They need to be in each split xml file) Header: <?xml version="1.0"... (5 Replies)
Discussion started by: vx04
5 Replies

4. Shell Programming and Scripting

Inputing info from a CSV file and filling a template file

Hi, I have a .csv file that contains a variety of fields for 60 clients: USERNAME, PASSWORD, and COMMENTS. I have a template file which contains a great deal of data for each client and has the fields USERNAME, PASSWORD, and COMMENTS that has to be filled with the values of USERNAME,... (1 Reply)
Discussion started by: mojoman
1 Replies

5. Shell Programming and Scripting

Comparing delta values of one xml file in other xml file

Hi All, I have two xml files. One is having below input <NameValuePair> <name>Daemon</name> <value>tcp:7474</value> </NameValuePair> <NameValuePair> <name>Network</name> <value></value> </NameValuePair> ... (2 Replies)
Discussion started by: sharsour
2 Replies

6. Shell Programming and Scripting

Creating a larger .xml file from a template(sample file)

Dear All, I have a template xml file like below. ....Some---Header....... <SignalPreference> ... <SignalName>STRING</SignalName> ... </SignalPreference> ......Some formatting text....... <SignalPreference> ......... ... (3 Replies)
Discussion started by: ks_reddy
3 Replies

7. Shell Programming and Scripting

Help required in Splitting a xml file into multiple and appending it in another .xml file

HI All, I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz. eg: <?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies

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

9. Shell Programming and Scripting

xmlstarlet template parse small xml file

I have a file like: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <geonames> <geoname> <toponymName>Palos Verdes</toponymName> <name>Palos Verdes</name> <lat>42.1628912</lat> <lng>-123.6481235</lng> <geonameId>5718340</geonameId> <countryCode>US</countryCode>... (4 Replies)
Discussion started by: unclecameron
4 Replies

10. 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
Login or Register to Ask a Question