Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:21:11+00:00 2026-05-30T12:21:11+00:00

i have an XML like var test:XML = new XML( <record id=5 name=AccountTransactions <field

  • 0

i have an XML like

var test:XML = new XML( <record id="5" name="AccountTransactions"
    <field id="34" type="Nuber"/>
    </record>);

i want to remove all the attributes other than id and type in all nodes of XML. by this code i am unable to do this. can you suggest better solution, other than loops.

var atts:XMLListCollection = new XMLListCollection(test.descendants().attributes().((localName() != "id") && (localName() != "type")));
atts.removeAll(); trace(test)

it still show all attributes :/

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:21:13+00:00Added an answer on May 30, 2026 at 12:21 pm
        var test:XML = new XML( '<record id="5" name="AccountTransactions"><field id="34" type="Nuber" score="ded"/><field id="35" type="Nuber" score="sc"/></record>');
        var attributes:XMLList = test.field.@*;
        var length:int = attributes.length();
        for (var i:int = 0; i < length; i++) {
            (attributes[i].localName() != "id" && attributes[i].localName() != "type") ? [delete attributes[i], length--] : void;
        }
        trace(test);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some xml like this: <Data> <Rows> <Row> <Field Name=title>Mr</Field> <Field Name=surname>Doe</Field> <Row>
I have xml like this: <configurationData> <path name='b'> <path name='a'> <setting name='s1'> ![CDATA[XXXX]] </setting>
I have xml structure like this: <Group id=2 name=Third parentid=0 /> <Group id=6 name=Five
I have an xml like the following <DataCollection> <Data> <Name>John</Name> <Age>30</Age> </Data> ... more
I have a xml document that has a record set like this. <document> <row>
I have several XDocuments that look like: <Test> <element location=.\jnk.txt status=(modified)/> <element location=.\jnk.xml status=(overload)/>
i have the following xml file <?xml version=1.0 encoding=utf-8?> <Users> <User> <Name>John Smith</Name> <test>
I have a file test.xml that I want to POST up to a URL
I have XML like, <items> <item> <products> <product>laptop</product> <product>charger</product> <product>Cam</product> </products> </item> <item> <products>
If I have XML like: <foo> <bar id=1 score=192 /> <bar id=2 score=227 />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.