Re: [xml] gjobread.c example & validtion (newbie)



On Thu, Apr 25, 2002 at 10:13:57AM -0400, Daniel Kelley wrote:

hi-

as the subject line states, i'm new to libxml.  i'm using libxml2-2.4.20
on redhat 7.2.

i'm looking at the source for the gjobread.c example contained in the
distribution.  i've read through the docs at xmlsoft.org and browsed the
mailing list archives.  i have a really basic question:

from what i can gather, the gjobread example uses the DOM
interface.  i'd like to modify gjobread.c slightly to validate against a
dtd at parse time.  is there any way to do this using the DOM interface,
or would i be forced to rewrite the file using the SAX interface?


Dan -

You want to set

xmlDoValidityCheckingDefaultValue = 1;

The documentation on this is here:

http://xmlsoft.org/html/libxml-globals.html

If you need to specify the dtd in your code (rather than in having it
specified in the doc itself) there's example code in xmllint.c (look at the
stuff that handles the "--dtdvalid" command line option).

Cheers,

John



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