RE: Two elements FooFoo with different types in a sequence? Is th is possible?

Hey,

I might be worth to have a look at the xsd:pattern, fully
described in the XML Schema Part 2.

With xsd:pattern you can express regular expressions, e.g.
you can restrict the usage of an element's content.

<xsd:restriction base="xsd:string">
  <xsd:pattern value="[A-Z]* | \d{5}"/>
</xsd:restriction>

... so your 'FooFoo' can only accecpt string or integer.
(please have a look a the specific chapter for detailed
 explanation of xsd:pattern)

regards

Oliver


> -----Original Message-----
> From: Test1 [mailto:test1@w3.org]
> Sent: Montag, 4. Februar 2002 11:46
> To: xmlschema-dev@w3.org
> Subject: Two elements FooFoo with different types in a 
> sequence? Is this
> possible?
> 
> 
> Hi XML Schema Gurus
> 
> 
> I want do this:
> 
> <xsd:complexType name="Foo">
> 
>     <xsd:sequence>
>          <xsd:element name="FooFoo" type="xsd:string"/>
>          <xsd:element name="FooFoo" type="xsd:integer"/>
>     </xsd:sequence>
> 
> </xsd:complexType>
> 
> Because I want to validate a xml like this:
> 
> <Foo>
>     <FooFoo>xfoo</FooFoo>
>     <FooFoo>12</FooFoo>
> </Foo>
> 
> In detail I want to validate the number and content of the 
> FooFoo elements.
> The FooFoo element content type is(could be) different for each FooFoo
> element
> in the Foo element.
> 
> But it dosen't work...
> Parsing error:  Schema error: duplicate element decl in the 
> same scope with
> different types : FooFoo.
> 
> Is there a way to do something like this with xsd?
> Has some body a solution/ workaround for this probelm or ...?
> Or a hint?
> 
> It's importend for me that the element name for an element in 
> the element
> Foo
> is every time FooFoo. Because I wan't write an engine that 
> validate, parses
> different xml
> files and write there data into a database. Therefore the element
> structure(Names) should be
> always the same. But it should be possible to write a xsd 
> file for each
> input xml file
> to validate the number and content of the FooFoo elements.
> 
> Thanx a lot...
> 
> bye
> michi
> 
> 

Received on Monday, 4 February 2002 06:07:01 UTC