473,378 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Request help parsing XML reply from HTTPRequest

I can't seem to get this reply parsed correctly. All I'm really interested in
are Package.Postage.MailService and Package.Postage.Rate. Code snippet
follows.

<?xml version="1.0" ?>
<RateV3Response>
<Package ID="1">
<ZipOrigination>46228</ZipOrigination>
<ZipDestination>62522</ZipDestination>
<Pounds>3</Pounds>
<Ounces>0</Ounces>
<Size>REGULAR</Size>
<Zone>3</Zone>
<Postage CLASSID="1">
<MailService>Priority Mail</MailService>
<Rate>5.70</Rate>
</Postage>
</Package>
</RateV3Response>

I'm encountering *no* problems sending the request, or receiving the reply --
or displaying the *entire* reply. It's getting at the individual fields that
I'm having trouble with.

Here's the relevant portion of the code. Somebody please show me what I'm
doing wrong (or failing to do, as the case may be).

TIA...

var package = new Array;
package = objSrvHTTP.responseXML.getElementsByTagName("Packa ge");

alert (package.length);
// displays 0 !! What's going on? Should be 1, shouldn't it?

alert (package.firstChild.nodeValue);
// complains that the object doesn't support this property or method

for (var i = 0; i < package.length; i++) {
// since package.length = 0, obviously the loop will do nothing

var pkg = package.item(i);
var postage = pkg.getElementsByTagName("Postage");

for (var j = 0; j < postage.length; j++) {
var pstg = postage.item(j);
var rate = pstg.getElementsByTagName("Rate");
var srvc = pstg.getElementsByTagName("MailService");
Service.innerText = srvc.item(0).firstChild.nodeValue;
Rate.innerText = rate.item(0).firstChild.nodeValue;
}
}
--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
Sep 26 '07 #1
5 2155
In article <46**************@PointedEars.de>, Thomas 'PointedEars' Lahn <cl**@PointedEars.dewrote:
>You have to serve the response declared with an XML media (MIME) type in its
Content-Type header (no matter the format of its message body), or the
`responseXML' property will most certainly not work. `text/xml' is the
media type that should be declared here.
I guess this is where I'm really lost: How can I "serve the response declared
with an XML media type in its Content-Type header" when I have no control over
what comes back from the server?

[...]
>You have provided too little information about your server-side and
client-side environment to allow for more educated guesses, let alone
for providing an informed solution to the problem.
Client side is IE6 / Win XP Pro SP2. I have no idea what the server side
environment is. It doesn't belong to me, I have no control over it, and I have
to take what I can get.

--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
Sep 26 '07 #2
Doug Miller meinte:
I guess this is where I'm really lost: How can I "serve the response declared
with an XML media type in its Content-Type header" when I have no control over
what comes back from the server?
You could at least check it (and perhaps rule out a possible source of
your error). Get some proper debugging tools, which will display the
response's header.
Client side is IE6 / Win XP Pro SP2. I have no idea what the server side
environment is. It doesn't belong to me, I have no control over it, and I have
to take what I can get.
Get Firefox and Firebug and then start debugging.

Gregor

--
http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
http://www.licht-blick.at ::: Forum für Multivisionsvorträge
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Sep 26 '07 #3
In article <11**********************@y42g2000hsy.googlegroups .com>, Bart Van der Donck <ba**@nijlen.comwrote:
>To the original poster: could you try to upload a file named .htaccess
into the same directory with the following content:

AddType text/xml xml
Did that; no effect.
>
Works when you're on UNIX and allowed to use directives.
I'm on Windows XP Pro, using IE6 (testing this from my desktop PC before
attempting to upload to a web server).
--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
Sep 26 '07 #4
In article <46***********************@newsspool1.arcor-online.net>, Ma***********@gmx.de wrote:
>XMLHTTP and responseXML will only work if the server sends the XML with
the HTTP response header Content-Type with value text/xml or
application/xml.
That would explain it, then: the server is sending back no Content-Type header
*at all*.

Any suggestions on how to proceed? (Other than complaining to the server
administrator, that is.) Please note that I'm working in IE6 (not by choice,
but that's the way it is), and the overrideMimeType() method is not available.
--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
Sep 26 '07 #5
In article <jY******************@newssvr13.news.prodigy.net >, sp******@milmac.com (Doug Miller) wrote:

Finally got it -- much thanks to all who helped, especially Thomas Lahn.

--
Regards,
Doug Miller (alphageek at milmac dot com)

It's time to throw all their damned tea in the harbor again.
Sep 27 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Robert Oschler | last post by:
I have an IMG element that I've been using to send messages back to my server whenever certain item option choices are made by a visitor. I send each message by forming a URL with various search...
2
by: CES | last post by:
I'm sorry for the 101 question but I'm having problems loading/parsing a simple XML file into to above browsers. I was wondering if anyone has seen and can point me to a SIMPLE example that a...
3
by: Mark | last post by:
Hi all i was just wondering if you help. I have to send a cgi request to a company using xmlhttp request. They reply back with a line of info but when you view the internet explorer source code...
6
by: P James | last post by:
Hi, My project has been running for 4 years in ASP/IIS (originally on NT4, then on Win2003 as of 1 year ago), using the following code to parse the request object using the XML DOM: Set...
2
by: Lloyd Dupont | last post by:
I'm experimenting with an upload file page. I have a few HtmlInputFile on it. While testing it, I selected a 12MBfile, click "upload". I was think I am safe as (at last in the code) I don't...
3
by: sck10 | last post by:
Hello, I am using the following to retrieve header information from a webpage: Request.Headers.ToString(). What I get is a huge string of data. How do I go about extracting just the part that...
1
by: Smokey Grindle | last post by:
to start off with the page the free text box (version 3) is on has validateRequest="false" in the page directive already... but even with that when I am in the page and then click on a link to...
23
by: Mark Rae | last post by:
Hi, Because all my public sites are hosted with a 3rd-party ISP and, therefore, I don't have access to their server's EventLog etc, every error is emailed to me. Recently, I've been getting...
1
by: Cactus77 | last post by:
Hi, I have a problem with deploying a Report Model. I've build a Report Model in Visual Studio and by deploying mij my model, I get the next error: ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.