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	"&#38;#x2014;"> <!-- EM DASH -->
> <!ENTITY ndash	"&#38;#x2013;"> <!-- EN DASH -->
> <!ENTITY dash	"&#38;#x2010;"> <!-- HYPHEN -->
> <!ENTITY blank	"&#38;#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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.