You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Davanum Srinivas <di...@yahoo.com> on 2003/09/13 15:46:40 UTC
Re: [PATCH] javax.xml.namespace.QName version 1.1
Patched. Thanks Ias.
-- dims
--- Ias <ia...@apache-korea.org> wrote:
> The latest QName in Axis CVS Head is behind that of J2EE 1.4, JWSDP 1.2 and
> J2ME Web Services. The major change is adding prefix field to its
> constructor. In addition, handling null local part (and prefix) is slightly
> modified to follow the new description from
> http://java.sun.com/j2ee/1.4/docs/api/javax/xml/namespace/QName.html and
> http://java.sun.com/webservices/docs/1.2/api/javax/xml/namespace/QName.html.
>
> Thanks,
>
> Ias
>
> =========================================================
> Lee, Changshin (Korean name)
> Ias (International name)
> Company Web Site: http://www.tmax.co.kr
> Personal Web Site: http://www.iasandcb.pe.kr
> ---------------------------------------------------------
> Senior Researcher, Emerging Technology Evangelist
> JCP member - http://jcp.org/en/participation/members/L
> R&D Institute
> Tmax Soft, Inc.
> JCP member - http://jcp.org/en/participation/members/T
> =========================================================
> > Index: QName.java
> ===================================================================
> RCS file: /home/cvspublic/xml-axis/java/src/javax/xml/namespace/QName.java,v
> retrieving revision 1.8
> diff -u -r1.8 QName.java
> --- QName.java 22 Apr 2003 19:33:47 -0000 1.8
> +++ QName.java 13 Sep 2003 02:29:48 -0000
> @@ -63,11 +63,11 @@
> * as specified in <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML
> * Schema Part2: Datatypes specification</a>.
> * <p>
> - * The value of a QName contains a <b>namespaceURI</b> and a <b>localPart</b>.
> + * The value of a QName contains a <b>namespaceURI</b>, a <b>localPart</b> and a <b>prefix</b>.
> * The localPart provides the local part of the qualified name. The
> * namespaceURI is a URI reference identifying the namespace.
> *
> - * @version 1.0
> + * @version 1.1
> */
> public class QName implements Serializable {
>
> @@ -80,17 +80,16 @@
> /** Field localPart */
> private String localPart;
>
> + /** Field prefix */
> + private String prefix;
> +
> /**
> * Constructor for the QName.
> *
> * @param localPart Local part of the QName
> */
> public QName(String localPart) {
> -
> - this.namespaceURI = emptyString;
> - this.localPart = (localPart == null)
> - ? emptyString
> - : localPart.intern();
> + this("", localPart, "");
> }
>
> /**
> @@ -100,15 +99,33 @@
> * @param localPart Local part of the QName.
> */
> public QName(String namespaceURI, String localPart) {
> -
> - this.namespaceURI = (namespaceURI == null)
> - ? emptyString
> - : namespaceURI.intern();
> - this.localPart = (localPart == null)
> - ? emptyString
> - : localPart.intern();
> + this(namespaceURI, localPart, "");
> }
>
> + /**
> + * Constructor for the QName.
> + *
> + * @param namespaceURI Namespace URI for the QName
> + * @param localPart Local part of the QName.
> + * @param prefix Prefix of the QName.
> + */
> + public QName(String namespaceURI, String localPart, String prefix) {
> + this.namespaceURI = (namespaceURI == null)
> + ? emptyString
> + : namespaceURI.intern();
> + if (localPart == null) {
> + throw new IllegalArgumentException("invalid QName local part");
> + } else {
> + this.localPart = localPart;
> + }
> +
> + if (prefix == null) {
> + throw new IllegalArgumentException("invalid QName prefix");
> + } else {
> + this.prefix = prefix;
> + }
> + }
> +
> /**
> * Gets the Namespace URI for this QName
> *
> @@ -127,6 +144,15 @@
> return localPart;
> }
>
> + /**
> + * Gets the Prefix for this QName
> + *
> + * @return Prefix
> + */
> + public String getPrefix() {
> + return prefix;
> + }
> +
> /**
> * Returns a string representation of this QName
> *
> @@ -238,5 +264,6 @@
>
> namespaceURI = namespaceURI.intern();
> localPart = localPart.intern();
> + prefix = prefix.intern();
> }
> }
>
=====
Davanum Srinivas - http://webservices.apache.org/~dims/