vivek agarwal wrote:
Hi,

In the XML declaration prolog, are Java encodings allowed as well? I
tried to parse an XML doc using JDK 1.5 with the following decl:
<?xml version="1.0" encoding="UTF8" ?>

and it gave no errors, but Xerces clearly says, it is an invalid encoding?

You can set the http://apache.org/xml/features/allow-java-encodings SAX feature to indicate that Xerces should recognize java encoding names, though you really should use the IANA names instead.


DOMParser parser = new DOMParser();
try {

parser.setFeature("http://apache.org/xml/features/allow-java-encodings";,
                      true);
}
catch (SAXException e) {
    System.err.println("could not set parser feature");
}



--
Elliotte Rusty Harold  [EMAIL PROTECTED]
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to