You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jesse Reynolds <li...@va.com.au> on 2002/07/17 19:58:29 UTC

turning on allow-java-encodings feature from something like cocoon

Hi

I'm trying to get Xerces 2.0.0 to parse MacRoman encoded xml files 
for Cocoon 2.0.2.

According to the Xerces FAQ 
(http://xml.apache.org/xerces2-j/features.html) you can run the 
following java code to tell it to recognise and process all character 
encodings suppored by Java. The linux-jdk1.2.2 that I'm using does 
support MacRoman encoded text, so this is, of course, what I want to 
do:


import javax.xml.parsers.SAXParser;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

SAXParser parser = /* created from SAXParserFactory */;
XMLReader reader = parser.getXMLReader();
try {
     reader.setFeature("http://xml.org/sax/features/allow-java-encodings",
                       true);
}
catch (SAXException e) {
     System.err.println("could not set parser feature");
}


Question is, how the hell to I tell Cocoon (or Tomcat????) to run 
this Java code after loading the Xerces parser?

Is there any easier way to tell Xerces to allow java encodings, eg a 
config file or something???

Thanks very much, and appologies if this is a bit off topic... if you 
could at least give me the theory of how a calling app would run the 
above java that would rock.

Jesse

-- 
       Jesse Reynolds - Virtual Artists Pty Ltd - http://www.va.com.au

     Email: jesse (at) va.com.au            > Website Development
     Phone: +61 (0)8 8223 2288              > Web & Email Hosting
       Web: http://jesse.va.com.au          > Streaming Media Hosting
                                            > Telehousing / Colocation

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org