Are you setting your EntityResolver for the parser so it knows where to find the schematest.dtd file? You could also try hardcoding the full path location for the schematest.dtd.
Laura Hatcher -----Original Message----- From: Bob Foster [mailto:[EMAIL PROTECTED] Sent: Wednesday, May 18, 2005 2:58 PM To: [email protected] Subject: Re: How to use entities with XML Schema? Thanks. That does indeed suppress validation from the DTD, but the parser seems to have lost its ability to read the external subset. Given input like: schematest.xml: <!DOCTYPE example SYSTEM "schematest.dtd"> <example xsi:noNamespaceSchemaLocation="schematest.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <foo/> &ba; </example> where schematest.dtd contains: <!ENTITY fu "<foo/>"> <!ENTITY ba "<bar/>"> The parser says: 'Error - the entity "ba" was referenced and not declared". Works fine if you move the entity defs to the internal subset. Is this in accordance with jaxp? How to get the parser to read the external subset? Bob Neil Graham wrote: > Hi Bob, > > I haven't actually tried this, but what happens if you use the JAXP > property "http://java.sun.com/xml/jaxp/properties/schemaLanguage", set to > "http://www.w3.org/2001/XMLSchema"? If you set isValidating to true on a > SAXParserFactory, and set this property on the SAXParser instance, I > believe you should get the behaviour you desire. > > Cheers, > Neil > Neil Graham > Manager, XML Parser Development > IBM Toronto Lab > Phone: 905-413-3519, T/L 969-3519 > E-mail: [EMAIL PROTECTED] > > > > > > Bob Foster <[EMAIL PROTECTED]> > 05/18/2005 02:14 AM > Please respond to > j-users > > > To > [email protected] > cc > > Subject > Re: How to use entities with XML Schema? > > > > > > > Joseph Kesselman wrote: > >>Schema has no concept of entities, so to do this you have to validate >>against a DTD (or an internal subset) to expand the entities, then > > validate > >>again against the schema. I _think_ simply turning on both kinds of >>validation and having the proper doctype in the source file will do the >>right thing. > > > Nope. If you have a DOCTYPE with either an internal or external DTD, > Xerces validates against the DTD. > > >>Officially (officiously?), the folks who designed schemas expect us to > > stop > >>using entities and migrate to some other variety of macro/external-data >>reference. > > > Not their problem, eh? > > It's mine. A number of XML editors have started supporting this no > concept, raising user expectations this is a valid combination. > > Bob Foster --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
