Michael, 

Thanks for the quick reply. I do understand that if validation is off,
that an undefined entity should not impact the well-formedness rule.
However, if you are setting the "create-entity-ref-nodes" to false
(which is asking the parser to convert an entity to its definition,
defined in the DTD), should it be blanked out or omitted (or, as in the
older version, remove test)?? In my opinion, the entity should be
preserved or an exception thrown because the method that converts the
entities should not make a judgment call.

I am thinking the offending class is:
./org/apache/xml/serialize/BaseMarkupSerializer.java

This was changed between versions 2.2.1, 2.6.0 and 2.8.0. I am not 100%
sure this is the offending class, because I am not sure how the
offending undefined entity is being seen by the parser. I am guessing
that there would be no difference between 2.6.0 and 2.8.0, but I would
not bank on that. 

What I would find helpful is to identify the class/method so that I
could review the code and an appropriate code change. 

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


-----Original Message-----
From: Michael Glavassevich [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 06, 2006 2:04 PM
To: [email protected]
Cc: Crain, David B. (LNG-DAY)
Subject: Re: I am currently having a problem with entities in a DOM
Parser

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]

Reply via email to