Re: [xml] Incorrect WFC error returned
- From: Daniel Veillard <veillard redhat com>
- To: Ashwin <ashwins huawei com>
- Cc: xml gnome org, ranjit huawei com
- Subject: Re: [xml] Incorrect WFC error returned
- Date: Tue, 25 Sep 2007 09:28:52 -0400
On Tue, Sep 25, 2007 at 05:41:15PM +0530, Ashwin wrote:
Hi,
The following well-formed xml snippet returns a well-formedness error
on libxml (version 28).
<?xml version='1.0'?>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA) >
<!ENTITY % xx '%zz;'>
<!ENTITY % zz '<!ENTITY tricky \"error-prone\" >' >
%xx;
]>
<test>This sample shows a &tricky; method.</test>
The error is that it is unable to locate the declaration for %xx.
Ideally %xx should be replaced by <!ENTITY tricky "error-prone">.
However as soon as it gets to %xx, it invokes the getParameterEntity
callback, are we supposed to write code in the callback to get the
replacement text, in my case I have not written any code for the
function, so it returns a NULL pointer. I mean my doubt is, suppose we
don't do that, then should it be returning a well-formedness error?
I believe that what is lect after sending though your mail agent,
reception by mine, and cut and paste to a test file is not well-formed.
The example taken from the XML spec is part of libxml2 regression tests
in test/xml2 :
paphio:~/XML -> xmllint --noout test/xml2
paphio:~/XML -> cat test/xml2
<?xml version='1.0'?>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA) >
<!ENTITY % xx '%zz;'>
<!ENTITY % zz '<!ENTITY tricky "error-prone" >' >
%xx;
]>
<test>This sample shows a &tricky; method.</test>
paphio:~/XML -> xmllint --noent test/xml2
<?xml version="1.0"?>
<!DOCTYPE test [
<!ELEMENT test (#PCDATA)>
<!ENTITY % xx "%zz;">
<!ENTITY % zz '<!ENTITY tricky "error-prone" >'>
<!ENTITY tricky "error-prone">
]>
<test>This sample shows a error-prone method.</test>
paphio:~/XML ->
it is well-formed, libxml2 parses it correctly as demonstrated by xmllint.
If you can't reproduce the bug with xmllint, I will have to assume it is
a problem in the instance, or in the way you implement your entity resolver
(if you use SAX and have troubles with entities handling your are on your own,
sorry, life is too short, you decide to not use the suggested interfaces,
you debug the problem I warned about, not me, I hope this is clear ;-)
So if you can still reproduce the problem with xmllint, provide the
data as an attachement to be sure I get the same sequence of bytes.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]