Jason Jesso wrote: > > My DTD is: > > <!ELEMENT A ( B, C ) > > <!ELEMENT B ( #PCDATA ) > > <!ELEMENT C ( #PCDATA ) > > > My XML file is: > > <?xml version="1.0" encoding="UTF-8"?> > <!DOCTYPE SCRIPT SYSTEM "jj.dtd" >
This last line says that "SCRIPT" is the root element of your XML document. You should change "SCRIPT" to "A". > <A> > <C>TEST</C> > </A> > > I want to fail since the B tag is missing. Yes, and the root element is wrong in the DOCTYPE specification too. > My C++ code is: > > ErrorHandler* errHandler = (ErrorHandler*) new HandlerBase(); > parser.setErrorHandler(errHandler); HandlerBase does nothing with errors. Replace this with a derived class that prints out error messages and you will probably see the validation errors. > catch( const XMLException& e ) > catch (const SAXParseException& e) You are probably expecting that these exceptions are thrown when the document doesn't validate, but this may not be the case (I'm not sure as I'm using mostly the SaxParser). Joachim -- work: [EMAIL PROTECTED] (http://www.netacquire.com) private: [EMAIL PROTECTED] (http://www.kraut.ca) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
