FW: How do I...
"Fitzharris, Walter M. (LNG-DAY)" <[email protected]>
| Newsgroups | gmane.text.xml.sax.general |
|---|---|
| Message-ID | <659F1E79ACDCE54B9F073F928A8E5AC90444A51A@lnxdayexch02.lexis-nexis.com> |
> create a SAX parser that will validate an XML document that has two
> external files:
> 1. a schema file
> 2. an "ents" file containing entity definitions like the following:
> <!ENTITY mdash "&#x2014;"> <!-- EM DASH -->
> <!ENTITY ndash "&#x2013;"> <!-- EN DASH -->
> <!ENTITY dash "&#x2010;"> <!-- HYPHEN -->
> <!ENTITY blank "&#x2423;"> <!-- OPEN BOX -->
> etc...
>
> I created a JAXP sax parser with the xerces impl and was able to get it to
> use the schema, but how do I get the parser to read the entities file? I
> tried overriding resolveEntity() in my subclass of the DefaultHandler as
> follows:
>
> public InputSource resolveEntity(java.lang.String publicId,
> java.lang.String systemId)
> throws SAXException {
> InputSource source = null;
> try {
> source = new InputSource(new FileReader("ents"));
> } catch(Exception e) {
> System.out.println(e.getMessage());
> }
> return source;
> }
>
> This results in the message:
> The markup in the document preceding the root element must be well-formed.
>
I also tried hacking the ents file into a well-formed XML file and I got the
following error...
s4s-elt-schema-ns: The namespace of element 'document' must be from the
schema namespace.
> Walt Fitzharris
> Lexis Nexis
> 937-865-6800 X54641
>
-------------------------------------------------------
This SF.NET email is sponsored by: FREE SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
List: [email protected]
See: http://www.saxproject.org
https://lists.sourceforge.net/lists/listinfo/sax-users