Declaring Mixed Content

...
          <optional>
            <element name="DESCRIPTION">
              <interleave>
                <text />
                <zeroOrMore>
                  <element name="PERSON">
                    <text/>
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="ARTIST">
                    <text/>
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="IRONIC">
                    <text/>
                  </element>
                </zeroOrMore>
                <zeroOrMore>
                  <element name="OPINION">
                    <interleave>
                      <text/>
                      <zeroOrMore>
                        <element name="METAPHOR">
                          <text/>
                        </element>
                      </zeroOrMore>
                    </interleave>
                  </element>
                </zeroOrMore>
              </interleave>
            </element>
          </optional>

start =
  element SONG {
    element TITLE { text },
    (element COMPOSER { personContent }+
     & element PRODUCER { personContent }*
     & element PUBLISHER { text }?
     & element LENGTH { text }?
     & element YEAR { text }?
     & element ARTIST { text }+
     & element DESCRIPTION {
         text
         & element PERSON { text }*
         & element ARTIST { text }*
         & element IRONIC { text }*
         & element OPINION {
             text
             & element METAPHOR { text }*
           }*
       }?)
  }
personContent =
  element NAME {
    element GIVEN { text },
    element FAMILY { text }
  }

Previous | Next | Top | Cafe con Leche

Copyright 2005, 2006 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified January 3, 2006