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

  • Home
  • SEARCH
  • 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 7797337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:39:09+00:00 2026-06-01T23:39:09+00:00

I managed to sendIQ and get the response from openfire server. Now I can’t

  • 0

I managed to sendIQ and get the response from openfire server.

Now I can’t traverse the response for my purposes:

There is a “find” method to search for nodes like “list”, “other1”, but I need to traverse all the types of nodes containing in the “list”. IQ-response looks like the following:

 <iq type="get" id="sid_225">
   <list xmlns="urn:xmpp:archive" end="2012-04-30T22:00:00Z" start="2012-03-31T22:00:00Z">
     <set xmlns="http://jabber.org/protocol/rsm">
      <max>30</max>
     </set>
     <other1> asdf </other1>
     <othern> aasdf </othern>
   </list>
</iq> 

I need all the node types of the “list”. I got so far:

$(iq).find("list").children().each(function () {
  alert($(this).text());
}

But this gives me the text like “asdf” from the different types of nodes like “other1” and “othern”. How can I get the types of the nodes (i.e. “set”, “other1”) ? I also tried $(this).val()) but it doesn’t work either.

Please help….

Thanks!

  • 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-06-01T23:39:11+00:00Added an answer on June 1, 2026 at 11:39 pm

    You can get the nodeName of each element inside your loop:

    $(iq).find("list").children().each(function () {
      alert(this.nodeName + ' = ' + $(this).text());
    });
    

    You can access these variables inside the loop like above for each index in the array/object.

    Here is a demo: http://jsfiddle.net/7AKL6/2/

    Documentation for .each(): http://api.jquery.com/each/

    Documentation for Node.nodeName: https://developer.mozilla.org/en/Document_Object_Model_(DOM)/Node.nodeName

    Also note that your XML example has an error in it:

    <other1> asdf </other>
    

    should be:

    <other1> asdf </other1>
    

    to properly close itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I managed to get some help from a previous question and I have the
I managed to get a checkboxlist working, and I can't somehow get the values
managed to get my xsl working at http://www.xmlper.com/ (great tool good recommendation from other
I managed to get a really long command in my command history. Is there
I managed to request the publish_actions permission, but since it is revocable from the
I managed to get the YUI calendar widget working fine. But When it displays
I managed to build ffmpeg and libx264 on my Ubuntu 11.10 machine from source.
I managed to get the access token for google's contacts API but when i
I managed to developp a storyboard to translate an object from its initial position
I managed to install django-social-auth, but I am missing the moment where I can

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.