prain
asked on
XML Attribute Question
I have a xml file like this...
<?xml version="1.0" encoding="utf-8" ?>
<PartialRates>
<partialRates rate1="18 cents" rate2="16 cents" rate3="8 cents" rate4="9 cents" rate5="10 cents"></partialRates>
</PartialRates>
Is there a DOM function to get the number of elements in the attribute "partialRates" ?
What I need is ... there are 5 rates in the above line. I want a javascript function to return
5.
<?xml version="1.0" encoding="utf-8" ?>
<PartialRates>
<partialRates rate1="18 cents" rate2="16 cents" rate3="8 cents" rate4="9 cents" rate5="10 cents"></partialRates>
</PartialRates>
Is there a DOM function to get the number of elements in the attribute "partialRates" ?
What I need is ... there are 5 rates in the above line. I want a javascript function to return
5.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. Great!.
// get the tag - iif you add a class or id you could get a specific tag
// this gets the first one matched.
var rates = document.getElementsByTagN
var length = rates.attributes.length; // this returns 5