Hi,
I am having a problem with the parsing some documents which are not
well-formed. The parser seems to catch the error, but then strangely instead
of stopping at that point and returning an error, it proceeds to invoke the
character callback. I am not sure whether this is the expected behaviour.
I am attaching the relevant test files and providing a brief description of
the problem. I am working with LibXml version 2.26.28.
ibm09n01, ibm09n02---- These files contain the declaration of an invalid
entity value in an internal subset, the error is caught but character
callback is invoked for the character content inside the start element.
ibm10n02, ibm10n06----The test is to check for an invalid attribute value,
however again I get a characters callback for the character data present as
the content of the lone element which contains an invalid attribute value.
ibm15n01---Invalid Comment
ibm17n01, ibm17n02, ibm17n03, ibm17n04-----Invalid PI's
ibm29n01----Contains an illegal markup declaration in the DTD
ibm29n02----Parameter references appear inside element declaration.
As I have mentioned, the common problem happens to be that the error
conditions are not flagged as such, and furthermore instead of the parsing
being stopped I get a character callback for the character content
associated with that particular element.
Regards
Ashwin Sinha
The most likely way for the world to be destroyed, most experts agree, is by
accident. That's where we come in; we're computer professionals. We cause
accidents.
The real art of conversation is not only to say the right thing at the right
place but to leave unsaid the wrong thing at the tempting moment.
Wise Men descend from heaven, and they SMOKE from 9 to Seven. Love is an
exploding cigar we willingly smoke.
Virtue is its own PUNISHMENT.
Expectations that have gotten out of hand, will lead to absolute
disappointment, no matter what happens in the end, for nothing, nothing, can
satisfy it -- they are, but illusions -- chase your own shadow, you will
find that eventually catching up with it is just an illusion, though it
seems so plausible. (perhaps a meaningful life is like that too? -- just an
illusion?)
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
<!ENTITY FullName "Snow&Man">
]>
<!-- testing invalid entity value -->
<student>My Name is &FullName;. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
<!ENTITY FullName "Snow%Man">
]>
<!-- testing invalid entity value -->
<student>My Name is &FullName;. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
<!ATTLIST student
first CDATA #REQUIRED
middle CDATA #IMPLIED
last CDATA #IMPLIED >
<!ENTITY myfirst "Snow">
<!ENTITY mymiddle "I">
<!ENTITY mylast "Man">
]>
<!-- testing invalid attvalue -->
<student first='Snow&Man'>My Name is SnowMan. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
<!ATTLIST student
first CDATA #REQUIRED
middle CDATA #IMPLIED
last CDATA #IMPLIED >
<!ENTITY myfirst "Snow">
<!ENTITY mymiddle "I">
<!ENTITY mylast "Man">
]>
<!-- testing invalid attvalue -->
<student first="Snow&Man">My Name is SnowMan. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
]>
<!-- testing invalid comment -->
<!------>
<student>My Name is SnowMan. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
]>
<!-- testing invalid PITarget -->
<?xmL This is a test ?>
<student>My Name is SnowMan. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
]>
<!-- testing invalid PITarget -->
<?XML This is a test ?>
<student>My Name is SnowMan. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
]>
<!-- testing invalid PITarget -->
<?xML This is a test ?>
<student>My Name is SnowMan. </student>
<?xml version="1.0"?>
<!DOCTYPE student [
<!ELEMENT student (#PCDATA)>
]>
<!-- testing invalid PITarget -->
<?xml This is a test ?>
<student>My Name is SnowMan. </student>
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE animal [
<!ELEMENT animal ANY>
<!ENTITY % parameterE "leopard EMPTY>">
<!ELEMENT %parameterE;
]>
<!-- Parameter reference appears inside elementdecl in DTD -->
<animal>Any content</animal>
<!DOCTYPE animal [
<?xml version="1.0" encoding="ASCII" ?>
<!-- Illegal markupdecl in DTD -->
<!ELEMENT animal (cat|tiger|leopard)+>
<!ELEMENT cat EMPTY>
<!ELEMENT tiger (#PCDATA)>
<!ELEMENT leopard ANY>
<!ELEMENT small EMPTY>
<!ELEMENT big EMPTY>
<!ATTLIST tiger color CDATA #REQUIRED>
]>
<animal>
<cat/>
<tiger color="white">This is a white tiger in Mirage!!</tiger>
<cat/>
<leopard>
<small/>
<big/>
</leopard>
</animal>
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml