You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Anthony Dodd <An...@synergy-fs.com> on 2000/08/09 10:45:13 UTC

Bug - Xerces 1.1.3 XMLValidator.switchGrammar() incomplete error handling

Hi

	I'm using Xerces 1.1.3 and the DOMParser with defauilt features
which I believe sets the parser to a non validating one. I'm consistently
getting the following message being sent to System.out

	<namespace> grammar not found

	I've traced it down to some incomplete code in XMLValidator's
switchGrammar function. The attached code clearly shows some unfinished
error handling,  

		    private void switchGrammar(int newGrammarNameSpaceIndex)
{
		        Grammar tempGrammar =
fGrammarResolver.getGrammar(fStringPool.toString(newGrammarNameSpaceIndex));
		        if (tempGrammar == null) {
		            // Assume that this is a case were namespaces
are being
		            // used with a DTD grammar.
		            tempGrammar = fGrammarResolver.getGrammar("");
		            //System.out.println("XMLValidator:
tempGrammar="+tempGrammar);
		        }
		        if (tempGrammar == null) {
	
System.out.println(fStringPool.toString(newGrammarNameSpaceIndex) + "
grammar not found");
		            //TO DO report error here
		        }
		        else {
		            fGrammar = tempGrammar;
		            if (fGrammar instanceof DTDGrammar) {
		                fGrammarIsDTDGrammar = true;
		                fGrammarIsSchemaGrammar = false;
		            }
		            else if ( fGrammar instanceof SchemaGrammar ) {
		                fGrammarIsSchemaGrammar = true;
		                fGrammarIsDTDGrammar = false;
		            }
		        }
		    }

		is there any chance some one can resolve this, and post the
fix somewhere so that I can pick it up. Also is there anybody who can
explain why the parser is checking for grammar when I'm assuming I've not
asked it to. 

		Regards
		Anthony Dodd

Re: Bug - Xerces 1.1.3 XMLValidator.switchGrammar() incomplete error handling

Posted by Eric Ye <er...@locus.apache.org>.
Yeh, that is a bug in the XMLValidator, but somewhere else, still, it is no
good to use System.out.println(...) in switchGrammar method,
Thanks for reporting this, I'll fix this right way, the changes will be
checked in to CVS repository.
_____


Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org

----- Original Message -----
From: "Anthony Dodd" <An...@synergy-fs.com>
To: <ge...@xml.apache.org>
Sent: Wednesday, August 09, 2000 1:45 AM
Subject: Bug - Xerces 1.1.3 XMLValidator.switchGrammar() incomplete error
handling


> Hi
>
> I'm using Xerces 1.1.3 and the DOMParser with defauilt features
> which I believe sets the parser to a non validating one. I'm consistently
> getting the following message being sent to System.out
>
> <namespace> grammar not found
>
> I've traced it down to some incomplete code in XMLValidator's
> switchGrammar function. The attached code clearly shows some unfinished
> error handling,
>
>     private void switchGrammar(int newGrammarNameSpaceIndex)
> {
>         Grammar tempGrammar =
>
fGrammarResolver.getGrammar(fStringPool.toString(newGrammarNameSpaceIndex));
>         if (tempGrammar == null) {
>             // Assume that this is a case were namespaces
> are being
>             // used with a DTD grammar.
>             tempGrammar = fGrammarResolver.getGrammar("");
>             file://System.out.println("XMLValidator:
> tempGrammar="+tempGrammar);
>         }
>         if (tempGrammar == null) {
>
> System.out.println(fStringPool.toString(newGrammarNameSpaceIndex) + "
> grammar not found");
>             file://TO DO report error here
>         }
>         else {
>             fGrammar = tempGrammar;
>             if (fGrammar instanceof DTDGrammar) {
>                 fGrammarIsDTDGrammar = true;
>                 fGrammarIsSchemaGrammar = false;
>             }
>             else if ( fGrammar instanceof SchemaGrammar ) {
>                 fGrammarIsSchemaGrammar = true;
>                 fGrammarIsDTDGrammar = false;
>             }
>         }
>     }
>
> is there any chance some one can resolve this, and post the
> fix somewhere so that I can pick it up. Also is there anybody who can
> explain why the parser is checking for grammar when I'm assuming I've not
> asked it to.
>
> Regards
> Anthony Dodd
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
>