Re: Can you have 2 local elements with the same name?

Hi David,

> Is this valid?
>
> I looked it up in the spec and I think it said the duplicate name
> validation only applies to global types / elements.

Yes, what you have is valid. However, you have to make sure that two
elements with the same name in the same content model have the same
type, so it wouldn't be valid if the first Post_Transaction had type
xs:string and the second had type xs:date, for example.

This comes from
http://www.w3.org/TR/xmlschema-1/#cos-element-consistent:

  Schema Component Constraint: Element Declarations Consistent

  If the {particles} contains, either directly, indirectly (that is,
  within the {particles} of a contained model group, recursively) or
  ·implicitly· two or more element declaration particles with the same
  {name} and {target namespace}, then all their type definitions must
  be the same top-level definition, that is, all of the following must
  be true:

  1 all their {type definition}s must have a non-·absent· name.
  2 all their {type definition}s must have the same name.
  3 all their {type definition}s must have the same target namespace.


Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/

Received on Monday, 19 November 2001 16:06:13 UTC