Hi,

Does anyone know how to print out the values from an enumeration? I have
found the SchemaType and SchemaStringEnumEntry, though I am unable to
access the values. Ideally, I want to iterate through the values and
print them to out.println.

Here is a code fragment taken from the schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
targetNamespace="http://www.loc.gov/standards/premis";
xmlns="http://www.loc.gov/standards/premis";
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="object">
 <xs:complexType>
  <xs:sequence>
   <xs:element name="objectIdentifier" minOccurs="1"
maxOccurs="unbounded">
    <xs:complexType>
     <xs:sequence>
      <xs:element name="objectIdentifierType" minOccurs="1" maxOccurs="1">
       <xs:simpleType>
        <xs:restriction base="xs:string">
         <xs:enumeration value="URI"/>
         <xs:enumeration value="DOI"/>
         <xs:enumeration value="PURL"/>
        </xs:restriction>
       </xs:simpleType>
      </xs:element>
     </xs:sequence>
    </xs:complexType>
   </xs:element>
  </xs:sequence>
 </xs:complexType>
</xs:element>
</xs:schema>

I am trying to access them as follows, with an example root schema
element of 'Example'.

// Please excuse this psuedocode and assume I have correctly
// instantiated 'Object' and 'ObjectIdentifier' objects. I use
// them solely as an example.
ObjectDocument.Object oDoc = ObjectDocument.Factory.newInstance();
ObjectDocument.Object.ObjectIdentifier oId = oDoc.addNewObjectIdentifier();

// It's here that I'm failing to access the elements,
SchemaType schema = oDoc.schemaType();
SchemaStringEnumEntry[] entries = schema.getStringEnumEntries();
out.println(entries[1].getEnumName());

Can someone please indicate how to create the correct object / schema
element and print out a value from it.

Thanks,
Adam

-- 
  Adam Rusbridge
  DCC Development
  HATII, University of Glasgow, Scotland
  Tel: +44 (0)141 330 8591
  Email: [EMAIL PROTECTED]
  Web: www.dcc.ac.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to