Hey there,
I used the FOR XML PATH feature but the XML result is in only one line,
it does not conserve the XML structure (treeview). When I open the XML
file with IE, it s working very (I have the XML hierarchy) but when I
use Visual Studio or other tool to edit it, I ve just one line!
For example:
<children group=""><child firstname="" lastname=""></child>=""><child
firstname=""
lastname=""></child>.......................</children>.........
And I d like to have
<children group="">
<child firstname="" lastname=""></child>="">
<child firstname="" lastname=""></child>
.......................
</children>
...........
To give you an example of the query:
SELECT Child.group AS '@.group',
(SELECT firstname AS '@.firstname',
lastname AS '@.lastname'
FROM Collecte_Data_Extract cde
FOR XML PATH('child'), TYPE)
FROM Feed AS Child
FOR XML PATH('children'), TYPE
Any idea?
Many thanks in advance
The structure is "conserved"; the whitespace is not. Actually what's
happening is IE is adding whitespace (linefeeds and tabs) to display your
XML. If you want to format your XML in Visual Studio, create a new XML
file, copy and paste your XML into it, and select Edit > Advanced > Format
from the main menu. The extra linefeeds and tabs are irrelevant to your XML
parser (or at least should be).
"Vins" <vbellet@.gmail.com> wrote in message
news:1165406662.637039.25890@.f1g2000cwa.googlegrou ps.com...
> Hey there,
> I used the FOR XML PATH feature but the XML result is in only one line,
> it does not conserve the XML structure (treeview). When I open the XML
> file with IE, it s working very (I have the XML hierarchy) but when I
> use Visual Studio or other tool to edit it, I ve just one line!
>
> For example:
> <children group=""><child firstname="" lastname=""></child>=""><child
> firstname=""
> lastname=""></child>.......................</children>.........
>
> And I d like to have
> <children group="">
> <child firstname="" lastname=""></child>="">
> <child firstname="" lastname=""></child>
> .......................
> </children>
> ..........
>
> To give you an example of the query:
>
> SELECT Child.group AS '@.group',
>
> (SELECT firstname AS '@.firstname',
> lastname AS '@.lastname'
>
> FROM Collecte_Data_Extract cde
>
> FOR XML PATH('child'), TYPE)
>
> FROM Feed AS Child
> FOR XML PATH('children'), TYPE
>
> Any idea?
> Many thanks in advance
>
|||In fact the idea is to have the result dynamically.
For example if I choose to open this XML file in NotePad it does work
|||"Vins" <vbellet@.gmail.com> wrote in message
news:1165833640.839620.293150@.16g2000cwy.googlegro ups.com...
> In fact the idea is to have the result dynamically.
> For example if I choose to open this XML file in NotePad it does work
Huh?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment