DTD Validation issues

Bug #1820885 reported by Anil Prasad
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxml
Invalid
Undecided
Unassigned

Bug Description

Hi Team,

I have use lxml for dtd validation it is failed. But in same file with same dtd if i have validate through oxygen editor it is pass.

Below is our dtd:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT book (desig) >
<!ELEMENT desig (#PCDATA)>
<!ATTLIST desig value NMTOKEN #IMPLIED>

Below is our xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<book>
<desig value="Crèches">Crèches</desig>
</book>

Python Code:
from lxml import etree
dtd = etree.DTD(open('test.dtd'))
fl = etree.parse(open('test.xml'))
validation = dtd.validate(fl)
if validation == False:
    print(dtd.error_log.filter_from_errors()[0])

Eror Log:
file:/C:/Anil/PTest/CONV/test.xml:3:0:ERROR:VALID:DTD_ATTRIBUTE_VALUE: Syntax of value for attribute value of desig is not valid

Kindly Check suggest how to solve this.

Second issues is: I have use lots of schema file for validation all is good work and quickly, but one schema is not work. if i have use this. lxml is not respond it is hanged. i have check the file size of this schema it is only 2Mb file size and many schema is very big size and it is work fine. How to becomes this type of issues i don't know. please suggest how to check this and find exact the issues.

Below is our python version:

Python : sys.version_info(major=3, minor=7, micro=1, releaselevel='final', serial=0)
lxml.etree : (4, 3, 2, 0)
libxml used : (2, 9, 5)
libxml compiled : (2, 9, 5)
libxslt used : (1, 1, 30)
libxslt compiled : (1, 1, 30)

Regards,
Anil Prasad

Revision history for this message
Anil Prasad (anilkumarg4) wrote :
Revision history for this message
scoder (scoder) wrote :

Both DTD validation and XML-Schema validation are implemented in libxml2. There is nothing lxml can do about this.

Changed in lxml:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.