After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 126351 - Entity resolution failed
Entity resolution failed
Status: VERIFIED FIXED
Product: libxml2
Classification: Platform
Component: general
2.6.2
Other other
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks: 126806
 
 
Reported: 2003-11-06 10:31 UTC by Thomas Schraitle
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase for failure of entity resolution. (538 bytes, application/x-tgz)
2003-11-06 10:40 UTC, Thomas Schraitle
Details
testcase2.tgz: Unresolved entitys &db; and ­ (658 bytes, application/x-tgz)
2003-11-08 10:59 UTC, Thomas Schraitle
Details

Description Thomas Schraitle 2003-11-06 10:31:13 UTC
In the following test case, the entity resolution seems not to work. 
 
I can reproduce this error: Try it with libxml2 v2.5.10 and compare it with v2.6.2. The 
previous version work without any messages but not in the latter case. 
It gives the following strange errors: 
 
$ xmllint --noent --valid --noout test.01.xml 
booktitle.xml:1: parser error : Missing encoding in text declaration 
<?xml   version="1.0" ?> 
                      ^ 
test.01.xml:6: error: Failure to process entity booktitle 
  &booktitle; 
             ^ 
test.01.xml:6: parser error : Entity 'booktitle' not defined 
  &booktitle; 
             ^ 
$ rpm -q libxml2 
libxml2-2.6.2-0 
 
Hopefully it helps. Test case will coming soon. :) 
 
Bye, 
Tom
Comment 1 Thomas Schraitle 2003-11-06 10:40:47 UTC
Created attachment 21238 [details]
Testcase for failure of entity resolution.
Comment 2 John Fleck 2003-11-06 14:24:53 UTC
The error message suggests that booktitle.xml is encoded in other than
UTF-8, which has not been declared. Adding an encoding declaration of
UTF-16 to booktitle.xml solved the problem.
Comment 3 Karl Eichwalder 2003-11-06 15:39:24 UTC
booktitle.xml is ASCII (resp. UTF-8).  Thus no encoding declaration is
needed.  Current behavior breaks many a lot packages like:

tail -n 30 failed/ia64/gimp-help-2
                          ^
../filters/blur/blur.xml:1: parser error : Missing encoding in text
declaration
<?xml version='1.0' ?>
                    ^
../gimp.xml:152: error: Failure to process entity blur
    &blur;
          ^
../gimp.xml:152: parser error : Entity 'blur' not defined
    &blur;
          ^

Thus it's "critical" or a "blocker"
Comment 4 Daniel Veillard 2003-11-06 16:17:18 UTC
Actually it's for a slightly different reason:
  booktitle.xml is an external parsed entity.
The <?xml at the beginning us not parsed using the xmlDecl rule of
XML-1.0 but by textDecl
   http://www.w3.org/TR/REC-xml#NT-TextDecl
the encoding is mandatory for external parsed entities.

The document must be fixed. It was a bug in libxml2 that apparently
got introduced at some point (I used to check that I'm sure) and
got fixed in 2.6.2
The gimp files will have to be fixed !
Or they should use XInclude to aggregate the files instead of
using external parsed entities.

Daniel
Comment 5 Thomas Schraitle 2003-11-07 15:06:19 UTC
Actually I discovered an internal error first -- xmllint gives such a
message. The problem was, that I couldn't reproduce it and I don't
want to write vague bug reports. ;)
Therefore I created this attached minimal version and hoped I have
caught the error. Apparently this was not the case. :-/

I will search a bit deeper to reproduce it or hopefully it will go
away with the next cvs up. ;)

Thanks a lot.

Tom
Comment 6 Thomas Schraitle 2003-11-08 10:58:22 UTC
Ok, another attempt. ;)

I tried to use it with version 2.6.2 and XIncludes (as you suggested).
The former error message disappeared, but I got another one. ;)

I inserted in mydocbook.dtd an entity declaration db. But xmllint
complains and gives the following message:

$ xmllint --noent --postvalid --xinclude test.02.xml
test.01.xml:13: parser error : Entity 'db' not defined
    <title>&db; Test chapter</title>

Another entity from the DocBook DTD (&shy;) in test.02.xml could also
not found.

Why? As I could see, I declared the entity correct. Nor did I changed
anything with &shy;. I am sorry if I bother you again with this, but
for me it seems that there is something very strange. ;)
I didn't discover this with version 2.5.10 and therefore I reopen this
bug.

(See attached testcase number 2).

Tom

$ xmllint --version
xmllint: using libxml version 20602
   compiled with: DTDValid FTP HTTP HTML C14N Catalog XPath XPointer
XInclude Iconv Unicode Regexps Automata Schemas
Comment 7 Thomas Schraitle 2003-11-08 10:59:44 UTC
Created attachment 21294 [details]
testcase2.tgz: Unresolved entitys &db; and &shy;
Comment 8 Thomas Schraitle 2003-11-08 11:02:43 UTC
Arrghl, a copy and paste error. The line:

$ xmllint --noent --postvalid --xinclude test.02.xml
test.01.xml:13: parser error : Entity 'db' not defined
    <title>&db; Test chapter</title>

should be:

test.02.xml:11: parser error : Entity 'db' not defined
    <title>&db; Test chapter</title>

Sorry. :)

Tom
Comment 9 Daniel Veillard 2003-11-08 13:24:39 UTC
In XInclude the subdocument is parsed as a separate document.
So you must add a DOCTYPE if your reference entities.
As I said the simpler is to put the encoding declaration.

Daniel
Comment 10 Thomas Schraitle 2003-11-11 15:20:22 UTC
Ok, as you suggested, I inserted the DOCTYPE declaration in
booktitle.xml. But there is still a _significant_ difference between
2.5.x and 2.6.2!

If I am process the XML files with v2.5.x everything works. But if I
run it with 2.6.2 I get the following errors:

$ xmllint --noout --postvalid --xinclude test.02.xml
test.02.xml:11: parser error : Entity 'db' not defined
    <title>&db; Test chapter</title>
               ^
test.02.xml:12: parser error : Entity 'shy' not defined
    <para>&shy;</para>
               ^

Why is this (huge) difference? :) Karl Eichwalder (ke@suse.de) could
also reproduce this behaviour. Maybe I overlook some obvious details?

Interestingly when I started xmllint for the first time I got the
following (additional), very strange error:

error : Operation in progress
mydocbook.dtd:11: I/O warning : failed to load external entity
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
%DocBookDTD;

But after running xmllint again it disapeared. I didn't changed the
catalog file(s) nor anything else. This error appeared with other
files too (both with XInclude and external entities), but I never saw
this kind of message in 2.5.x.

So I am still confused. I am sorry if I must bother you again, but for
me this problem isn't solved completely. :)

Would you be please so kind and have a look again?

Thanks,
Tom
Comment 11 Daniel Veillard 2003-11-12 01:19:51 UTC
> $ xmllint --noout --postvalid --xinclude test.02.xml
> test.02.xml:11: parser error : Entity 'db' not defined
>    <title>&db; Test chapter</title>
>               ^

  Well is this entity 'db' defined ? And where ?
I can't tell where the problem is just seeing the errors.
I will just say one more time that the simplest way to solve the
initial problem was to add the encoding declaration. If you
migrate to XInclude, okay, but it is an operation an order of
magnitude more complex. Maybe you're finding bugs, but they are
new bugs, not the original one, which should be closed.
If you have an XInclude bug then provide a new tarball with the
new data and if possible a new bug clearly labelled as such,
tanks !

Concerning 

> error : Operation in progress
> mydocbook.dtd:11: I/O warning : failed to load external entity
> "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
> %DocBookDTD;

  It's a socket error raised byt the new I/O checking code.
This seems to prove you don't have a catalog containing DocBook 4.2
DTDs, you should really install one.

Daniel
Comment 12 Thomas Schraitle 2003-11-12 12:07:49 UTC
>   Well is this entity 'db' defined ? And where ?

look into mydocbook.dtd


> I will just say one more time that the simplest way 
> to solve the initial problem was to add the encoding
> declaration.

Yes, but this is solved already and I corrected the corresponding file.

> If you have an XInclude bug then provide a new tarball
> with the new data and if possible a new bug clearly
> labelled as such, thanks

Ok, I closed this bug and opened another one, see #126806

Thanks,
Tom