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 "Zhou Zhu (SH/RDC)" <zh...@ericsson.com> on 2004/01/07 10:05:41 UTC

RE: For Help: how to improve axis then it could solve the problem of " element and attribute are the same name"

Hi:
I've ever tried this case in BeaWeblogic. 
Their schema processor can handle it: if the nested element name is the same with the attribute name,
e,g:
<xs:element name="Administrator" substitutionGroup="cai3g:GetMODefinition">
	..........
	<xs:element name="uid" type="xs:string"/>
	.........
	.........
	<xs:attribute name="uid" type="xs:string" use="required"/>
      ..........
</xs:element>
Then different methods name will be generated like: setUid() and setUid2()

For Axis, then how to fulfill this requirement? means if it is necessary to appear both in "element" and "attribute" of a type?

B.Rs
/zhu zhou





-----Original Message-----
From: Ias [mailto:iasandcb@tmax.co.kr]
Sent: Wednesday, January 07, 2004 3:16 PM
To: 'xuliujuan'
Cc: axis-dev@ws.apache.org
Subject: RE: For Help: how to improve axis then it could solve the
problem of " element and attribute are the same name"


Currently, JAX-RPC 1.1 spec doesn't mention about a possible collision
between a nested element name and an attribute name within a type. Could you
provide your sample WSDL for more testings on other WSDL processors such as
Sun's RI? Perhaps we need to make some policy on how to handle the
collision, for example, showing an appropriate error message. 

In addition, I'd like to share this short note from JAXB 1.0 spec with you:

Good schema-design practices also make collisions less likely. When writing
a schema it is inadvisable to use, in identical roles, names the are
distinguished only by punctuation or case. Suppose a schema declares two
attributes of a single element type, one named Foo and the other named foo.
Their generated access methods, namely getFoo and setFoo, will collide. This
situation would best be handled by revising the source schema, which would
not only eliminate the collision but also improve the readability of the
source schema and documents that use it.

At last, if you're walking with J2EE 1.4, you can utilize JAX-RPC mapping in
order to resolve this trouble. See JSR 109 proposal at
http://nagoya.apache.org/wiki/apachewiki.cgi?JSR109Proposal . Web services
for J2EE is now at an early stage, so you may have to make considerable
amount of efforts to make the technology your own in terms of both
understanding and implementing it. Enterprise Web Services project for Axis
and Geronimo is wide open, and I'm looking forward to its progress supported
by many users.

Regards,

Ias
________________________________

	From: xuliujuan [mailto:xuliujuan@hotmail.com] 
	Sent: Wednesday, January 07, 2004 2:52 PM
	To: iasandcb@tmax.co.kr; yin zhi jun
	Subject: For Help: how to improve axis then it could solve the
problem of " element and attribute are the same name"
	
	
	 
	 
	 Hi ,
	    When the element and attribute have the same name,the axis
generates wrong code. That is to say Axis could not be able to distinguish
the element and attrubute when their name are same. Axis just generate the
same codes for them. eg.
	private axis.TypeOfNetworkType networkType;
	private axis.TypeOfNetworkType networkType; // attribute
	That will cause a lot of error. 
	   Could you tell me how to improve it?
	 There is an xsd example :
	<xs:element name="Administrator"
substitutionGroup="cai3g:GetMODefinition">
	..........
	<xs:element name="uid" type="xs:string"/>
	.........
	</xs:element>
	</xs:sequence>
	<xs:attribute name="uid" type="xs:string" use="required"/>
	</xs:extension>
	</xs:complexContent>
	</xs:complexType>
	</xs:element>
	  Any hints? Thank you very much in advance.
	Best wishes.
	/XuLiujuan