From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 09, 2005 5:27 PM
To: [email protected]
Subject: Re: Any Type Problem!! Please Read.
There are some issues with your complex type definition:
1. You have a <choice> group with no choice.
2. You don't define a datatype for the <delimiter> element. (Therefore it defaults to xsd:anyType.)
3. If your intention is to add an attribute to a simpleType then you need to define it as an extension.
Assuming that you want the contents of <delimiter> to be xsd:anyType, then I think you want to define it like so:
<xsd:complexType name="PN.Cerner">If instead you want the contents of <delimiter> to be a defined type, like xsd:string, then specify that type in the "base" attribute, e.g.:
<xsd:sequence>
<xsd:element name="id" type="ll" minOccurs="0" maxOccurs="1"/>
<xsd:element name="delimiter" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:anyType">
<xsd:attribute name="type" type="cs_PersonNamePartType" fixed="DEL"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="validTime" type="IVL_TS" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:extension base="xsd:string">
Anne
Hi Everyone,
I have a data type call PNCerner, which is as following:
<xsd:complexType name="PN.Cerner" mixed="true">
<xsd:sequence>
<xsd:element name="id" type="II" minOccurs="0" maxOccurs="1"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="delimiter">
<xsd:complexType mixed="true">
<xsd:attribute name="type" type="cs_PersonNamePartType" fixed="DEL"/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
<xsd:element name="validTime" type="IVL_TS" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>which translet into axis generated code as a PNCerner class, then it creates a PNCernerDelimiter. The problem I have is in PNCernerDelimiter, here is the generated code, and the problem that I have is that during the runtime when the xml is send thought the stream it added a extra black tag in front of value, I am setting the values in _any[0].setValue("Pratik"), below is what I get as xml for it <delimiter type="DEL"><>Pratik</></delimiter> and I want it to be <delimiter type="DEL">Pratik</delimiter>. How do I fix it???????
public class PNCernerDelimiter implements java.io.Serializable, org.apache.axis.encoding.MixedContentType {
private org.apache.axis.message.MessageElement [] _any; // attributeprivate org.apache.axis.types.Token type; // attribute
public PNCernerDelimiter() {
}public PNCernerDelimiter(
org.apache.axis.message.MessageElement [] _any,
org.apache.axis.types.Token type) {
this._any = _any;
this.type = type;
}
/**
* Gets the _any value for this PNCernerDelimiter.
*
* @return _any
*/
public org.apache.axis.message.MessageElement [] get_any() {
return _any;
}
/**
* Sets the _any value for this PNCernerDelimiter.
*
* @param _any
*/
public void set_any(org.apache.axis.message.MessageElement [] _any) {
this._any = _any;
}
/**
* Gets the type value for this PNCernerDelimiter.
*
* @return type
*/
public org.apache.axis.types.Token getType() {
return type;
}
/**
* Sets the type value for this PNCernerDelimiter.
*
* @param type
*/
public void setType(org.apache.axis.types.Token type) {
this.type = type;
}private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof PNCernerDelimiter)) return false;
PNCernerDelimiter other = (PNCernerDelimiter) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this._any==null && other.get_any()==null) ||
(this._any!=null &&
java.util.Arrays.equals(this._any, other.get_any()))) &&
((this.type==null && other.getType()==null) ||
(this.type!=null &&
this.type.equals(other.getType())));
__equalsCalc = null;
return _equals;
}private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (get_any() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(get_any());
i++) {
java.lang.Object obj = java.lang.reflect.Array.get(get_any(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
if (getType() != null) {
_hashCode += getType().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(PNCernerDelimiter.class, true);static {
typeDesc.setXmlType(new javax.xml.namespace.QName("urn:hl7-org:v3", ">PN.Cerner>delimiter"));
org.apache.axis.description.AttributeDesc attrField = new org.apache.axis.description.AttributeDesc();
attrField.setFieldName("type");
attrField.setXmlName(new javax.xml.namespace.QName("", "type"));
attrField.setXmlType(new javax.xml.namespace.QName("urn:hl7-org:v3", "cs_PersonNamePartType"));
typeDesc.addFieldDesc(attrField);
}/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}}
Parikh, Pratik
CONFIDENTIALITY NOTICE
This message and any included attachments
are from Cerner Corporation and are intended
only for the addressee. The information
contained in this message is confidential and
may constitute inside or non-public information
under international, federal, or state
securities laws. Unauthorized forwarding,
printing, copying, distribution, or use of such
information is strictly prohibited and may be
unlawful. If you are not the addressee, please
promptly delete this message and notify the
sender of the delivery error by e-mail or you
may call Cerner's corporate offices in Kansas
City, Missouri, U.S.A at (+1) (816)221-1024.
---------------------------------------- --
