Jump to content

xml parsing


gimpmaster3201

Recommended Posts

Hi, I am new to this forum.

I was wondering if anyone could help me with a problem I am having with parsing a xml file from a HTTP XML request.

I have all the basics of the request working it’s just the extracting of an xml element I need help with.
In the JavaScript I parse the xml file that I receive, then this allows me to use the function getElementsByName()
If I enter a name of the element of a simple xml file then it all works ok, for example

xml file:

[i]<note>hello</note> [/i]

I then getElementsByName("note") I will be returned with the word ‘hello’



But the problem I am having is when the xml document has a namespace associated with it.
This is the xml file I want to parse

[i]<zs:searchRetrieveResponse>
<zs:version>1.1</zs:version>
<zs:numberOfRecords>2152</zs:numberOfRecords>
</zs:searchRetrieveResponse>[/i]

The data that I want from it is the numberOfRecords element, if I parse this file without the namespace it works fine, but for some reason when I try to parse the file with the name space and use the getElementsByName function and I use the string "zs:numberOfRecords" it wont work.

If anyone could help with this problem it would be greatly appreciated.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.