Re: [xml] regarding xml validation and parsing using SAX



On Thu, Jul 24, 2008 at 11:50:11AM +0530, Umamaheswara Rao wrote:
Hi,

My apologies if this question has already been answered on this list. I am
unable to find any relevant questions on this list.

My requirement is to validate and parse an xml document which myght be
larger in size. So I prefered to do it using SAX method. For that I created
my own xmlSAXHandler object and overriden few of the elements. When I pass
this structure to the parser context (as, ctxtptr->sax=&my_handler), the
document is not getting validated against the dtd. But if I didnt assigned
my_handler object to the ctxtptr->sax, document is getting validated against
the dtd.

Is there any way to do the validation and parsing the document with my
xmlSAXHandler structure object in a single shot?

  No, that's a limitation of the SAX interface, it doesn't support DTD
validation (but you can plug XSD validation). For DTD validation of arbitrary
large instances use the xmlReader instead.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]