[XML-SIG] value error when parsing XML

Ajay Brar abra9823 at mail.usyd.edu.au
Tue Aug 3 12:53:12 CEST 2004

Andrew Clover wrote:

> Ajay Brar <abra9823 at mail.usyd.edu.au> wrote:
>> i get a value error when parsing an xml file.
> With what are you parsing the XML file?

i am using a SAX parser. i use the make_parser in xml.sax to make the 
parser. i have my own content handler
parser = make_parser()
parser.setFeature(feature_namespaces, 0)
umXML = umXMLHandler.UM_XML_Handler()

>> can someone please tell me how i can workaround this problem.
> Do you really need the .dtd? If you don't need default attribute 
> values or entities from the DTD external subset, you are best off 
> using a simple non-validating, non-external-entity-reading parser.

while i don't need the DTD immediately, in the long term i would like to 
validate the XML against the DTD.

> Otherwise, depending on what you are using to parse the XML file, you 
> may have to give it an absolute URI to tell it where the resource is 
> supposed to be located, so that it can work out where, exactly, 
> relative URLs are relative to - relative URIs should be relative to 
> the XML file that used them, *not* your OS's current working directory.

the script actually works if the dtd is in the same directory as the 
script. if i put it with the xml, that when i get the error.

> If the relative URI given in the <!DOCTYPE> is actually wrong (ie. it 
> points to a non-existant path), you'd have to use an entity resolver 
> to redirect it elsewhere. (With SAX you'd use resolveEntity; with 
> DOM3LS you'd use an LSResourceResolver.)

would this be the correct way to specify the uri, is it is in the same 
directory as the xml file
<!DOCTYPE um SYSTEM 'um.dtd'>

i think its something to do with the way i call the parser
and it seems to me that for some reason, when parsing, it resolves the 
name to ../um_xml/<name>, which in this case is um.dtd
Is that why?
i am a newbie to python, XML and XML in Python, so its hard to figure 
out what i am doing wrong.



Ajay Brar
CS Honours 2004
Smart Internet Technology Research Group


More information about the XML-SIG mailing list