You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mr...@apache.org on 2004/03/03 22:24:15 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/parsers AbstractSAXParser.java

mrglavas    2004/03/03 13:24:15

  Modified:    java/src/org/apache/xerces/parsers AbstractSAXParser.java
  Log:
  In anticipation of SAX2 extensions 1.1, implement the
  isDeclared and isSpecified methods of Attributes2
  on AttributesProxy.
  
  Revision  Changes    Path
  1.51      +55 -1     xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java
  
  Index: AbstractSAXParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractSAXParser.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- AbstractSAXParser.java	27 Feb 2004 20:36:06 -0000	1.50
  +++ AbstractSAXParser.java	3 Mar 2004 21:24:15 -0000	1.51
  @@ -2062,6 +2062,60 @@
               return uri.equals("") ? fAttributes.getIndex(null, localPart) :
                                       fAttributes.getIndex(uri, localPart);
           }
  +        
  +        // Attributes2 methods
  +        // REVISIT: Localize exception messages. -- mrglavas
  +        public boolean isDeclared(int index) {
  +            if (index < 0 || index >= fAttributes.getLength()) {
  +                throw new ArrayIndexOutOfBoundsException(index);
  +            }
  +            return Boolean.TRUE.equals(
  +                fAttributes.getAugmentations(index).getItem(
  +                Constants.ATTRIBUTE_DECLARED));
  +        }
  +        
  +        public boolean isDeclared(String qName) {
  +            int index = getIndex(qName);
  +            if (index == -1) {
  +                throw new IllegalArgumentException(qName);
  +            }
  +            return Boolean.TRUE.equals(
  +                fAttributes.getAugmentations(index).getItem(
  +                Constants.ATTRIBUTE_DECLARED));
  +        }
  +		
  +        public boolean isDeclared(String uri, String localName) {
  +            int index = getIndex(uri, localName);
  +            if (index == -1) {
  +                throw new IllegalArgumentException(localName);
  +            }
  +            return Boolean.TRUE.equals(
  +                fAttributes.getAugmentations(index).getItem(
  +                Constants.ATTRIBUTE_DECLARED));
  +        }
  +                
  +        public boolean isSpecified(int index) {
  +            if (index < 0 || index >= fAttributes.getLength()) {
  +                throw new ArrayIndexOutOfBoundsException(index);
  +            }
  +            return fAttributes.isSpecified(index);
  +        }
  +        
  +        public boolean isSpecified(String qName) {
  +            int index = getIndex(qName);
  +            if (index == -1) {
  +                throw new IllegalArgumentException(qName);
  +            }
  +            return fAttributes.isSpecified(index);
  +        }
  +        
  +        public boolean isSpecified(String uri, String localName) {
  +            int index = getIndex(uri, localName);
  +            if (index == -1) {
  +                throw new IllegalArgumentException(localName);
  +            }
  +            return fAttributes.isSpecified(index);
  +        }
   
       } // class AttributesProxy
   
  
  
  

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