Skip to Content
Real World XML
book

Real World XML

by Steven Holzner
January 2003
Beginner to intermediate content levelBeginner to intermediate
1200 pages
23h 42m
English
Peachpit Press
Content preview from Real World XML

Creating Element Groups

Say that I wanted to let the borrower borrow not just books, but also a magazine. To do that, I can create a new group named booksAndMagazine. A group collects elements together, and you can name groups. You can then include a group in other elements using the <xsd:group> element and referring to the group by name:

<xsd:complexType name="transactionType"> 
    <xsd:sequence>
        <xsd:element name="Lender" type="address"/>
        <xsd:element name="Borrower" type="address"/>
        <xsd:element ref="note" minOccurs="0"/>
        <xsd:choice>
            <xsd:element name="books" type="books"/>
            <xsd:element ref="book"/>
            <xsd:group ref="booksAndMagazine"/>
        <xsd:choice>
    </xsd:sequence>
    <xsd:attribute name="borrowDate" type="xsd:date"/>
</xsd:complexType>

To create ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Inside XML

Inside XML

Steven Holzner
XML Hacks

XML Hacks

Michael Fitzgerald

Publisher Resources

ISBN: 0735712867Purchase book