February 1, 2010 at 3:59 am
any one have idea on how to Export data into xml file from sql server 2005 using SSIS
please provide me some samples if you have any
February 2, 2010 at 12:11 am
Check the following articles:
April 14, 2010 at 11:29 am
Is there a way to output the XML to a more readable format
April 26, 2010 at 4:40 pm
To make your XML more readable, use xlst to transform it. For more info try: http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog
April 27, 2010 at 3:43 pm
Thanks for the replay. Sorry I wasn't specific enough. What I want is xml to xml. Example the output from SQL is single row like this:
<?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited by XMLSpy® --><catalog><cd><title>Empire Burlesque</title><artist>Bob Dylan</artist><country>USA</country><company>Columbia</company><price>10.90</price><year>1985</year></cd></catalog>
How can I output it to this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
</catalog>
Any help is appreciated.
April 27, 2010 at 7:05 pm
Realize I must be getting old and the eyes wearing out..... what is the difference between the two xml fragments you've supplied? If it's purely formatting, that's extraneous to XML and makes no difference (other than to carbon-based readers).
If you want to see/view it formatted, simply save off the file and view it in Internet Explorer or even SQL Server Management Studio (CTRL-K-D will format the document).
Steve.
May 13, 2010 at 5:31 pm
Steve, I'm having a simular problem with exporting to an xml file using bcp. I'm sure you mean people when you reference "carbon-based readers" --- but if you can't look at the output using IE, how do you know that other programs would have a problem reading the single line out!
May 13, 2010 at 5:48 pm
Not sure I follow your train of thought... Yes, people like to read XML when it's formatted but there is no requirement for it to be formatted. Like i said in the earlier post, if you really really want to see it formatted, open the file in either IE or SSMS (then requires you to request SSMS to format the document).
Steve.
May 14, 2010 at 10:36 am
Steve, this is my first time usings bcp to create a XML file 🙂 I don't really care if I can read it, I just want to make sure the receiving application can read it. When I create the file I get a style sheet error when I try and view it using IE. What do I need to have in the file to insure any application can read it?
May 14, 2010 at 6:11 pm
Can you post the error? Without seeing that it's very hard to determine what might be missing/needed. If you could also post a small part of the bcp call/s you're making that may help also.
Out of interest, was SSMS able to open the file and format it?
Steve.
May 14, 2010 at 6:19 pm
Steve -- thanks for your help!
Yes - SSMS can format it using Ctrl K D
With IE I receive the following error:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Only one top level element is allowed in an XML document. Error processing resource 'file:///C:/temp/SampleXMLOutput.xml'. ...
<Job><Site>ADN</Site><JobId>025455</JobId><JobType>Print</JobType><WorkOrder>...
Thanks
Sena
May 15, 2010 at 2:28 am
Would you mind sharing a sample file that shows the problem you're stuck with?
May 15, 2010 at 9:21 am
Great idea Lutz, would likely help out.
While you're looking at posting that file, I think you'll find that the problem is that the xml generated is in the form of
NodeA_1
OtherNodes
CloseNodeA_1
NodeA_2
OtherNodes
CloseNodeA_2
.....
NodeA_n
OtherNodes
CloseNodeA_n
I would consider this an xml fragment verus a document. IE (and likely other apps) require the document layout, which for the same data example simply needs a root node, like...
RootNodeX
NodeA_1
OtherNodes
CloseNodeA_1
NodeA_2
OtherNodes
CloseNodeA_2
.....
NodeA_n
OtherNodes
CloseNodeA_n
CloseRootNodeX
To get this root node, you need to specify a value for the ROOT option/parameter in the FOR XML clause.
HTH,
Steve.
May 17, 2010 at 11:47 am
Steve -- thanks that was it! Needed the ROOT:-)
May 17, 2010 at 11:50 am
Lutz, thanks for your help -- You and Steve both were a great help!
Viewing 15 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic. Login to reply