'Exporting Xml data from oracle database in csv file and reading in shell script
I have a requirement to extract XML data in CSV format from the oracle database and then read the data in a shell script.
Here is my query:
select routeset_name as routeset_name,
Trim(Replace(a.XML_MSG.getStringVal(),' ','')) as xml_msg
from ums_lrt_staging_routeset_xml_msg a
Here is my shell script
while IFS="," read -r ROUTESET_NAME XML_MSG
do
echo "ROUTESET_NAME: $ROUTESET_NAME"
echo "XML_MSG: $XML_MSG"
echo ""
done < <(tail RouteSets.csv)
but it is not working as expected. This is how Routeset file contents looks like after export:
ROUTESET_NAME,XML_MSG
test,<?xml version="1.0" standalone='yes'?>
<localRoutes>
<route>
<user type="string">100</user>
<next type="regex">100</next>
</route>
<emsVersion>
<version>1</version>
</emsVersion>
</localRoutes>
and this is the output I am getting:
ROUTESET_NAME: XML_MSG
XML_MSG:
ROUTESET_NAME: "<pre><?xml version=""1.0"" standalone='yes'?>"
XML_MSG:
ROUTESET_NAME:
XML_MSG:
ROUTESET_NAME:
XML_MSG:
ROUTESET_NAME:
XML_MSG:
ROUTESET_NAME:
XML_MSG:
ROUTESET_NAME:
XML_MSG:
My expected should be:
ROUTESET_NAME: test
XML_MSG:<?xml version="1.0" standalone='yes'?><localRoutes><route><user type="string">100</user><next type="regex">100</next></route><emsVersion><version>1</version></emsVersion></localRoutes>
Here is what I have tried:
- Tried getStringValue method to convert XML to String but didn't work.
- Tried the Trim method thinking leading or trailing spaces might be an issue but didn't work.
- Tried Replace method thinking spaces between tags might be the issue but didn't work
please help me or guide me where I am going wrong
Solution 1:[1]
You can use this code to show progress bar when using Asynctask
https://www.concretepage.com/android/android-asynctask-example-with-progress-bar
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | JAY_Panchal |
