[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

docbook and xmlproc

Tim Arnold

1/22/2008 2:28:00 PM

hi, I'm unable to get xmlproc to validate my docbook test file. This is new
territory for me, so I'd appreciate any advice on what I'm doing wrong.
Using python 2.4 on HPux10.20.

The test file (testdb.xml)
<?xml version="1.0"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"/dept/app/doc/xml/DocBook/docbookx.dtd">
<chapter><title>Test Chapter</title>
<para>
This is a test document.
</para>
</chapter>

The python code:
from xml.parsers.xmlproc import xmlproc
from xml.parsers.xmlproc import xmlval
print 'Validate without DTD'
p0 = xmlproc.XMLProcessor()
p0.set_application(xmlproc.Application())
p0.parse_resource('testdb.xml')
print
#
print 'Validate with DTD'
p1 = xmlval.XMLValidator()
p1.set_application(xmlval.Application())
p1.parse_resource('testdb.xml')

Of course it gets through the 'Validate without DTD' portion fine, but I get
this error on the 'Validate with DTD' part:
-----------------------
ERROR: Internal error: External PE references not allowed in declarations at
/dept/app/doc/xml/DocBook/dbcentx.mod:308:10
TEXT: '
]]>

<![ '
-----------------------
The DTD I'm using is the plain-vanilla docboox.dtd version 4.5, downloaded
from the docbook.org site. My guess is that I'm misunderstanding something
in the above code, but for completeness, here's the info on the dbcentx.mod
file: the file has this def at the beginning:

<!ENTITY % ISOamsa.module "INCLUDE">
<![%ISOamsa.module;[
<!ENTITY % ISOamsa PUBLIC
"ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML"
"ent/isoamsa.ent">
<!--end of ISOamsa.module-->]]>

and these lines later on (307-9) :
307 <![ %ISOamsa.module; [
308 %ISOamsa;
309 ]]>

The isoamsa.ent file is in the ent subdir relative to the dbcentx.mod file,
so I'm at a loss.
thanks,
--Tim Arnold


1 Answer

Stefan Behnel

1/23/2008 12:30:00 PM

0

Tim Arnold wrote:
> I'm unable to get xmlproc to validate my docbook test file. This is new
> territory for me, so I'd appreciate any advice on what I'm doing wrong.
> Using python 2.4 on HPux10.20.

I do not have much experience with xmlproc, but I'd encourage you to use lxml,
which uses the parser and DTD validator of libxml2.

http://codespeak.net...
http://codespeak.net...validation.html

Stefan