How to ignore DTD

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to ignore DTD

Tomas Kolaci

 Hi!

 

 Is it possible to force Saxon (6.5.3) to ignore DTD of the source document? I have problem with attributes with defined default value, which are always added into output XML (I want it there only in the case it was in the source document already), I think this should help me.

 

 Thank you!

 

 Best regards, Tomas

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to ignore DTD

Jirka Kosek
Tomas Kolaci wrote:

>  Is it possible to force Saxon (6.5.3) to ignore DTD of the source document?

The easiest way is probably to supply own URIResolver which will return
empty resource instead of original DTD.

> I have problem with attributes with defined default value, which are always
> added into output XML (I want it there only in the case it was in the source
> document already), I think this should help me.

But this is not problem, this is standard behaviour specified in XML
recommendation. If you don't like this, simply don't reference DTD in
your documents.

--
------------------------------------------------------------------
   Jirka Kosek     e-mail: [hidden email]     http://www.kosek.cz
------------------------------------------------------------------
   Profesionální školení a poradenství v oblasti technologií XML.
      Podívejte se na náš nově spuštěný web http://DocBook.cz
        Podrobný přehled školení http://xmlguru.cz/skoleni/
------------------------------------------------------------------
   Nejbližší termíny školení: DocBook 5.-7.12. * XSL-FO 19.-20.12.
      XSLT 17.-20.10. * XML schémata (včetně RELAX NG) 7.-9.11.
------------------------------------------------------------------


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: How to ignore DTD

Michael Kay
In reply to this post by Tomas Kolaci
It's not Saxon itself that uses the DTD, it's the XML parser. If you're using Saxon 6.5.3 then by default you're probably using the AElfred XML parser. The way to tell any SAX parser to ignore the DTD is to supply an EntityResolver that intercepts the access to the DTD and returns a dummy DTD. Alternatively, it may be simpler to preprocess the source XML prior to parsing to remove the DOCTYPE declaration.
 
Michael Kay
http://www.saxonica.com/


From: [hidden email] [mailto:[hidden email]] On Behalf Of Tomas Kolaci
Sent: 05 October 2005 10:40
To: [hidden email]
Subject: [saxon] How to ignore DTD

 Hi!

 

 Is it possible to force Saxon (6.5.3) to ignore DTD of the source document? I have problem with attributes with defined default value, which are always added into output XML (I want it there only in the case it was in the source document already), I think this should help me.

 

 Thank you!

 

 Best regards, Tomas

Loading...