Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Use variables to get unique nodes

From: KemperR@--.---.-- (---- ------)
To: NULL
Date: 10/2/2004 1:53:00 AM
Hi Jürgen,

thank you for zour feedback.
Let me explain it once again, because my text was a bit weak.
What I need is a list of pins which occour more than once.
As a small hurdle I have to do some preselection by some other
properties before. Therefore the TestNodes.

So, the output should be the opposit of yours.

I have not tried the code provided by Marrow yet, but it explains
somehow what I have done wrong.

However, can you drop me some lines on xmlgawk ?
Can I use this within MSXML4 processor ?
How about schema check ?

As you stated, YES , the example is like counting some beans, but just
for the sake of demonstration. It addresses a very tiny problem of an
5M mixed data set. So my real world is a farm of beans , fruits ,
nuts, vegitables and many other things.
Myself is just creating different dishes out of it. XLST in
combination with XPATH is a great help, as I have to present the same
dish in differrent restaurants (HTML , Text , Exel , Spice ) too.
Finally, just for your valid comment and interest, we do a lot of PERL
scripting usually.

Thanks a lot
Rolf


Jürgen Kahrs <Juergen.KahrsDELETETHIS@v...> wrote in message news:<2s5ko5F1h3sv8U1@u...>...
> Rolf Kemper wrote:
> 
> > What I wnat to do is to get a set of distinct nodes.
> 
> What is "distinct" ? Unique within one TEST node ?
> Or Unique within one Root node ?
> 
> I wrote a short xmlgawk script, which tries to
> reproduce your results. The script even looks
> readable to me. Half of it consists of printing
> test results:
> 
> # distinct_nodes.awk
> # comp.text.xml 2004-10-01
> # Read all nodes of type pin and find the ones
> # which have a unique name attribute.
> # JK 2004-10-01
> 
> BEGIN {
>   XMLMODE=1
>   print "all pins of all test nodes ==>"
> }
> 
> XMLSTARTELEM == "Pin" {
>   count[XMLATTR["PinName"]] ++
>   print XMLATTR["PinName"]
> }
> 
> END {
>   print "multiple pins  ==>"
>   for (PinName in count) {
>     if (count[PinName] > 1)
>       print PinName, count[PinName]
>   }
>   print "unique pins ==>"
>   for (PinName in count) {
>     if (count[PinName] == 1)
>       print PinName, count[PinName]
>   }
> }
> 
> 
> > all pins of all test nodes ==> OK 
> > A
> > B
> > B
> > C
> > X
> > A
> > D
> > C
> > X
> > A
> > 
> > multiple pins  ==> OK 
> > B
> > A
> > C
> > X
> > A
> > 
> > unique pins ==> NOT GOOD !! 
> > B
> > A
> > C
> > X
> > A
> 
> The results I get are:
> all pins of all test nodes ==>
> A
> B
> B
> C
> X
> A
> D
> C
> X
> A
> multiple pins  ==>
> A 3
> B 2
> C 2
> X 2
> unique pins ==>
> D 1
> 
> > ( I expected B A C X )
> > #################### End #################################
> 
> Why do you expect B A C X ?
> No matter how I understand "distinct", I would not
> call B A C X "distinct" pins.
> 
> 
> BTW: Do the Electrical Engineers at NEC really use XML
> for counting their beans .. errhhh pins .. ?


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent