Dave, A reference to an undeclared entity isn't always a well-formedness error [1]. I suspect your document has an external DTD, in which case you need to enable DTD validation and register an error handler to be notified that your document references an undeclared entity [2]. You can throw an exception from your error handler if you want the parser to stop.
Thanks. [1] http://www.w3.org/TR/2004/REC-xml-20040204/#wf-entdeclared [2] http://www.w3.org/TR/2004/REC-xml-20040204/#vc-entdeclared Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Crain, David B. \(LNG-DAY\)" <[EMAIL PROTECTED]> wrote on 05/05/2006 03:54:16 PM: > Code: > domParser.setFeature(?http://apache. > org/xml/features/validation/schema?, false); > domParser.setFeature(?http://apache. > org/xml/features/dom/create-entity-ref-nodes?, false); > > With this configuration, and using Xerces 2.2.1, anytime the parser > encounters an entity that is not defined in the DTD, we get the > following results: > Input: properly elected to do so, can amend its &bogus; > Federal income tax returns filed > Output: Federal income tax returns filed > > Ran a test with a newer version of Xerces (2.6.0) and got a slightly > different result: > Input: properly elected to do so, can amend its &bogus > ; Federal income tax returns filed > Output: properly elected to do so, can amend its > Federal income tax returns filed > > In either case, this is not a good thing. > > I am looking for method that would allow me to keep the above > features set the way they are, but code a method that would allow me > identify an undefined entity in the data. > > I am also curious why the Xerces code would not throw an exception > when the above data is encountered. I am will to go to 2.8.0 Xerces > if this problem was addressed. > > Let me re-state, I want the code to throw an exception!!!! > > Please let me know if there are any questions. > > Dave > > David B. Crain > Consultant Software Engineer > Editorial & Conversion Systems > Lexis-Nexis > Phone: 937-865-6800 ext. 56303 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
