GNOME Bugzilla – Bug 126351
Entity resolution failed
Last modified: 2009-08-15 18:40:50 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
Created attachment 21238 [details] Testcase for failure of entity resolution.
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.
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"
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
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
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 (­) in test.02.xml could also not found. Why? As I could see, I declared the entity correct. Nor did I changed anything with ­. 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
Created attachment 21294 [details] testcase2.tgz: Unresolved entitys &db; and ­
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
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
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>­</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
> $ 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
> 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