> Hi Eric,
> Thanks for the response! I visited the URL you posted but still cannot
> figure out what the problem is. Please forgive my ignorance:
> a) Did you set your content type to text/xml?
> I think so. Isn't that what the line
> "req.setRequestHeader("Content-Type", "text/xml");" is supposed to do?
> Do I need to somehow do this in the actual XML file itself?
> b) Is your request actually making it to the server and back?
> I tested out the script with some window alerts for the status - the
> correct status code of 200 is going through...
> c) When you alert/examine the responseText, do you see anything that
> does not belong?
> I'm opening a static XML file that I checked for syntax using Internet
> Explorer. I think that should cover this point... or am I missing
> something?
> d) Open up the dynamic XML document in your browser directly. (Type the
> url into the browser. This may require you to hard code post parameters
> or build a test form.) The browser will tell you if your XML is not
> formatted correctly. Is it formatted correctly?
> See the answer to c. :-D
> This is really confusing me. Is it possible that perhaps the server is
> not set up to serve up XML documents? Is there some sort of special
> setting in Weblogic that enables delivery of XML documents?
> It's really strange... Even though I'm explicitly opening an XML file
> and the content-type is being set to text/xml (as far as I know), the
> response headers keep coming back with a content-type of text/plain.
> Should this tell me something?
> Thanks!
> NL
> Eric Pascarello wrote:
> > Read this:
> > http://radio.javaranch.com/pascarello/2006/09/12/1158096122600.html
> > Eric
> > On 11/17/06, The alMIGHTY N <natle@yahoo.com> wrote:
> > > Hi there -- I've been trying to get a basic XMLHttpRequest object to
> > > read in XML from an XML file and it's not working. I'm sure there's
> > > something really simple I'm just overlooking. I've been comparing it
> to
> > > code I found on the web that definitely works and can't figure out
> what
> > > the difference is aside from try catch statements (maybe that's it?).
> > > Anyway, this is the code. Basically, I'm just trying to get an
> > > acknowledgment that it actually read in XML from the file but Firefox
> > > says the xmlDoc object is null... and while IE recognizes the object,
> > > any processing I do on it fails.
> > > Thanks for any help!
> > > function addMovies() {
> > > var req = null;
> > > if (window.XMLHttpRequest) {
> > > req = new XMLHttpRequest();
> > > } else {
> > > if (window.ActiveXObject) {
> > > req = new ActiveXObject("
> > > Microsoft.XMLHTTP");
> > > }
> > > }
> > > req.onreadystatechange = function() {
> > > if (req.readyState == 4) {
> > > if (req.status == 200) {
> > > var xmlDoc =
> > > req.responseXML;
> > > window.alert(xmlDoc);
> > > document.getElementById
> ("theClicker").disabled
> > > = true;
> > > } else if (req.status == 404) {
> > > window.alert("The
> requested
> > > URL does not exist!");
> > > } else {
> > > window.alert("Error:
> status
> > > code = " + req.status);
> > > }
> > > }
> > > };
> > > req.open("GET", "ajaxtest.xml", true);
> > > req.setRequestHeader("Content-Type",
> "text/xml");
> > > req.send(null);
> > > }
> > ------=_Part_91268_366310.1163801434935
> > Content-Type: text/html; charset=ISO-8859-1
> > Content-Transfer-Encoding: quoted-printable
> > X-Google-AttachSize: 6859
> > <div>Read this:</div>
> > <div></div>
> > <div><a href=3D"
> http://radio.javaranch.com/pascarello/2006/09/12/1158096122600.html">
> http://radio.javaranch.com/pascarello/2006/09/12/1158096122600.html
> </a></div>
> > <div></div>
> > <div>Eric<br><br></div>
> > <div><span class=3D"gmail_quote">On 11/17/06, <b
> class=3D"gmail_sendername">The alMIGHTY N</b> <<a href=3D"mailto:
> natle@yahoo.com">natle@yahoo.com</a>> wrote:</span>
> > <blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN:
> 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>Hi there -- I've been
> trying to get a basic XMLHttpRequest object to<br>read in XML from an XML
> file and it's not working. I'm sure there's
> > <br>something really simple I'm just overlooking. I've been comparing it
> to<br>code I found on the web that definitely works and can't figure out
> what<br>the difference is aside from try catch statements (maybe that's
> it?).
> > <br><br>Anyway, this is the code. Basically, I'm just trying to get
> an<br>acknowledgment that it actually read in XML from the file but
> Firefox<br>says the xmlDoc object is null... and while IE recognizes the
> object,<br>any processing I do on it fails.
> > <br><br>Thanks for any help!<br><br> function addMovies() {<br> var req
> =3D null;<br> if (window.XMLHttpRequest) {<br> req =3D new
> XMLHttpRequest();
> > <br> } else {<br> if (window.ActiveXObject) {<br> req =3D new
> ActiveXObject("Microsoft.XMLHTTP");<br> }
> > <br> }<br> req.onreadystatechange =3D function() {<br> if (
> req.readyState =3D=3D 4) {<br> if (req.status =3D=3D 200) {<br>
> > var xmlDoc =3D req.responseXML;<br> window.alert(xmlDoc);<br>
> document.getElementById
> > ("theClicker").disabled =3D true;<br> } else if (req.status =3D=3D 404)
> {<br> window.alert("The requested URL does not exist!");
> > <br> } else {<br> window.alert("Error: status code =3D " + req.status);<br>
> }<br> }
> > <br> };<br> req.open("GET", "ajaxtest.xml", true);<br>
> req.setRequestHeader("Content-Type", "text/xml");<br>=20
> > req.send(null);<br> }<br><br><br></div><br>=0A
> > ------=_Part_91268_366310.1163801434935--