[saxdotnet-notify] [PATCH] Problem with SaxDriver
Brought to you by:
jeffrafter,
kwaclaw
From: Geoff C. <gc...@gm...> - 2004-11-03 22:39:55
|
I'm having a problem with SaxDriver.declarePrefix. If an Element is of the form <xmlns="" ...> I get an exception thrown because the uri parameter is null. The following patch fixes the problem, although I'm not sure if it is the correct solution. -geoff Index: SaxDriver.cs =================================================================== RCS file: /cvsroot/saxdotnet/AElfred/SaxDriver.cs,v retrieving revision 1.7 diff -u -r1.7 SaxDriver.cs --- SaxDriver.cs 21 Oct 2004 18:12:03 -0000 1.7 +++ SaxDriver.cs 3 Nov 2004 22:38:09 -0000 @@ -719,16 +719,21 @@ } private void declarePrefix(string prefix, string uri) { - int index = uri.IndexOf(':'); - - // many versions of nwalsh docbook stylesheets - // have bogus URLs; so this can't be an error... - if(index < 1 && uri.Length != 0) - warn("relative URI for namespace: " + uri); - + if (uri != null) + { + int index = uri.IndexOf(':'); + + // many versions of nwalsh docbook stylesheets + // have bogus URLs; so this can't be an error... + if(index < 1 && uri.Length != 0) + warn("relative URI for namespace: " + uri); + } // FIXME: char [0] must be ascii alpha; chars [1..index] // must be ascii alphanumeric or in "+-." [RFC 2396] - uri = string.Intern(uri); + if (uri != null) + { + uri = string.Intern(uri); + } prefixStack.AddMapping(prefix, uri); contentHandler.StartPrefixMapping(prefix, uri); } |