The XML output when opened in a notepad has new line charactes in between the open and close tags as below.
<?xml version="1.0" encoding="UTF-8"?>
<customers xmlns="http://www.cust.org/Customers" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<customer id="0">
<name>
Porsche
</name>
<order number="1">
<product_code>
1
</product_code>
<quantity>
10
</quantity>
<unit_price>
10000
</unit_price>
</order>
</customer>
</customers>
I like the output to be as below - data in the same line as open and close tags.
<?xml version="1.0" encoding="UTF-8"?>
<customers xmlns="http://www.cust.org/Customers" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<customer id="0">
<name> Porsche</name>
<order number="1">
<product_code>1</product_code>
<quantity>10</quantity>
<unit_price>1000</unit_price>
</order>
</customer>
</customers>
XML Output format help
Moderators: chulett, rschirm, roy
Code: Select all
sed -e "/<name>/{N;N;/<\/name>/s/\n//g;}" -e "/<product_code>/{N;N;/<\/product_code>/s/\n//g;}" -e "/<quantity>/{N;N;/<\/quantity>/s/\n//g;}" -e "/<unit_price>/{N;N;/<\/unit_price>/s/\n//g;}" file
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 26
- Joined: Wed Mar 17, 2010 11:05 am
Is it possible to acheive it with in Datastage XML output stage?
anbu wrote:Code: Select all
sed -e "/<name>/{N;N;/<\/name>/s/\n//g;}" -e "/<product_code>/{N;N;/<\/product_code>/s/\n//g;}" -e "/<quantity>/{N;N;/<\/quantity>/s/\n//g;}" -e "/<unit_price>/{N;N;/<\/unit_price>/s/\n//g;}" file
ReachSam
No. You've seen what DataStage considers "formatted" output and if that's not what you want you should not enable that option. Keep in mind that formatting like that is only for peoples and no XML reader will care or need any formatting, so most applications don't bother with it.
If somehow you think you really "need" that formatted or "pretty printed" output, that will need to be a separate step done post-generation outside of DataStage using 3rd party utilities.
If somehow you think you really "need" that formatted or "pretty printed" output, that will need to be a separate step done post-generation outside of DataStage using 3rd party utilities.
Last edited by chulett on Fri Apr 30, 2010 7:25 am, edited 1 time in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
...it wastes space. Open the document with a tool that understands XML. Generate formatted output ought to be removed or at least not be the default.
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>