Sworup Shakya
Sworup Shakya

Reputation: 1348

Deleting XMLList data, after certain element

Basically, since XMLList are similar to Arrays in many ways, I was wondering if I could do something like:

XMLList.length = 10;

I know this is not possible because 'length' in XMLList is not a property but is a method. Hence is something like a get method without a set method. Only XMLList.length() would work.

But is there a workaround. An easier one.

I know this can be done with loops or by converting the XMLList to Array, cutting off and converting it back to XMLList. I'd like to know if there's an easier way.

Upvotes: 1

Views: 555

Answers (1)

alxx
alxx

Reputation: 9897

while (xmlList.length() > 10)
{
    delete(xmlList[10]);
}

Upvotes: 3

Related Questions