You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by gd...@locus.apache.org on 2000/09/04 23:19:25 UTC

cvs commit: xml-soap/java/src/org/apache/soap/util/xml QName.java

gdaniels    00/09/04 14:19:25

  Modified:    java/src/org/apache/soap/util/xml QName.java
  Log:
  Add a constructor which takes a QName string.  This enables us to
  serialize/deserialize QNames with the base-type code in SOAPMappingRegistry.
  
  Revision  Changes    Path
  1.3       +28 -0     xml-soap/java/src/org/apache/soap/util/xml/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/util/xml/QName.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QName.java	2000/05/30 10:24:44	1.2
  +++ QName.java	2000/09/04 21:19:24	1.3
  @@ -102,6 +102,34 @@
       setNamespaceURI(namespaceURI);
       setLocalPart(localPart);
     }
  +  
  +  public QName(String strQName)
  +  {
  +	if (strQName == null) {
  +		setLocalPart(null);
  +		setNamespaceURI(null);
  +		return;
  +	}
  +	
  +	int idx = strQName.indexOf(":");
  +
  +	String namespaceURI;
  +	if (idx <= 0) {
  +		namespaceURI = "";  // "", or null?
  +	} else {
  +		namespaceURI = strQName.substring(0, idx);
  +	}
  +	setNamespaceURI(namespaceURI);
  +	idx++;
  +	
  +	String localPart;
  +	if (idx == strQName.length()) {
  +		localPart = "";
  +	} else {
  +		localPart = strQName.substring(idx);
  +	}
  +	setLocalPart(localPart);
  +  }
   
     public void setNamespaceURI(String namespaceURI)
     {