You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Chris Greenlee <CG...@demandsolutions.com> on 2000/10/12 17:22:52 UTC

RE: schema question: duplicate element declaration

I'm rather new to this, so I may be wrong, but I think you'll have to do it
this way:

	<element name="mode" type="modeType"/>

	<complexType name="modeType">
		<choice>
			<element name="intVal" type="string"/>
			<element name="stringVal" type="int"/>
		</choice>
	</complexType>

Then your xml would be:

	<part1>
		<mode><intVal>5</intVal></mode>
	</part1>
	<part2>
		<mode><stringVal>abc</stringVal></mode>
	</part2>

Is that what you were looking for?

Chris Greenlee.

-----Original Message-----
I have in my xml several elements called "mode" which contain different
values(integer,string,limited set of numbers...) under different parents
like this:
<part1> 
        <mode>5</mode> 
</part1> 
<part2> 
        <mode>abc</mode> 
</part2> 
i have a schema defined for the xml, without namespaces which defines these
"mode" elements 
like such: (in the respective places) 
<element name="mode" type="modeType1"/> 
<element name="mode" type="modeType2"/> 
while parsing i get the validation error: 
        Schema error: duplicate element decl in the same scope : mode 
how can i do this ? 
thankyou, 
Lior Shapira 
Software Engineer 
eCommony Inc. 
lior@ecommony.com 
+972 (3) 6122451 
http://www.ecommony.com