|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tuscany.samples.sdo.specExampleSection.AccessingTheContentsOfASequence
public class AccessingTheContentsOfASequence
Demonstrates accessing the sequence from a DataObject containing mixed content.
The following sample is from the Apache Tuscany project. It was written to help users
understand and experiement with SDO. It is based upon example code contained
within, and is meant for use with, and reference to the SDO Specification. In general this sample attempts to use the
code and comments contained within the specification, exceptions to this are noted
in comments.
Specifically the following sample is based upon the 'Accessing the contents of a Sequence' example from the Examples section of the SDO specification.
The following code uses the Sequence interface to analyze the contents of a DataObject that conforms to teh Letter model defined in
LETTER_XSD
. This code first goes through the Sequence looking for unformatted text entrires and prints them out. Then the code checks to
verify that the contents of teh "lastName" property of the DataObject matches the contents of the same property of the Sequence.
This sample reads an xml file (@link #LETTER_XML} representing a DataObject of a letter. In order to create a DataObject or DataGraph this sample
relies upon XMLHelper class which is an example of a XML DAS. The code shown here would work just as well against an equivalent DataObject that was
provided by any DAS.
The XSD for LETTER_XSD
defines the FormLetter complex type as mixed. Mixed content and sequences are often used for semi structured business data.
Usage:
This sample can easily be run from within Eclipse as a Java Application if tuscany or
the sample-sdo project is imported into Eclipse as an existing project.
If executing as a standalone application please do the following:
Field Summary | |
---|---|
static java.lang.String |
LETTER_XML
previously created XML file used |
static java.lang.String |
LETTER_XSD
previously created XSD file used |
Constructor Summary | |
---|---|
AccessingTheContentsOfASequence()
|
Method Summary | |
---|---|
static void |
main(java.lang.String[] args)
Execute this method in order to run the sample. |
static void |
printSequence(commonj.sdo.DataObject letter)
Uses the Sequence interface to analyze the contents of a DataObject that conforms to teh Letter model defined in LETTER_XSD . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LETTER_XSD
public static final java.lang.String LETTER_XML
Constructor Detail |
---|
public AccessingTheContentsOfASequence()
Method Detail |
---|
public static void main(java.lang.String[] args)
args
- public static void printSequence(commonj.sdo.DataObject letter)
LETTER_XSD
. This code first goes through the Sequence looking for unformatted text entrires and prints them out. Then the code checks
to verify that the contents of the "lastName" property of the DataObject matches the contents of the same property of the Sequence.
letter.
- Letter DataObject conforming to LETTER_XSD
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |