• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

List XML element attributes names

Advocate ,
Oct 20, 2017 Oct 20, 2017

Copy link to clipboard

Copied

Is there a way to retrieve all the attributes names of a XML element?

Say i have this xml:

var fruit= <Banana weight="158.3kg" length="2.03m" origin="Kepler-186f"/>;

fruit.children() and fruit.elements() do not list attributes.

fruit.attributes() only lists the values, not their names.

I would like to retrieve the attributes names, ie "weight", "length", "origin".

It's possible by parsing fruit.toXMLString(), but.. i'd rather not do that(!)

Any suggestion ?

Xavier

TOPICS
Scripting

Views

329

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation