[thelist] Count XML Nodes

Vlad Alexander (XStandard) vlad.alexander at xstandard.com
Mon Dec 20 20:11:00 CST 2004


Hi Matt,

This should work with most DOM XML parsers:

objDoc.selectNodes("/TESTIMONIALS/TESTIMONY").length

Regards,
-Vlad
http://xstandard.com
Standards-compliant XHTML WYSIWYG editor



----- Original Message ----- 
From: "Matt Warden" <mwarden at gmail.com>
To: <thelist at lists.evolt.org>
Sent: Monday, December 20, 2004 8:40 PM
Subject: Re: [thelist] Count XML Nodes


> On Tue, 21 Dec 2004 01:39:31 -0000, Jamie Lewis <emaillists at eyota.net> 
> wrote:
>> Anyone know how i can count how many xml nodes are in a document?
>>
>> XML looks like:
>>
>> <TESTIMONIALS>
>>         <TESTIMONY>
>>                 ....more child nodes ...
>>         </TESTIMONY>
>>         <TESTIMONY>
>>                 ....more child nodes ...
>>         </TESTIMONY>
>>         <TESTIMONY>
>>                 ....more child nodes ...
>>         </TESTIMONY>
>> </TESTIMONIALS>
>>
>> And i want to count the number of TESTIMONIALS\TESTIMONY
>
>
> We would need to know what language and/or parser you are using. XSL?
> PHP? Javascript?
>
> For example, XSL would be something liek this:
>
> <xsl:number value="count(testimony)"/>
>
>
>
> -- 
> Matt Warden
> Miami University
> Oxford, OH
> http://mattwarden.com
>
>
> This email proudly and graciously contributes to entropy.
> -- 
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
> 




More information about the thelist mailing list