neilg 2003/07/24 08:14:43 Modified: java/src/org/apache/xerces/impl/xs/opti ElementImpl.java java/src/org/apache/xerces/impl/xs/traversers XSDAbstractTraverser.java XSAttributeChecker.java java/src/org/apache/xerces/impl/xs/psvi XSWildcard.java java/src/org/apache/xerces/impl/xs XSWildcardDecl.java java/src/org/apache/xerces/impl/xs/util StringListImpl.java Log: fixes for various small bugs (potential NPEs, problems in certain situations with well-formedness of annotation strings) in our PSVI/schema component model support. Patches by Peter McCracken. Revision Changes Path 1.5 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/xs/opti/ElementImpl.java Index: ElementImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/opti/ElementImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ElementImpl.java 3 Jul 2003 15:15:58 -0000 1.4 +++ ElementImpl.java 24 Jul 2003 15:14:42 -0000 1.5 @@ -210,7 +210,7 @@ public String getAttributeNS(String namespaceURI, String localName) { for (int i=0; i<attrs.length; i++) { - if (attrs[i].getName().equals(localName) && attrs[i].getNamespaceURI().equals(namespaceURI)) { + if (attrs[i].getLocalName().equals(localName) && attrs[i].getNamespaceURI().equals(namespaceURI)) { return attrs[i].getValue(); } } 1.32 +19 -4 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java Index: XSDAbstractTraverser.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- XSDAbstractTraverser.java 23 Jul 2003 18:19:02 -0000 1.31 +++ XSDAbstractTraverser.java 24 Jul 2003 15:14:43 -0000 1.32 @@ -182,15 +182,30 @@ // Vector should contain rawname value pairs int i=0; while(i<annotationLocalAttrs.size()) { - localStrBuffer.append((String)annotationLocalAttrs.elementAt(i++)) + String rawname = (String)annotationLocalAttrs.elementAt(i++); + int colonIndex = rawname.indexOf(':'); + String prefix, localpart; + if (colonIndex == -1) { + prefix = ""; + localpart = rawname; + } + else { + prefix = rawname.substring(0,colonIndex); + localpart = rawname.substring(colonIndex+1); + } + String uri = schemaDoc.fNamespaceSupport.getURI(prefix.intern()); + if (!annotationDecl.getAttributeNS(uri, localpart).equals("")) { + i++; // skip the next value, too + continue; + } + localStrBuffer.append(rawname) .append("=\""); String value = (String)annotationLocalAttrs.elementAt(i++); // search for pesky "s and >s within attr value: value = processAttValue(value); localStrBuffer.append(value) - .append("\""); + .append("\" "); } - localStrBuffer.append(" "); // and now splice it into place; immediately after the annotation token, for simplicity's sake StringBuffer contentBuffer = new StringBuffer(contents.length() + localStrBuffer.length()); int annotationTokenEnd = contents.indexOf(SchemaSymbols.ELT_ANNOTATION); 1.26 +6 -1 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java Index: XSAttributeChecker.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSAttributeChecker.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- XSAttributeChecker.java 18 Jun 2003 15:16:52 -0000 1.25 +++ XSAttributeChecker.java 24 Jul 2003 15:14:43 -0000 1.26 @@ -1108,6 +1108,11 @@ String attrName = sattr.getName(); String attrVal = DOMUtil.getValue(sattr); + // we don't want to add namespace declarations to the non-schema attributes + if (attrName.startsWith("xmlns")) { + continue; + } + // skip anything starts with x/X m/M l/L // add this to the list of "non-schema" attributes if (attrName.toLowerCase(Locale.ENGLISH).startsWith("xml")) { 1.6 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/xs/psvi/XSWildcard.java Index: XSWildcard.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/psvi/XSWildcard.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- XSWildcard.java 20 Feb 2003 23:10:41 -0000 1.5 +++ XSWildcard.java 24 Jul 2003 15:14:43 -0000 1.6 @@ -2,7 +2,7 @@ * The Apache Software License, Version 1.1 * * - * Copyright (c) 2001, 2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,7 +109,7 @@ /** * [process contents]: one of skip, lax or strict. Valid constants values - * are: <code>SKIP_PROCESS, LAX_PROCESS, STRING_PROCESS </code>. + * are: <code>PC_SKIP, PC_LAX, PC_STRICT</code>. */ public short getProcessContents(); 1.14 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/xs/XSWildcardDecl.java Index: XSWildcardDecl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSWildcardDecl.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- XSWildcardDecl.java 23 Jun 2003 16:35:21 -0000 1.13 +++ XSWildcardDecl.java 24 Jul 2003 15:14:43 -0000 1.14 @@ -585,7 +585,7 @@ * disallowed namespaces. */ public StringList getNsConstraintList() { - return new StringListImpl(fNamespaceList, fNamespaceList.length); + return new StringListImpl(fNamespaceList, fNamespaceList == null ? 0 : fNamespaceList.length); } /** 1.3 +3 -3 xml-xerces/java/src/org/apache/xerces/impl/xs/util/StringListImpl.java Index: StringListImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/util/StringListImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- StringListImpl.java 14 Jan 2003 20:21:48 -0000 1.2 +++ StringListImpl.java 24 Jul 2003 15:14:43 -0000 1.3 @@ -2,7 +2,7 @@ * The Apache Software License, Version 1.1 * * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002,2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -79,7 +79,7 @@ public StringListImpl(Vector v) { fVector = v; - fLength = v.size(); + fLength = (v == null) ? 0 : v.size(); } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]