Re: need help writing an XML schema - where to turn?

Hi Donald,

I do a bit of work with Cocoon... I'd be happy to help... I've not got an
instance document to go on but how does this look?


<schema xmlns='http://www.w3.org/2000/10/XMLSchema'
        xmlns:tns='namespace-uri-for-esql'
        targetNamespace='namespace-uri-for-esql'>

  <!-- some elements in the esql namespace ( I made these up :-) ) -->
  <element name='a' />
  <element name='b' />
  <element name='c' />

  <complexType name='row-results'>
    <complexContent mixed='true' > <!-- Allow text to appear between
elements -->
      <choice minOccurs='0' maxOccurs='unbounded' > <!-- The stuff inside
here can appear as many times as you like -->
        <any namespace='##other' /> <!-- Allow elements from other
namespaces -->
        <element ref='tns:a' /> <!-- Allow the a,b and c elements from the
esql namespace -->
        <element ref='tns:b' />
        <element ref='tns:c' />
      </choice>
      <anyAttribute namespace='##any' /> <!-- Allow attributes from any
namespace -->
    </complexContent>
  </complexType>
  <element name='row-results' type='tns:row-result' />

</schema>


This would allow the following instance ( and others of course... );

<esql:row-results xmlns:esql='namespace-uri-for-esql'
                  xmlns:x1='some-uri-1'
                  xmlns:x2='some-uri-2'
                  x1:attr_x='blahblah'
                  x2:attr_y='blahblah'>

  <x1:elem_x>blah blah blah</x1:elem_x>
  <esql:a/>
  <esql:a/>
  <x1:elem_x>blah blah blah</x1:elem_x>
  <esql:a/>
  <esql:b/>
  Some text
  <x1:elem_x>blah blah blah</x1:elem_x>
  Some more text
  <esql:a/>
  <esql:c/>
</esql:row-results>

Is this the kind of thing you were after?

Martin Gudgin
DevelopMentor

----- Original Message -----
From: "Donald Ball" <balld@webslingerZ.com>
To: <www-xml-schema-comments@w3.org>
Sent: Sunday, November 26, 2000 7:15 PM
Subject: need help writing an XML schema - where to turn?


> hi guys. i'm trying to write some xml schemas for portions of the apache
> cocoon project and i'm having some trouble figuring out how to write some
> of it. i tried searching around for an xml schema user's list, but to no
> avail so far. can someone direct me towards an appropriate forum?
>
> if this _is_ in fact an appropriate forum, my biggest problem is this: i
> have an element, esql:row-results, which can contain text, arbitrary
> elements and attributes from other namespaces, and a specific set of
> elements in the esql namespace, in arbitrary order. the elements in the
> esql namespace may appear any number of times. i can't see any way to
> describe this in xml schema. any suggestions?
>
> - donald

Received on Wednesday, 29 November 2000 03:20:04 UTC