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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:58:28+00:00 2026-05-25T05:58:28+00:00

I want to parse the following xml which is the response from an restful

  • 0

I want to parse the following xml which is the response from an restful webservice:

<ns2:list xmlns="urn:foo1:foo" xmlns:ns2="foo2:foo">

   <entityData>
      <namedAttributes>...</namedAttributes>
      <dynamicEnums>...</dynamicEnums>
   </entityData>

   <ns2:employees>
      <ns2:user id="test">
          <ns2:name genderTitle="0" firstName="Rock" surName="Solid"></ns2:name>
      </ns2:user >
   </ns2:employees>
</ns2:list>

If I try a xpath-expression I only get [object Object] as alert:

function parse(xml){
   var test= $(this).find('/ns2:list/ns2:employees/ns2:user[85]/ns2:name');
   alert(test);
};

Adding .text()-method like:
var test= $(this).find(‘/ns2:list/ns2:employees/ns2:user[85]/ns2:name’).text(); only makes the alert empty…

The xpath expression should not be wrong, I used Firebug to get the expression, maybe in this example some typing error.

Anyone knows whats wrong?
Or the other way round: how to alert fields like firstName?

  • 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-25T05:58:28+00:00Added an answer on May 25, 2026 at 5:58 am

    you may need to look at .parseXML to parse the xml also here is a good SO answer to parse xml with namespaces jQuery XML parsing with namespaces

    here is a good link too Namespace Selectors for jQuery

    solution

        xmlDoc = $.parseXML(xml),
        $xml = $(xmlDoc),
        $name = $xml.find( "ns2\\:name" ).attr("surName");
    
       alert($name);
    

    here id the fiddle http://jsfiddle.net/Jbnev/

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

Sidebar

Related Questions

I want to use following xml webservice. www.musicbrainz.org/ws/2/artist/?query=artist:michael jackson which format is like below:
I want to parse the following XML document to resolve all entities in it:
I have XML in the following form that I want to parse with PHP
I have the following very simple XML file and I want to quickly parse
I need to parse a XML file which I get from third party to
I want to use RestKit to parse XML data from our servers. Downloading and
I have the following XML file with page nodes which I want to read
I have the following XML: <iq xmlns=jabber:client to=39850777771287777738178727@guest.google.com/agsXMPP xml:lang=en id=sub23 from=search.google.com type=result> <pubsub xmlns=http://jabber.org/protocol/pubsub>
I'm trying to read the following xml file from spotify: http://ws.spotify.com/search/1/track?q=sail+awolnation I want to
I just want to parse the following string up until the END token then

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.