commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmi...@apache.org
Subject cvs commit: jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri QName.java
Date Sun, 13 Oct 2002 02:25:36 GMT
dmitri      2002/10/12 19:25:36

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri QName.java
  Log:
  Added a constructor that takes a qualified name
  
  Revision  Changes    Path
  1.4       +23 -6     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/QName.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- QName.java	16 Jun 2002 03:22:21 -0000	1.3
  +++ QName.java	13 Oct 2002 02:25:36 -0000	1.4
  @@ -61,6 +61,8 @@
    */
   package org.apache.commons.jxpath.ri;
   
  +import org.apache.commons.jxpath.JXPathException;
  +
   /**
    * A qualified name: a combination of an optional namespace prefix
    * and an local name.
  @@ -72,9 +74,24 @@
       private String prefix;
       private String name;
   
  -    public QName(String prefix, String name){
  +    public QName(String qualifiedName){
  +        int index = qualifiedName.indexOf(':');
  +        if (index == -1){
  +            prefix = null;
  +            name = qualifiedName;
  +        }
  +        else {
  +            prefix = qualifiedName.substring(0, index);
  +            name = qualifiedName.substring(index + 1);
  +        }
  +    }
  +
  +    public QName(String prefix, String localName){
  +        if (localName.indexOf(':') != -1){
  +            throw new JXPathException("The 'localName' part of a QName cannot contain colons");
  +        }
           this.prefix = prefix;
  -        this.name = name;
  +        this.name = localName;
       }
   
       public String getPrefix(){
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message