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 5968461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:05:36+00:00 2026-05-22T20:05:36+00:00

I have this XML structure: <numb> <variable> <name>john</name> <age>12</age> </variable> <variable> <name>janet</name> <age>10</age> </variable>

  • 0

I have this XML structure:

<numb>
  <variable>
   <name>john</name>
   <age>12</age>
 </variable>
 <variable>
   <name>janet</name>
   <age>10</age>
 </variable>
 <variable>
   <name>johanna</name>
   <age>22</age>
 </variable>
 <variable>
  <name>harry</name>
  <age>24</age>
 </variable>
</numb>

If I try to delete the variable with name johanna I do this:

  delete numb.variable.(name=="johanna);

but then, I get this error:

 "Error #1119: Delete operator is not supported with operand of type XMLList"

suggesting the numb.variable.(name==”johanna”) is an XMLList ..but then I tried this:

delete XML(numb.variable.(numb=="johanna"); 

but that didn’t delete anything..

Anyone knows how I could delete a certain variable in the numb XML?

  • 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-22T20:05:37+00:00Added an answer on May 22, 2026 at 8:05 pm

    You can retrieve the child nodes that have a different name from johanna and set those as the children nodes, using the setChildren() method.

    e.g.

    var xml:XML = <numb>
      <variable>
       <name>john</name>
       <age>12</age>
     </variable>
     <variable>
       <name>janet</name>
       <age>10</age>
     </variable>
     <variable>
       <name>johanna</name>
       <age>22</age>
     </variable>
     <variable>
      <name>harry</name>
      <age>24</age>
     </variable>
    </numb>
    
    xml.setChildren(xml.variable.(name != 'johanna'));
    trace(xml);
    /*
    Outputs:
    <numb>
      <variable>
        <name>john</name>
        <age>12</age>
      </variable>
      <variable>
        <name>janet</name>
        <age>10</age>
      </variable>
      <variable>
        <name>harry</name>
        <age>24</age>
      </variable>
    </numb>
    */
    

    Another option is to loop through each node that satisfies the condition and delete the corresponding node through array access notation using the childIndex() method:

    short version:

    for each (var match:XML in xml.variable.(name == 'johanna')) delete xml.variable[match.childIndex()];
    

    longer version:

    var xml:XML = <numb>
      <variable>
       <name>john</name>
       <age>12</age>
     </variable>
     <variable>
       <name>janet</name>
       <age>10</age>
     </variable>
     <variable>
       <name>johanna</name>
       <age>22</age>
     </variable>
     <variable>
      <name>harry</name>
      <age>24</age>
     </variable>
    </numb>;
    
    var matches:XMLList = xml.variable.(name == 'johanna');
    for each (var match:XML in matches) delete xml.variable[match.childIndex()];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have xml structure like this: <Group id=2 name=Third parentid=0 /> <Group id=6 name=Five
I have a XML Structure that looks like this. <sales> <item name=Games sku=MIC28306200 iCat=28
So i have this XML structure: <fields> <field name=agent_description label=Agent Description size=area /> <field
Here I had very similar xml structure, but now I have this: <Fields> <Company>My
I have an XML structure like the following <root> <person> <name>James</name> <description xsi:type=me:age>12</description> <description
Say I have this XML variable: declare @xml xml='< Employee EmployeeId=1 FirstName=John LastName=Smith />
I have a directory structure that looks like this: /a/f.xml /b/f.xml /c/f.xml /d/f.xml What
I have this XML in a column in my table: <keywords> <keyword name=First Name
I have a XML with a structure similar to this: <category> <subCategoryList> <category> </category>
I have an XML doc with a structure like this: <Book> <Title title=Door Three/>

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.