mrglavas 2004/11/04 12:24:28 Modified: java/src/org/apache/xerces/dom AttrNSImpl.java Log: DOM Level 3 specifies an attribute called strictErrorChecking [1] which when set to false allows an implementation to not test every possible error case. Reducing the amount of checking performed when strictErrorChecking is false. This patch is thanks to Naela Nissar. [1] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Document3-strictErrorChecking Revision Changes Path 1.47 +34 -34 xml-xerces/java/src/org/apache/xerces/dom/AttrNSImpl.java Index: AttrNSImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/AttrNSImpl.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- AttrNSImpl.java 5 Oct 2004 17:12:51 -0000 1.46 +++ AttrNSImpl.java 4 Nov 2004 20:24:28 -0000 1.47 @@ -75,42 +75,42 @@ } private void setName(String namespaceURI, String qname){ - + CoreDocumentImpl ownerDocument = ownerDocument(); String prefix; - // DOM Level 3: namespace URI is never empty string. + // DOM Level 3: namespace URI is never empty string. this.namespaceURI = namespaceURI; if (namespaceURI !=null) { - this.namespaceURI = (namespaceURI.length() == 0)? null - : namespaceURI; - - } - int colon1 = qname.indexOf(':'); - int colon2 = qname.lastIndexOf(':'); - ownerDocument().checkNamespaceWF(qname, colon1, colon2); - if (colon1 < 0) { - // there is no prefix - localName = qname; - ownerDocument().checkQName(null, localName); - if (ownerDocument().errorChecking) { - if (qname.equals("xmlns") - && (namespaceURI == null - || !namespaceURI.equals(NamespaceContext.XMLNS_URI)) - || (namespaceURI!=null && namespaceURI.equals(NamespaceContext.XMLNS_URI) - && !qname.equals("xmlns"))) { - String msg = - DOMMessageFormatter.formatMessage( - DOMMessageFormatter.DOM_DOMAIN, - "NAMESPACE_ERR", - null); - throw new DOMException(DOMException.NAMESPACE_ERR, msg); - } - } - } - else { - prefix = qname.substring(0, colon1); - localName = qname.substring(colon2+1); - ownerDocument().checkQName(prefix, localName); - ownerDocument().checkDOMNSErr(prefix, namespaceURI); + this.namespaceURI = (namespaceURI.length() == 0)? null + : namespaceURI; + + } + int colon1 = qname.indexOf(':'); + int colon2 = qname.lastIndexOf(':'); + ownerDocument.checkNamespaceWF(qname, colon1, colon2); + if (colon1 < 0) { + // there is no prefix + localName = qname; + if (ownerDocument.errorChecking) { + ownerDocument.checkQName(null, localName); + + if (qname.equals("xmlns") && (namespaceURI == null + || !namespaceURI.equals(NamespaceContext.XMLNS_URI)) + || (namespaceURI!=null && namespaceURI.equals(NamespaceContext.XMLNS_URI) + && !qname.equals("xmlns"))) { + String msg = + DOMMessageFormatter.formatMessage( + DOMMessageFormatter.DOM_DOMAIN, + "NAMESPACE_ERR", + null); + throw new DOMException(DOMException.NAMESPACE_ERR, msg); + } + } + } + else { + prefix = qname.substring(0, colon1); + localName = qname.substring(colon2+1); + ownerDocument.checkQName(prefix, localName); + ownerDocument.checkDOMNSErr(prefix, namespaceURI); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]