[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [xml] Parameter-Entity in CDATA block not getting replaced
- From: Ashwin <ashwins huawei com>
- To: veillard redhat com
- Cc: xml gnome org, ranjit huawei com, nageshs huawei com
- Subject: Re: [xml] Parameter-Entity in CDATA block not getting replaced
- Date: Fri, 18 Apr 2008 14:54:22 +0800
-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On Behalf Of
Daniel Veillard
Sent: 2008年3月25日 4:52
To: Ashwin
Cc: xml gnome org; ranjit huawei com
Subject: Re: [xml] Parameter-Entity in CDATA block not getting replaced
On Thu, Mar 13, 2008 at 02:43:15PM +0530, Ashwin wrote:
> Hi,
>
> For the attached files the parameter entity inside the CDATA block
is
> not getting replaced.
> Ideally after replacement the CDATA content should be <!ATTLIST root attr1
> NMTOKEN "attrvalue">, however the PE entity replacement is going wrong and
> the content is being returned as NULL. The problem occurs at line 2314 in
> parser.c, there is a function call to xmlParseStringPEReference, for the
PE
> inside the Cdata block, which in turn calls the xmlGetParameterEntity, and
> then does a hashlookup, from the xmlGetEntityFromTable function. However
the
> entity pointer returned contains the content as Empty instead of <!ATTLIST
> root attr1 NMTOKEN "attrvalue">. I think the content should not be empty,
> its probably happening because somehow the parser is not able to read the
> entity content in external2.ent..
> Rather hard problem, basically an external system parsed entity
>referenced
>from the external subset in a location where it need to be included in
>litteral
>and well libxml2 was not loading the content of the entity in that case.
>Proper fix is not trivial, abut it's now fixed in SVN, and added to the
>regression tests, see
> ./xmllint --valid --noent --debugent test/valid/t11.xml
>after updating from SVN, it shows the problem is fixed, and the test case
>is added to the regression tests.
There is a doubt regarding this bug fix (SVN-3713), in parser.c function
xmlStringLenDecodeEntities has a call to xmlLoadEntity as follows:-
if (ent->content == NULL) {
if (xmlLoadEntityContent(ctxt, ent) < 0) {
}
}
The second if block is empty, if the check is not required then we can
remove the if and call xmlLoadEntityContent directly, otherwise some error
handling is missed out....
Thanks & Regards
Ashwin
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]