You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/12/06 06:31:49 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/utils QName.java

sboag       00/12/05 21:31:49

  Modified:    java/src/org/apache/xml/utils QName.java
  Log:
  Added toNamespacedString(), and changed
  string representation to use curly
  bracket syntax for namespaces.  toString
  will use prefix if it can, while toNamespacedString()
  always uses curly namespace.
  
  Revision  Changes    Path
  1.5       +18 -2     xml-xalan/java/src/org/apache/xml/utils/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/QName.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- QName.java	2000/11/30 22:58:52	1.4
  +++ QName.java	2000/12/06 05:31:49	1.5
  @@ -363,7 +363,8 @@
     }
   
     /**
  -   * Return the string representation of the namespace. Performs
  +   * Return the string representation of the qualified name, using the 
  +   * prefix if available, or the '{ns}foo' notation if not. Performs
      * string concatenation, so beware of performance issues.
      *
      * @return the string representation of the namespace
  @@ -374,8 +375,23 @@
       return _prefix != null
              ? (_prefix + ":" + _localName)
              : (_namespaceURI != null
  -              ? (_namespaceURI + "^" + _localName) : _localName);
  +              ? ("{"+_namespaceURI + "}" + _localName) : _localName);
     }
  +  
  +  /**
  +   * Return the string representation of the qualified name using the 
  +   * the '{ns}foo' notation. Performs
  +   * string concatenation, so beware of performance issues.
  +   *
  +   * @return the string representation of the namespace
  +   */
  +  public String toNamespacedString()
  +  {
  +
  +    return (_namespaceURI != null
  +              ? ("{"+_namespaceURI + "}" + _localName) : _localName);
  +  }
  +
   
     /**
      * Get the namespace of the qualified name.