I am having an issue with the IE version not recognizing an XML par and allowing me to manipulate using DOM.I have set the conent type to tex/HTML on the resource providing me with this XML.When I see the responseText, I can clearly see my XML using alert, but when I do :
I would appreciate if someone knows what's wrong in here.Thanks a bunch.
[eric - added code tags so it is pretty] [ June 24, 2008: Message edited by: Eric Pascarello ]
You're using a JSP? My next guess would be that some whitespace is being included before the <?xml?> declaration.
Joined: Jun 23, 2008
The below code is writen in an HTML file.
As you can see, the function getData() is referencing a jsp file which has code to lookup an XML and return the XML. I have made sure now that there is no space either before the XML prolog. Unfortunately, no luck yet. I appreciate you being able to reply promptly. [ June 25, 2008: Message edited by: Rahul Vaids ]
Please be sure to use UBB code tags when posting code to the forums. Unformatted code is extermely hard to read and many people that might be able to help you will just move along. Please read this for more information.
You can go back and change your post to add code tags by clicking the .
Yup. there's going to be a bunch of newlines in your output because of the JSP. Remember a JSP is just a template for an HTML file. So not only will this not work for you , because it will preserve all whitespace including newlines, but the fact that there is just Java code in your JSP is rather a misuse of the mechanism.
Since there is only Java code in this, why is it not a servlet where you have much finer control over what it is emitted?
P.S. For more information on the whitespace issue with JSP, see this article.
Joined: Jun 23, 2008
This is being done because of a constraint in the application to not have any .java class. Hence using a JSP to achieve the functionality. Is there a was I can get rid of the white spaces?
Why the restriction? It sounds rather silly on the surface. And your JSP gets turned into a Java class, so your app has Java classes in any case.
Another question, why aren't you just referencing the XML directly? It looks like all you are doing is to stream the XML file that's under WEB-INF as the response. Why the middle man? Can you not just move the XML file out of WEB-INF and address it directly?
You might be able to reformat the JSP to emit no whitespace before the xml directive (by putting all that JSP elements on a single line) but that's really fragile.