formatting xml output

  • Hi,

    i have a script that resolve's data into xml like this, ex:

    <root>

    <title>A</title>

    <id>1</id>

    <nodes>

    <node>

    <id>2</id>

    <title>A.1</title>

    </node>

    </nodes>

    </root>

    and works perfectly, but ... how to make sure every item has an element "nodes" ? The case here is for the child leafs obviously. This, because on the client i have to inject this element "nodes" on a json version of this xml, and just wanted to avoid normalizing the structure on the client.

    for the root i am using

    FOR XML PATH('root'),TYPE; and for the hierarchy that follows

    FOR XML RAW ('node'), root('nodes'), ELEMENTS

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply