Hi Lynn, Likely there's something else going on here which you haven't mentioned. Not sure what to suggest since I can't reproduce it with what you posted.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Huynh, Lynn T." <[EMAIL PROTECTED]> wrote on 04/16/2008 01:55:12 PM: > Hi Mike, > I thought so too. It is hard to believe that this is happening. And > thought that I could have done something wrong. > > I'm testing with sax.Counter sample and not able to see the error > message either. > I turned on the validation in the Counter sample as well. > > > -----Original Message----- > From: Michael Glavassevich [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 16, 2008 11:22 AM > To: j-users@xerces.apache.org > Subject: Re: xerces does not validate dtd even though it is set to true > > Hi Lynn, > > Hard to believe that Xerces isn't reporting this error. When I try your > example with the sax.Counter sample I get: > > [Error] label.xml:4:14: Attribute "A1" is required and must be specified > for element type "LABEL". > > Validation errors are non-fatal. Are you sure that you're registering an > ErrorHandler and not ignoring the errors reported to it? > > Thanks. > > Michael Glavassevich > XML Parser Development > IBM Toronto Lab > E-mail: [EMAIL PROTECTED] > E-mail: [EMAIL PROTECTED] > > "Huynh, Lynn T." <[EMAIL PROTECTED]> wrote on 04/16/2008 10:13:32 > AM: > > > Hi, > > In my DTD, I have one of the attribute name as a required attribute. > > However, when I used it and do not have it in the xml, Xerces does > > not return any error. > > I have factory.setValidating(true) and > > xmlReader.setFeature("http://xml.org/sax/features/validation", true). > > > > Here is the sample DTD: > > <!ELEMENT LABEL ANY> > > <!ATTLIST LABEL A1 CDATA #REQUIRED> > > <!ATTLIST LABEL A3 CDATA ""> > > <!ENTITY title "The title"> > > <!ELEMENT FIRST (#PCDATA)> > > <!ATTLIST FIRST A2 CDATA ""> > > <!ENTITY subtitle "my subtitle"> > > <!ELEMENT SECOND (#PCDATA)> > > <!ELEMENT THIRD (#PCDATA)> > > > > Sample XML, please note LABEL does not have the required A1 attribute: > > <!DOCTYPE LABEL SYSTEM "label.dtd"> > > <!-- This is a comment --> > > <?xml-stylesheet type="text/xml"?> > > <LABEL A3=""> > > $3.99 > > <!-- This is another comment --> > > <![CDATA[ << CDATA >> ]]> > > &title; > > <FIRST A2="Or &subtitle;"/> > > <SECOND/> > > </LABEL> > > > > Thanks in advance for any input. > > Lynn > > > > > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE > > PROPRIETARY MATERIAL and is thus for use only by the intended > > recipient. If you received this in error, please contact the sender > > and delete the e-mail and its attachments from all computers > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]