Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > I want to select all the node names beneath a given node

Reply
Thread Tools

I want to select all the node names beneath a given node

 
 
thecolour
Guest
Posts: n/a
 
      06-26-2007
Dear all

I have a diffgram:

<?xml version="1.0" standalone="yes"?>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-comml-msdata"
xmlns:diffgr="urn:schemas-microsoft-comml-diffgram-v1">
<NewDataSet>
<PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0"
diffgr:hasChanges="modified">
<PolicyID>POL0001</PolicyID>
<InsuredName>Insured Co 111</InsuredName>
<InceptDate>2007-01-01T00:00:00+00:00</InceptDate>
<BrokerCode>BKR1</BrokerCode>
<UW>U1</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1000001.00</LimitAmt>
<SharePctg>0.10</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1"
diffgr:hasChanges="modified">
<PolicyID>POL00010</PolicyID>
<InsuredName>Insured Co 10</InsuredName>
<InceptDate>2007-01-15T00:00:00+00:00</InceptDate>
<BrokerCode>BKR10</BrokerCode>
<UW>U10</UW>
<LimitCCY>USD</LimitCCY>
<LimitAmt>1000010.00</LimitAmt>
<SharePctg>1.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards4" msdata:rowOrder="3"
diffgr:hasChanges="inserted">
<PolicyID>POL100040</PolicyID>
<InsuredName>Insured Co 100040</InsuredName>
<InceptDate>2281-05-19T14:44:29.63+01:00</InceptDate>
<BrokerCode>BKR 100040</BrokerCode>
<UW>UW 100040</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1100040.00</LimitAmt>
<SharePctg>11.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
</NewDataSet>
<diffgr:before>
<PolicyInwards diffgr:id="PolicyInwards1" msdata:rowOrder="0">
<PolicyID>POL0001</PolicyID>
<InsuredName>Insured Co 1</InsuredName>
<InceptDate>2007-01-01T00:00:00+00:00</InceptDate>
<BrokerCode>BKR1</BrokerCode>
<UW>U1</UW>
<LimitCCY>GBP</LimitCCY>
<LimitAmt>1000001.00</LimitAmt>
<SharePctg>0.10</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards2" msdata:rowOrder="1">
<PolicyID>POL00010</PolicyID>
<InsuredName>Insured Co 10</InsuredName>
<InceptDate>2007-01-02T00:00:00+00:00</InceptDate>
<BrokerCode>BKR10</BrokerCode>
<UW>U10</UW>
<LimitCCY>USD</LimitCCY>
<LimitAmt>1000010.00</LimitAmt>
<SharePctg>1.00</SharePctg>
<Status>L</Status>
</PolicyInwards>
<PolicyInwards diffgr:id="PolicyInwards3" msdata:rowOrder="2">
<PolicyID>POL00019</PolicyID>
<InsuredName>Insured Co 19</InsuredName>
<InceptDate>2007-01-19T00:00:00+00:00</InceptDate>
<BrokerCode>BKR19</BrokerCode>
<UW>U19</UW>
<LimitCCY>EUR</LimitCCY>
<LimitAmt>1000019.00</LimitAmt>
<SharePctg>1.90</SharePctg>
<Status>L</Status>
</PolicyInwards>
</diffgr:before>
</diffgr:diffgram>

and I am trying to select all the child node names out of each
<PolicyInwards> node. Ideally I want to programatically compare the
values entered in the child nodes across different <PolicyInwards>
nodes, without having to hard code the node names themselves.

Eg I want to compare the values in elements <InsuredName>,
<InceptDate>, etc under /diffgr:diffgram/NewDataSet/
PolicyInwards[diffgr:id='PolicyInwards2'] with the same element values
under /diffgr:diffgram/Diffgr:before/
PolicyInwards[diffgr:id='PolicyInwards2'], extract the element name,
and the values of each under NewDataSet and Diffgr:before for each
element

The best I have come up with so far is

declare namespace diffgr = "urn:schemas-microsoft-comml-diffgram-
v1";

declare namespace diffgr = "urn:schemas-microsoft-comml-diffgram-
v1";

<ReconResults>


{
(:this sections gets all the differences between rows present in
both datasets
for $PolicyInwardsDifference in /diffgr:diffgram/NewDataSet/
PolicyInwards
return
if( $PolicyInwardsDifference/@diffgr:hasChanges[text() =
'modified'] )
then
<Difference>
<PKValue>
{$PolicyInwardsDifference/PolicyID/text()}
</PKValue>

<Column>
<ColumnName></ColumnName>
<ValueSource></ValueSource>
<ValueTarget></ValueTarget>
</Column>

</Difference>
else ()
}

</ReconResults>

I am happy to clarify if someone out there would be so kind as to help
me out.

Many thanks
Tom

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to select all the node names beneath a given node thecolour XML 2 06-27-2007 10:46 AM
generate all possible strings of given length given a set of characters chiara C Programming 6 10-06-2005 01:43 AM
Removing all text nodes from a given node Narokman Java 0 01-04-2005 09:23 PM
implement "select all" button to select all checkboxes Matt ASP General 2 01-11-2004 01:08 PM
XSL rules applying to XSD (XML schema) defined type names (as opposed to node names) Lewis G. Pringle, Jr. XML 0 09-30-2003 10:34 PM



Advertisments