good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: problem using XML::SAX::ParserFactoryby arturo (Vicar) |
on Jul 21, 2005 at 13:17 UTC ( [id://476809]=note: print w/replies, xml ) | Need Help?? |
As is pointed out in the XML spec, DTDs aren't just for validation; they also tell you what the default value of attributes are, and potentially contain entity declarations. In a way, DTDs contain some of the document's information. So, because these things are needed to 'read' the document, conforming parsers are required to read them if they are declared -- whether or not the parser is validating. If you're sure the document's valid, you could strip out the DOCTYPE declaration before siccing your parser on it. update : an even better solution would be to get a local copy of the DTD and use catalog resolution to find it. A catalog resolver can tell a parser where to look for a DTD with a given public ID, irrespective of the system ID (the URL in the doctype declaration). If not P, what? Q maybe?
In Section
Seekers of Perl Wisdom
|
|