Hi,
I have the following code:
declare @.xmlin xml
select @.xmlin = '<?xml version="1.0" ?>
<pof version="5.0.3.2">
<fcRole id="1000000692">
<Name>
<string>Underwriter</string>
</Name>
<Description>
<string>This role is responsible for determining the
acceptability of insurance risks; the Underwriter selects risks for
insurance and determines in what amounts and on what terms the
insurance company will accept the risks.</string>
</Description>
</fcRole>
<fcAvailability id="1000005163">
<Start>
<objref id="1000000692">
</objref>
</Start>
<End>
<objref id="1000001425">
</objref>
</End>
</fcAvailability>
<fcActivity id="1000000601">
<ComplexityFactor>
<int>0</int>
</ComplexityFactor>
<PoliticalFactor>
<int>0</int>
</PoliticalFactor>
<SizeFactor>
<int>0</int>
</SizeFactor>
<UnificationFactor>
<int>0</int>
</UnificationFactor>
<InQueueDynamics>
<int>33554431</int>
</InQueueDynamics>
<OutQueueDynamics>
<int>33554431</int>
</OutQueueDynamics>
</fcActivity>
</pof>'
I want to display all the node names and datatypes (if present) in
these nodes using XQuery.
The output should be
fcRole<Null>
Name<Null>
string<Null>
Description<Null>
fcAvailability<Null>
Start<Null>
ObjRef<Null>
End<Null>
ObjRef<Null>
fcActivity <Null>
ComplexityFactor <Null>
PoliticalFactor<Null>
SizeFactor <Null>
UnificationFactor <Null>
InQueueDynamics<Null>
OutQueueDynamics <Null>
Please help.
Regards,
Shilpa
Hello Shilpa,
Here's a start on it at least...
select t.c.query('local-name(.)'),t.c.value('(.)[1]','varchar(255)')
from @.xmlin.nodes('//*') as t(c)
Thank you,
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/
No comments:
Post a Comment