You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Alexey Miroshnichenko <Al...@EDIFECS.COM> on 2001/04/19 13:50:58 UTC

Re[2]: ValScheme question

Hello Tinny,

Thanks for your answer especially for part II. But can I ask you more?

If I have only xml files and my objective is only test them for be
well-formed. Some files have doctype decl some haven't. I must do only
this test. And in general case I have no dtd file. How can I be equal
to a task?

I think there is nothing bad if parser engine skip reading dtd in this
case. It may notify me about unparsed entity but it must answer the
question about well-formnesty.

Can I think in this way?

TN> For question 1):

TN> If a DTD is specified, the parser will always scan it even if the
TN> validation is off, because DTDs can provide many other information, like
TN> default attributes and entities, in addition to validation.  So the
TN> parser behaviour is correct.

TN> For quesiton 2):

TN> Someone has reported a similar problem earlier, and I think this is a
TN> bug.  With empty DOCTYPE declaration (<!DOCTYPE rootnodename>) and
TN> ValSchemes::Val_Auto, the fHaveSubset should be false and validation
TN> should be off.  I have a fix ready, and should be checked in within the
TN> next few days.

TN> Thanks!

TN> Tinny



TN> Alexey Miroshnichenko wrote:

>> Hi all,
>>
>>   Pardon me if I address my problem not correctly. But may be anyone
>>   can help my with follow questions. I use xerces-c-1_3_0.
>>
>>   1) I have well-formed xml file with DOCTYPE declaration but
>>   corresponding dtd file is absent. I do
>>
>>     setValidationScheme(SAXParser::ValSchemes::Val_Never)
>>
>>   and I suppose that dtd file do not needed in this case. But I catch
>>   exception: unnable open dtd file.
>>   I looked in source. At first we scan dtd file(XMLScanner.cpp,
>>   scanProlog()), then we set up Validation scheme(XMLScanner.cpp,
>>   scanDocument()).
>>
>>   Is this behaviour of parser engine correct?
>>
>>   2) I have well-formed xml file with empty DOCTYPE declaration
>>   <!DOCTYPE rootnodename> and I set ValSchemes::Val_Auto. After
>>   successful scanDTD() we set fHaveSubset = true. And after this
>>   we set fValidate = fHaveSubset, i.e. "true". The same place in
>>   XMLScanner.cpp. So, validation failed.
>>
>>   The same question.
>>
>>   May be I should go to bugzilla?
>>
>>   Thanks before.
>>
>> --
>> Best regards,
>>  Alexey                          mailto:AlexeyM@edifecs.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


TN> ---------------------------------------------------------------------
TN> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
TN> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: ValScheme question

Posted by Tinny Ng <tn...@ca.ibm.com>.
You can use an EntityResolver to redirect the dtd to a dummy dtd.  For an
example on how to use an entity resolver, see the sample "Redirect".

Tinny

Alexey Miroshnichenko wrote:

> Hello Tinny,
>
> Thanks for your answer especially for part II. But can I ask you more?
>
> If I have only xml files and my objective is only test them for be
> well-formed. Some files have doctype decl some haven't. I must do only
> this test. And in general case I have no dtd file. How can I be equal
> to a task?
>
> I think there is nothing bad if parser engine skip reading dtd in this
> case. It may notify me about unparsed entity but it must answer the
> question about well-formnesty.
>
> Can I think in this way?
>
> TN> For question 1):
>
> TN> If a DTD is specified, the parser will always scan it even if the
> TN> validation is off, because DTDs can provide many other information, like
> TN> default attributes and entities, in addition to validation.  So the
> TN> parser behaviour is correct.
>
> TN> For quesiton 2):
>
> TN> Someone has reported a similar problem earlier, and I think this is a
> TN> bug.  With empty DOCTYPE declaration (<!DOCTYPE rootnodename>) and
> TN> ValSchemes::Val_Auto, the fHaveSubset should be false and validation
> TN> should be off.  I have a fix ready, and should be checked in within the
> TN> next few days.
>
> TN> Thanks!
>
> TN> Tinny
>
> TN> Alexey Miroshnichenko wrote:
>
> >> Hi all,
> >>
> >>   Pardon me if I address my problem not correctly. But may be anyone
> >>   can help my with follow questions. I use xerces-c-1_3_0.
> >>
> >>   1) I have well-formed xml file with DOCTYPE declaration but
> >>   corresponding dtd file is absent. I do
> >>
> >>     setValidationScheme(SAXParser::ValSchemes::Val_Never)
> >>
> >>   and I suppose that dtd file do not needed in this case. But I catch
> >>   exception: unnable open dtd file.
> >>   I looked in source. At first we scan dtd file(XMLScanner.cpp,
> >>   scanProlog()), then we set up Validation scheme(XMLScanner.cpp,
> >>   scanDocument()).
> >>
> >>   Is this behaviour of parser engine correct?
> >>
> >>   2) I have well-formed xml file with empty DOCTYPE declaration
> >>   <!DOCTYPE rootnodename> and I set ValSchemes::Val_Auto. After
> >>   successful scanDTD() we set fHaveSubset = true. And after this
> >>   we set fValidate = fHaveSubset, i.e. "true". The same place in
> >>   XMLScanner.cpp. So, validation failed.
> >>
> >>   The same question.
> >>
> >>   May be I should go to bugzilla?
> >>
> >>   Thanks before.
> >>
> >> --
> >> Best regards,
> >>  Alexey                          mailto:AlexeyM@edifecs.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> >> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> TN> ---------------------------------------------------------------------
> TN> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> TN> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org