Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #17219
| From | Five By Five <5x5@5x5.com.invalid> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | XML Serializer Object Method Error |
| Date | 2012-11-14 08:04 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <XnsA10B6681058255x55x5@88.198.244.100> (permalink) |
I am using the XML Serializer object on a response to an Ajax HTTP
request object in order to convert the document object to a string,
but it is not working. This is all part of a development/debugging process.
* The exception is caught in the serializeToString() method.
Its single argument is an XML document object, which is shown
by the debugger and during code execution (using instanceof operator)
to be an object of "Document" type.
* The error is reported
+ in Mozilla/Firefox 16.0 as:
NS_ERROR_XPC_BAD_OP_ON_WN_PROTO:
Illegal operation on WrappedNative prototype object
+ in Google Chrome 23.0 as:
Uncaught TypeError: Illegal invocation
+ no attempt to debug in IE 9.0 yet, which has too many other issues
* Data in response from Server is a valid XML document, with contained
DTD in the prolog after the XML declaration (standalone)
+ the response string obtained in the client was copied from
the Firebug debugger, pasted directly into W3 validator,
and shown to pass (to validate)
+ The Firebug debugger creates an XML document object in the response,
which would NOT occur if there were MAJOR validity errors
(I have noticed, it seems, that while the Firefox client will form
an XML document object in some responses, that the XML in the response
does not validate on the W3 validator, indicating the W3 validator appears
to have more rigor. I call these "MINOR" validity errors only because
they are errors in validity caught by the W3 validator although not caught
by a browser with its own less-than-rigorous XML parsing/validation
algorithm.)
NONETHELESS, all my XML markup passes the more rigorous W3 validation!!
ALWAYS!
The relevant parts of the function containing the error breaking execution
is presented below at the bottom.
There has been some suggestion from other searches I have done that
there might be non-UTF-8 characters in the byte stream of the response.
Everything is being done in UTF-8 to my knowledge, including the HTML
and PHP source documents at the client and server (w/o byte signature),
not that it should matter. The XML declaration indicates UTF-8 encoding.
More importantly,
1. the php.ini file has been set 'default_charset = utf-8' and the
web server re-started
2. the PHP script calls the function
header("Content-Type: application/xml;charset=utf-8");
which instructs the PHP module to encode characters as UTF-8 to
standard output
3. the HTTP response headers in Firebug show the Content-Type header
is 'application/xml;charset=utf-8'
===============
function checkServerOutput(client, postRequest) {
var serializer = new XmlSerializer();
// 'client' is Ajax HTTP Request object with its standard
// responseXML property
if (client.responseXML instanceof Object == false)
// put out error message alert "NO responseXML object"
else {
xmlString = serializer.serializeToString(client.responseXML);
// put out the string as part of debugging process
}
}
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
XML Serializer Object Method Error Five By Five <5x5@5x5.com.invalid> - 2012-11-14 08:04 +0000
Re: XML Serializer Object Method Error Martin Honnen <mahotrash@yahoo.de> - 2012-11-14 11:31 +0100
Re: XML Serializer Object Method Error Five By Five <5x5@5x5.com.invalid> - 2012-11-14 11:12 +0000
csiph-web