Liquid XML Data Binder (C++, Java, VB6) / Examples / Simple Sequence / Example Usage / Included Optional Elements / Java Sample : Simple Sequence
In This Topic
    Java Sample : Simple Sequence
    In This Topic
    Schema Summary
    This sample shows an element containing a sequence of simple elements and attributes.

    Schema Details
    The Element DVD contains a sequence of simple elements (simple because they are represented by primitives). All of these elements are required, and they must appear in the correct order. In addition the DVD element contains 2 attributes Genre and Cost. Genre is optional, Cost is Mandatory. Because Genre is optional, and contains primitive data, an IsValidGenre method is added to the generated DVD object. This allows you to determine if Genre was set or not. The generated classes take car of outputting the child elements in the correct order.

    Sample Description
    The sample demonstrates the element with all of the optional elements present. Note Genre is an optional primitive, so we should check it using the IsValid flag before accessing it

    Sample XML File

     Sample2.xml

    Sample Code
     Read Sample
     Write Sample

    XSD Source Files
     SimpleSequence.xsd
     Schema Diagrams

    Generated Files
     DVD.java

    Main Menu Samples List