Page 1 of 1

General XML format Carriage Return Line Feed CRLF

Posted: Tue Apr 15, 2008 5:02 am
by Nisusmage
I couldn't find any posts regarding this issue of the XML format coming out of the XML output stage.

The XML format I'm expecting is:

Code: Select all

<DEDUCTIONS>
      <DEDUCTION>
        <SURNAME>MCDONALD</SURNAME>
        <NAME>OLD</NAME>
      </DEDUCTION>
      <DEDUCTION>
        <SURNAME>MCDONALD</SURNAME>
        <NAME>NEW</NAME>
      </DEDUCTION>
</DEDUCTIONS>
Instead I'm getting:

Code: Select all

<DEDUCTIONS>
      <DEDUCTION>
        <SURNAME>
MCDONALD
        </SURNAME>
        <NAME>
OLD
        </NAME>
      </DEDUCTION>
      <DEDUCTION>
        <SURNAME>
MCDONALD
        </SURNAME>
        <NAME>
NEW
        </NAME>
      </DEDUCTION>
</DEDUCTIONS>
Has anyone figured out how to change the format of the XML Output stage to follow these rules?

Thanks in advance.

Posted: Tue Apr 15, 2008 6:17 am
by chulett
Why do you think you need that format? Parsers don't care, only people do. You have two choices with the stage: unformatted (aka 'one long line') or formatted as you've shown you are getting. We stick with unformatted out of the gate and only 'pretty' it when people need to look at it.

For that, you'll either need a command line 'pretty print' tool (which is what the output you are expecting is called) or you'll need to roll your own. Or just let something like XML Spy pretty the one-offs for you.

Posted: Tue Apr 15, 2008 6:48 am
by Nisusmage
Good Point ..

I was trying to format it for the human eye.

thanks for the input.

Posted: Tue Apr 15, 2008 7:19 am
by eostic
....or just exclusively open it via IE for human consumption. It's nearly always "pretty" there because it parses it correctly.

Ernie

Posted: Tue Apr 15, 2008 7:34 am
by chulett
Good Point .. :wink:

Any idea what kind of file sizes IE can handle?

Posted: Tue Apr 15, 2008 8:40 am
by Nisusmage
I changed the format to unformatted in datastage and used MS Visual Studio to reformat it.

Code: Select all

Edit -> Advanced -> Format Document. Save. 
Worked wonders. IE is very slow rendering XML. And I needed it in a clean format quickly for me to see that what I was getting was correct. I found VS 2005 much faster to open and reformat.

G

Posted: Tue Apr 15, 2008 3:14 pm
by ray.wurlod
:idea:
If you can figure out how to do that from a command line, you can fire up that command as an after-stage or after-job subroutine.