XML Data (currency.xml)
Xml Copy Code
<?xml version="1.0" encoding="utf-8"?>
<currency>
<name>Euro</name>
<symbol>€</symbol>
<exchange>
<base>US$</base>
<rate>1.106</rate>
</exchange>
</currency>
ASP Page (incapable.asp)
Xml Copy Code
<%@language = "javascript"%>
<%
var doc = new ActiveXObject("Msxml2.DOMDocument.3.0");
doc.async = false;
if (doc.load(Server.MapPath("currency.xml"))==true) {
Response.ContentType = "text/xml";
Response.Write(doc.xml);
}
%>
When incapable.asp is opened from a Web browser, an error such as the following results:
Xml Copy Code
An invalid character was found in text content. Error processing resource 'http://MyWebServer/MyVirtualDirectory/incapable.asp'. Line 4, Position 10
This error is caused by the use of the Response.Write(doc.xml) instruction in the incapable.asp code. Because it calls upon ASP to encode/decode the Euro currency symbol character found in currency.xml, it fails.
However, you can fix this error. To do so, replace this Response.Write(doc.xml) instruction in incapable.asp with the following line:
Xml Copy Code
doc.save(Response);
With this line, the error does not occur. The ASP code does produce the correct output in a Web browser, as follows:
Xml Copy Code
<?xml version="1.0" encoding="utf-8" ?>
<currency>
<name>Euro</name>
<symbol>€</symbol>
<exchange>
<base>US$</base>
<rate>1.106</rate>
</exchange>
</currency>
El problema en ASP se soluciona de esta manera doc.save(Response);
Necesito imprimir un xml con caracteres raros en JAVA
Se supone que esta pagina la leo desde otra con XML.load(pagina.jsp)
y me arroja el error de caracteres no valido en el XML