> when only one child is passed in (eg x) the SimpleContentModel returns 1
> (a valid state) regardless of whether not x is valid.

No. -1 is a valid state; anything else (including 1) isn't.

Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]



                                                                                       
                                         
                      Justin Lipton                                                    
                                         
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                                
                      .au>                     cc:                                     
                                         
                                               Subject:  Patch for 
org.apache.xerces.impl.dtd.models.SimpleContentModel         
                      02/24/2003 12:12                                                 
                                         
                      AM                                                               
                                         
                      Please respond to                                                
                                         
                      xerces-j-dev                                                     
                                         
                                                                                       
                                         
                                                                                       
                                         



Hi,

I just found a bug in the SimpleContentModel class - looks like it had
been lurking for a while.
The bug rears it's head when attempting to check the allowable content
for the following simple content scenario:

a, b

when only one child is passed in (eg x) the SimpleContentModel returns 1
(a valid state) regardless of whether not x is valid.

Here's a patch that should work:

@@ -297,7 +297,11 @@
                      }
                  }
                  else {
-                    if (length > 2) {
+                    if (length == 1) {
+                        if (children[offset].rawname !=
fFirstChild.rawname) {
+                            return 0;
+                        }
+                    } else if (length > 2) {
                          return 2;
                      }

Cheers,
Justin.



---------------------------------------------------------------------
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]

Reply via email to