From general-return-5899-apmail-xml-general-archive=xml.apache.org@xml.apache.org Mon Apr 08 02:10:29 2002 Return-Path: Delivered-To: apmail-xml-general-archive@xml.apache.org Received: (qmail 32204 invoked by uid 500); 8 Apr 2002 02:10:28 -0000 Mailing-List: contact general-help@xml.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: general@xml.apache.org Delivered-To: mailing list general@xml.apache.org Received: (qmail 32193 invoked from network); 8 Apr 2002 02:10:28 -0000 To: general@xml.apache.org Subject: JAXP problems: Latin-1 encoded files, and DTDs in jar files Message-ID: <1018231834.3cb0fc1adf06f@webmail.daimi.au.dk> Date: Mon, 08 Apr 2002 04:10:34 +0200 (MET DST) From: eriksoe@daimi.au.dk MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.6 X-Originating-IP: 62.199.202.21 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Hello all, I've run into problems using the SAX parser in JAXP. The first is that it seems impossible to get it to parse files encoded in something else than UTF-8 - in my case, I want it to read Latin1 (ISO-8859-1). What I get is an org.xml.sax.SAXParseException: Character conversion error: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (line number may be too low). I have tried inserting encoding="ISO-8859-1" (or encoding="Latin-1") in the xml DOCTYPE tag and in the DTD tag. (Actually, even if I supply nonsense encoding names, I get the same error message - it seems to be ignored altogether). I've also tried somthing like InputSource is = new InputSource(new FileInputStream(filename)); is.setEncoding("ISO-8859-1"); xmlReader.parse(filename); but without success. As my editor does not support UTF-8, I'd really like to be able to write Latin1 douments. Is there a solution? The second problem is that our java program is going to be put into a jar file, along with its data: some XML files and their DTD. I know how to make the XmlParser read the XML files, but they cannot find the DTD (and I can't just specify an URL in the DOCTYPE tag of the XML files, as the URL for jar resources are platform dependent). How do you make to parser search for the DTD among the resources in the jar file? (Our program has no problems with file locations before being jarred, so I'd of course like to know a minimal-impact solution, if one exists.) Erik Søe Sørensen -- Lights. Panic. Action. --------------------------------------------------------------------- In case of troubles, e-mail: webmaster@xml.apache.org To unsubscribe, e-mail: general-unsubscribe@xml.apache.org For additional commands, e-mail: general-help@xml.apache.org