You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Neeraj Bajaj <Ne...@Sun.COM> on 2001/08/22 18:22:23 UTC

[xerces2] patch for bug 3191

hi,
	
	i am submitting a patch for bug 3191.
	
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3191
	
+ +============================================================================+
+ | Setting namespaces in the DTD through FIXED attributes not working         |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 3191                        Product: Xerces2-J               |
+ |       Status: NEW                         Version: 2.0.0 [beta]            |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Windows NT/2K           |
+ |     Priority: Other                     Component: SAX                     |
+ +----------------------------------------------------------------------------+

changes are done in these two methods:
		
1. DTDGrammar:attributedecl(...)

same value was set for the "rawname" and "localpart" of QName in Grammar 
structure.When we retreive the value from Grammar structure
to be later stored in (String [] fNameSpace , field of NamespaceSupport) as 
prefix, URI combination.  
Prefix value stored is "xmlns:xlink" rather than "xlink" 'cause of above reason.

2. NamespaceSupport:getUri(String prefix)

changed the  string equality comparison in this method 
from 	
            if (fNamespace[i - 2] == prefix) 
to            
	if (fNamespace[i - 2].equals(prefix)). 
	
	
Changed lines can be searched by finding string "3191". My changes are 
_enclosed_ like this 

	  //CHANGED :3191
	  ...patch
	  ...patch
	  //CHANGED :3191
	  

	  
I am attatching two files "DTDGrammar" and "NamespaceSupport". Please let me 
know  if patch is right. 
	
Neeraj Bajaj
---------------------
Sun Microsystems, inc.
Ph.91-80-2298989 x87425.


Re: [xerces2] patch for bug 3191

Posted by Andy Clark <an...@apache.org>.
I've confirmed the bug -- interestingly, it's only a problem
when you have namespace prefixes. Using the default prefix
doesn't cause the problem. I'll look at fixing this bug
first thing tomorrow before I start working on the next beta
release.

My first guess is that the problem really lies in the 
XMLDTDValidator and not in the DTDGrammar because it's when
the validator adds the default attributes to the tags that
appear in the document.

Neeraj Bajaj wrote:
>                              Name: DTDGrammar.java
>                              Type: application/x-unknown-content-type-java_auto_file
>    DTDGrammar.java       Encoding: BASE64
>                       Description: DTDGrammar.java
>                   Download Status: Not downloaded with message

In the future, only attach the "cvs diff" files for your
changes. That makes it easier to merge the changes and
commit the code.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

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


Re: [xerces2] patch for bug 3191

Posted by Andy Clark <an...@apache.org>.
Neeraj Bajaj wrote:
>         i am submitting a patch for bug 3191.

I don't have time at the moment to look at this patch. I'll
look at it more in depth once I'm done with a few things
first.

> 2. NamespaceSupport:getUri(String prefix)
> 
> changed the  string equality comparison in this method
> from
>             if (fNamespace[i - 2] == prefix)
> to
>         if (fNamespace[i - 2].equals(prefix)).

However, this change looks like it should be rejected. In
Xerces2, the standard components rely on a SymbolTable to
re-use the same String object reference for lexically
equivalent strings that are commonly used. Since element
QNames, attribute QNames, and namespace URIs are symbols,
we are guaranteed to be able to do a reference comparison.

Therefore, we don't need to waste time calling the equals
method. If it *doesn't* work even though the strings are
indeed lexically equivalent, then we need to track down
the source of the problem in the components and not just
cover up the problem in the NamespaceSupport class.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

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


Re: [xerces2] patch for bug 3191

Posted by Andy Clark <an...@apache.org>.
I just fixed this bug and will move the Bugzilla state to FIXED.

The resolution was pretty easy: when namespace processing was
on, I just needed to figure out the prefix and localpart for
any default attribute added to an element within the 
XMLDTDValidator. The changes to the DTDGrammar and Namespace-
Support classes submitted weren't required.

-- 
Andy Clark * IBM, TRL - Japan * andyc@apache.org

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