Back button
package samples;


import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.Locale;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.sax.SAXSource;
import javax.xml.validation.Validator;
import mikado.Conf;
import mikado.Csr19139;
import mikado.automatic.generator.Csr19139Generator;
import mikado.language.Language;
import mikado.xml.NamespaceCache;
import mikado.xml.XmlFragment;
import mikado.xml.editors.MdHrLvNameFinder;
import mikado.xml.fragments.GmlcurveMember;
import mikado.xml.vocabulary.VocabularyUpdater;
import mikado.xml19139.MetadataCsrIso19139;
import mikado.xml19139.fragments.GmdcitedResponsibleParty;
import mikado.xml19139.fragments.GmdgeographicElement4gmdEX_GeographicBoundingBoxes;
import mikado.xml19139.fragments.GmdgeographicElement4gmdEX_GeographicDescription;
import mikado.xml19139.fragments.Gmdkeyword4instrument;
import mikado.xml19139.fragments.Gmdkeyword4parameter;
import mikado.xml19139.fragments.Gmdkeyword4project;
import mikado.xml19139.fragments.Gmdkeyword4sdnSDN_MarsdenCode;
import mikado.xml19139.fragments.Gmdkeyword4sdnSDN_WaterBodyCode;
import mikado.xml19139.fragments.GmdpointOfContact4gmdindividualName;
import mikado.xml19139.fragments.GmdresourceConstraints;
import mikado.xml19139.fragments.Gmiobjective4moorings;
import mikado.xml19139.fragments.Gmiobjective4samples;
import mikado.xml19139.fragments.SdnadditionalDocumentation;
import org.xml.sax.InputSource;
import org.w3c.dom.Document;
import sdn.vocabulary.implementations.CollectionFactory;

/** Sample code to read CSR xml file
 *
 * @author mlarour
 */
public class ReadCsrSample
{
   /** Java main method, Reads the CSR sample file and displays it on standard output
    * @param args the command line arguments
    */
   public static void main(String[] args)
   {
      try
      {
         // +------------------------+
         // | INITIALIZE ENVIRONMENT |
         // +------------------------+
         Language.newInstance("LOCAL_DIRECTORY/languages/English.xml",Locale.US);
         Conf.newInstance("LOCAL_DIRECTORY/conf");
         VocabularyUpdater.setHomeList("LOCAL_DIRECTORY/lists");
         CollectionFactory.newInstance(new File("LOCAL_DIRECTORY/lists"));
         MdHrLvNameFinder.newInstance("SDN","L23",-1);        
         
         // +---------------------------------------------------------------+
         // | READ XML CSR IN MEMORY (CSR_ISO19139_full_example_v4.0.0.xml) |
         // +---------------------------------------------------------------+
         String csrExample = "SAMPLES/CSR_ISO19139_full_example_v4.0.0.xml";
         DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
         documentBuilderFactory.setNamespaceAware(true);
         InputSource inputSource = new InputSource(new InputStreamReader(new FileInputStream(csrExample)));
         Document document = documentBuilderFactory.newDocumentBuilder().parse(inputSource);
         MetadataCsrIso19139.getXPath().setNamespaceContext(new NamespaceCache(document, true));
         MetadataCsrIso19139 csr = new MetadataCsrIso19139();         
         csr.set(document.getLastChild());
         Csr19139.useAsLibrary(csr);
         
         // +--------------+
         // | VALIDATE CSR |
         // +--------------+
         Validator validator = Conf.getInstance().getValidator(Csr19139Generator.XSD);                  
         validator.validate(new SAXSource(new InputSource(new StringReader(csr.getXml().toString()))));
         System.out.println("=============================================");
         System.out.println(csrExample+" IS VALID");
         System.out.println("=============================================");

         System.out.println();
         System.out.println("=====================");
         System.out.println("SINGLE VARIABLES READ");
         System.out.println("=====================");
         // +------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC :$=[FI351994800010] (CSR identifier) MAIN QUERY / MANDATORY |
         // +------------------------------------------------------------------------------+
         // PRINT CSR identifier         
         System.out.println(":$="+csr.getGmdfileIdentifier().
                                      getGcoCharacterString().
                                      getContent().replaceFirst(Csr19139.URNSDNCSRLOCAL, ""));
         System.out.println("   "+csr.getGmdfileIdentifier().
                                      getGcoCharacterString().
                                      getContent());
         // +----------------------------------------------------------------+
         // | MIKADO AUTOMATIC var01=[486] Collate Center SINGLE / MANDATORY |
         // +----------------------------------------------------------------+
         // PRINT edmo CODE         
         System.out.println("var01="+csr.getGmdcontact().
                            getGmdCI_ResponsibleParty().
                            getGmdorganisationName().
                            getSdnSDN_EDMOCode().
                            getCodeListValue4sdnSDN_EDMOCode().
                            getValue());
         // PRINT edmo LABEL 
         System.out.println("      "+csr.getGmdcontact().
                                         getGmdCI_ResponsibleParty().
                                         getGmdorganisationName().
                                         getSdnSDN_EDMOCode().
                                         getContent());
         // +------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var02=[CITHER 2 LEG 1] Cruise Name SINGLE / MANDATORY |
         // +------------------------------------------------------------------------+
         System.out.println("var02="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmdcitation().
                                         getGmdCI_Citation4gmdcitation().
                                         getGmdtitle().
                                         getGcoCharacterString().
                                         getContent());
         
         // +----------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var03=[FI351994800010] Cruise id SINGLE / MANDATORY |
         // +----------------------------------------------------------------------+
         System.out.println("var03=["+csr.getGmdidentificationInfo4csr().
                                          getSdnSDN_DataIdentification4csr().
                                          getGmdcitation().
                                          getGmdCI_Citation4gmdcitation().
                                          getGmdalternateTitle().
                                          getGcoCharacterString().
                                          getContent());
         
         // +----------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var04=[1996-11-04] Revision date SINGLE / MANDATORY |
         // +----------------------------------------------------------------------+
         System.out.println("var04="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmdcitation().
                                         getGmdCI_Citation4gmdcitation().
                                         getGmddate4gmdCI_Date().
                                         getGmdCI_Date().
                                         getGmddate().
                                         getGcoDate().
                                         getContent());
         
         // +--------------------------------------------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var08=[This series comprises a set of datasets acquired during the cruise.] abstract SINGLE / MANDATORY |
         // +--------------------------------------------------------------------------------------------------------------------------+
         System.out.println("var08="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmdabstract().
                                         getGcoCharacterString4editor().
                                         getContent());
         
         // +---------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var09=[FI351994800010.gml] Track chart - File Name SINGLE / OPTIONAL |
         // +---------------------------------------------------------------------------------------+
         System.out.println("var09="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmdgraphicOverview().
                                         getGmdMD_BrowseGraphic().
                                         getGmdfileName().
                                         getGcoCharacterString4gmdfileName().
                                         getContent());
         
         // +------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var11=[GML] Track chart - File Type SINGLE / OPTIONAL |
         // +------------------------------------------------------------------------+
         System.out.println("var11="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmdgraphicOverview().
                                         getGmdMD_BrowseGraphic().
                                         getGmdfileType().
                                         getGcoCharacterString4gmdfileType().
                                         getContent());
         
         // +---------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var12=[BSH176] Port of departure SINGLE / OPTIONAL |
         // +---------------------------------------------------------------------+
         // PRINT CODE in C38 List
         System.out.println("var12="+csr.getGmdidentificationInfo4csr().
             getSdnSDN_DataIdentification4csr().
             getGmddescriptiveKeywords4departure_place().
             getGmdMD_Keywords4sdnSDN_PortCode().
             getGmdkeyword4sdnSDN_PortCode().
             getSdnSDN_PortCode().
             getCodeListValue().
             getValue());         
         // PRINT LABEL in C38 List
         System.out.println("      "+csr.getGmdidentificationInfo4csr().
             getSdnSDN_DataIdentification4csr().
             getGmddescriptiveKeywords4departure_place().
             getGmdMD_Keywords4sdnSDN_PortCode().
             getGmdkeyword4sdnSDN_PortCode().
             getSdnSDN_PortCode().
             getContent());
         
         // +------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var13=[BSH185] Port of return SINGLE / OPTIONAL |
         // +------------------------------------------------------------------+
         // PRINT CODE in C38 List
         System.out.println("var13="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4arrival_place().
                                         getGmdMD_Keywords4sdnSDN_PortCode().
                                         getGmdkeyword4sdnSDN_PortCode().
                                         getSdnSDN_PortCode().
                                         getCodeListValue().
                                         getValue());
         // PRINT LABEL in C38 List
         System.out.println("      "+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4arrival_place().
                                         getGmdMD_Keywords4sdnSDN_PortCode().
                                         getGmdkeyword4sdnSDN_PortCode().
                                         getSdnSDN_PortCode().
                                         getContent());
         
         // +--------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var14=[BR] country of departure SINGLE / OPTIONAL |
         // +--------------------------------------------------------------------+
         // PRINT CODE in C32 List
         System.out.println("var14="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4departure_country().
                                         getGmdMD_Keywords4sdnSDN_CountryCode().
                                         getGmdkeyword4sdnSDN_CountryCode().
                                         getSdnSDN_CountryCode().
                                         getCodeListValue4sdnSDN_CountryCode().
                                         getValue());
         // PRINT LABEL in C32 List
         System.out.println("      "+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4departure_country().
                                         getGmdMD_Keywords4sdnSDN_CountryCode().
                                         getGmdkeyword4sdnSDN_CountryCode().
                                         getSdnSDN_CountryCode().
                                         getContent());
         
         // +-----------------------------------------------------------------+
         // | MIKADO AUTOMATIC var15=[BR] country of return SINGLE / OPTIONAL |
         // +-----------------------------------------------------------------+
         // PRINT CODE in C32 List
         System.out.println("var15="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4arrival_country().
                                         getGmdMD_Keywords4sdnSDN_CountryCode().
                                         getGmdkeyword4sdnSDN_CountryCode().
                                         getSdnSDN_CountryCode().
                                         getCodeListValue4sdnSDN_CountryCode().
                                         getValue());
         // PRINT LABEL in C32 List
         System.out.println("      "+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4arrival_country().
                                         getGmdMD_Keywords4sdnSDN_CountryCode().
                                         getGmdkeyword4sdnSDN_CountryCode().
                                         getSdnSDN_CountryCode().
                                         getContent());
         // +--------------------------------------------------------------+
         // | MIKADO AUTOMATIC var16=[3230] Ship - code SINGLE / MANDATORY |
         // +--------------------------------------------------------------+
         // PRINT CODE in C17 List
         System.out.println("var16="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4platform().
                                         getGmdMD_Keywords4sdnSDN_PlatformCode().
                                         getGmdkeyword4sdnSDN_PlatformCode().
                                         getSdnSDN_PlatformCode().
                                         getCodeListValue().
                                         getValue());
         // PRINT LABEL in C17 List
         System.out.println("      "+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4platform().
                                         getGmdMD_Keywords4sdnSDN_PlatformCode().
                                         getGmdkeyword4sdnSDN_PlatformCode().
                                         getSdnSDN_PlatformCode().
                                         getContent());
         
         // +----------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var17=[31] Ship - platform class SINGLE / MANDATORY |
         // +----------------------------------------------------------------------+
         // PRINT CODE in L06 List
         System.out.println("var17="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4platform_class().
                                         getGmdMD_Keywords4platform_class().
                                         getGmdkeyword4platform_class().
                                         getSdnSDN_PlatformCategoryCode().
                                         getCodeListValue().
                                         getValue());
         // PRINT  LABEL in L06 List
         System.out.println("      "+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmddescriptiveKeywords4platform_class().
                                         getGmdMD_Keywords4platform_class().
                                         getGmdkeyword4platform_class().
                                         getSdnSDN_PlatformCategoryCode().
                                         getContent());
         
         // +-------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var24=[1994-01-04T00:00:00] Cruise - start date SINGLE / MANDATORY |
         // +-------------------------------------------------------------------------------------+
         System.out.println("var24="+csr.getGmdidentificationInfo4csr().
             getSdnSDN_DataIdentification4csr().
             getGmdextent4gmdEX_GeographicDescription().
             getGmdEX_Extent4gmdEX_GeographicDescription().
             getGmdtemporalElement().
             getGmdEX_TemporalExtent().
             getGmdextent4gmlTimePeriod().
             getGmlTimePeriod().
             getGmlbeginPosition().
             getContent());
         
         // +-----------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var25=[1994-02-13T00:00:00] Cruise - end date SINGLE / MANDATORY |
         // +-----------------------------------------------------------------------------------+
         System.out.println("var25="+csr.getGmdidentificationInfo4csr().
                                         getSdnSDN_DataIdentification4csr().
                                         getGmdextent4gmdEX_GeographicDescription().
                                         getGmdEX_Extent4gmdEX_GeographicDescription().
                                         getGmdtemporalElement().
                                         getGmdEX_TemporalExtent().
                                         getGmdextent4gmlTimePeriod().
                                         getGmlTimePeriod().
                                         getGmlendPosition().
                                         getContent());
                
         int i;
         System.out.println();
         System.out.println("=======================");
         System.out.println("MULTIPLE VARIABLES READ");
         System.out.println("=======================");
         // +-------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var05=[Laurent MEMERY] Chief scientist - name MULTIPLE / MANDATORY |
         // | MIKADO AUTOMATIC var06=[1046] Chief scientist - laboratory MULTIPLE / MANDATORY     |
         // +-------------------------------------------------------------------------------------+
         i=0;
         GmdpointOfContact4gmdindividualName gocn;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                    getSdnSDN_DataIdentification4csr().
                                    getGmdpointOfContact4gmdindividualNames())
         {
            i++;
            gocn = (GmdpointOfContact4gmdindividualName)xmlFragment; 
            System.out.println("["+i+"]var05="+gocn.getGmdCI_ResponsibleParty4gmdindividualName().
                                                getGmdindividualName().
                                                getGcoCharacterString4gmdindividualName().
                                                getContent());
            System.out.println("["+i+"]var06="+gocn.getGmdCI_ResponsibleParty4gmdindividualName().
                                                getGmdorganisationName().
                                                getSdnSDN_EDMOCode().
                                                getCodeListValue4sdnSDN_EDMOCode().
                                                getValue());
         }
         
         // +---------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var07=[494] Originator - laboratory MULTIPLE / MANDATORY |
         // | MIKADO AUTOMATIC var07=[487] Originator - laboratory MULTIPLE / MANDATORY |
         // +---------------------------------------------------------------------------+
         i=0;
         GmdcitedResponsibleParty grp;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
             getSdnSDN_DataIdentification4csr().
             getGmdcitation().
             getGmdCI_Citation4gmdcitation().
             getGmdcitedResponsiblePartys())
         {
             i++;
             grp = (GmdcitedResponsibleParty)xmlFragment;
             System.out.println("["+i+"]var07="+grp.getGmdCI_ResponsibleParty().
                                                    getGmdorganisationName().
                                                    getSdnSDN_EDMOCode().
                                                    getCodeListValue4sdnSDN_EDMOCode().
                                                    getValue());
             System.out.println("         "+       grp.getGmdCI_ResponsibleParty().
                                                    getGmdorganisationName().
                                                    getSdnSDN_EDMOCode().
                                                    getContent());
                
         }
         
         // +-----------------------------------------------------------+
         // | MIKADO AUTOMATIC var18=[9582] Project MULTIPLE / OPTIONAL |
         // +-----------------------------------------------------------+
         i=0;
         Gmdkeyword4project edmerp;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                             getSdnSDN_DataIdentification4csr().
                                             getGmddescriptiveKeywords4project().
                                             getGmdMD_Keywords4project().
                                             getGmdkeyword4projects())
         { 
            i++;  
            edmerp = (Gmdkeyword4project)xmlFragment;
            System.out.println("["+i+"]var18="+edmerp.getSdnSDN_EDMERPCode().getCodeListValue().getValue());
            System.out.println("         "+       edmerp.getSdnSDN_EDMERPCode().getContent());
         }
         
         
         // +----------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var19=[32] General ocean areas MULTIPLE / MANDATORY |
         // +----------------------------------------------------------------------+
         i=0;
         Gmdkeyword4sdnSDN_WaterBodyCode gsdnwbc;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmddescriptiveKeywords4place().
                                           getGmdMD_Keywords4sdnSDN_WaterBodyCode().
                                           getGmdkeyword4sdnSDN_WaterBodyCodes())
         {
            i++;  
            gsdnwbc = (Gmdkeyword4sdnSDN_WaterBodyCode)xmlFragment;
            System.out.println("["+i+"]var19="+gsdnwbc.getSdnSDN_WaterBodyCode().getCodeListValue().getValue());
            System.out.println("         "+    gsdnwbc.getSdnSDN_WaterBodyCode().getContent());
         }
         
         // +--------------------------------------------------------------------------------+
         // |MIKADO AUTOMATIC var20=  [5] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=  [4] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[304] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[303] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[302] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[339] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[338] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[374] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[375] Geographic coverage - marsden MULTIPLE / OPTIONAL  |
         // |MIKADO AUTOMATIC var20=[376] Geographic coverage - marsden MULTIPLE / OPTIONAL  |         
         // +--------------------------------------------------------------------------------+         
         i=0;
         Gmdkeyword4sdnSDN_MarsdenCode gsdnmc;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmddescriptiveKeywords4marsden_square().
                                           getGmdMD_Keywords4sdnSDN_MarsdenCode().
                                           getGmdkeyword4sdnSDN_MarsdenCodes())             
         {
            i++;  
            gsdnmc = (Gmdkeyword4sdnSDN_MarsdenCode)xmlFragment;
            System.out.println("["+i+"]var19="+gsdnmc.getSdnSDN_MarsdenCode().getCodeListValue().getValue());
            System.out.println("         "+    gsdnmc.getSdnSDN_MarsdenCode().getContent());
         }
         
         // +--------------------------------------------------------------+
         // | MIKADO AUTOMATIC var21=[TEMP] Parameters MULTIPLE / OPTIONAL |
         // | MIKADO AUTOMATIC var21=[PSAL] Parameters MULTIPLE / OPTIONAL |
         // | MIKADO AUTOMATIC var21=[TSED] Parameters MULTIPLE / OPTIONAL |
         // +--------------------------------------------------------------+         
         i=0;
         Gmdkeyword4parameter gmdkeyword4parameter;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmddescriptiveKeywords4parameter().
                                           getGmdMD_Keywords4parameter().
                                           getGmdkeyword4parameters())
         {
            i++;
            gmdkeyword4parameter = (Gmdkeyword4parameter)xmlFragment;
            System.out.println("["+i+"]var19="+gmdkeyword4parameter.getSdnSDN_ParameterDiscoveryCode().getCodeListValue().getValue());
            System.out.println("         "+    gmdkeyword4parameter.getSdnSDN_ParameterDiscoveryCode().getContent());
         }
         
         // +--------------------------------------------------------------+
         // | MIKADO AUTOMATIC var22=[130] Instruments MULTIPLE / OPTIONAL |
         // | MIKADO AUTOMATIC var22=[30] Instruments MULTIPLE / OPTIONAL  |
         // +--------------------------------------------------------------+
         i=0;
         Gmdkeyword4instrument gmdkeyword4instrument;
         for(XmlFragment xmlFragment :csr.getGmdidentificationInfo4csr().
             getSdnSDN_DataIdentification4csr().
             getGmddescriptiveKeywords4instrument().
             getGmdMD_Keywords4instrument().
             getGmdkeyword4instruments())
         {
            i++;
            gmdkeyword4instrument = (Gmdkeyword4instrument)xmlFragment;
            System.out.println("["+i+"]var22="+gmdkeyword4instrument.getSdnSDN_DeviceCategoryCode().getCodeListValue().getValue());
            System.out.println("         "+    gmdkeyword4instrument.getSdnSDN_DeviceCategoryCode().getContent());
         }
         
         // +---------------------------------------------------------------+
         // | MIKADO AUTOMATIC var23=[UN] Availability MULTIPLE / MANDATORY |
         // | MIKADO AUTOMATIC var23=[LS] Availability MULTIPLE / MANDATORY |
         // +---------------------------------------------------------------+
         i=0;
         GmdresourceConstraints gmdresourceConstraints; 
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmdresourceConstraintss())
         {
            i++;
            gmdresourceConstraints = (GmdresourceConstraints)xmlFragment;
            System.out.println("["+i+"]var23="+gmdresourceConstraints.getGmdMD_LegalConstraints().getGmdotherConstraints().getGmxAnchor().getXlinkhref().getValue());
            System.out.println("         "+    gmdresourceConstraints.getGmdMD_LegalConstraints().getGmdotherConstraints().getGmxAnchor().getContent());
         }
         
         // +------------------------------------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var26=[South Atlantic Ocean, Brasil ] Specific geographic areas MULTIPLE / OPTIONAL             |
         // | MIKADO AUTOMATIC var26=[South Atlantic Ocean, Inter-tropical Area] Specific geographic areas MULTIPLE / OPTIONAL |
         // +------------------------------------------------------------------------------------------------------------------+
         i=0;
         GmdgeographicElement4gmdEX_GeographicDescription geexgd;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmdextent4gmdEX_GeographicDescription().
                                           getGmdEX_Extent4gmdEX_GeographicDescription().
                                           getGmdgeographicElement4gmdEX_GeographicDescriptions())
         {
            i++;
            geexgd = (GmdgeographicElement4gmdEX_GeographicDescription)xmlFragment;
            System.out.println("["+i+"]var26="+geexgd.getGmdEX_GeographicDescription().
                                                      getGmdgeographicIdentifier().
                                                      getGmdMD_Identifier().
                                                      getGmdcode().
                                                      getGcoCharacterString().
                                                      getContent());
         }
         
         // +------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var27=[-50] West longitude MULTIPLE / MANDATORY |
         // | MIKADO AUTOMATIC var28=[-40] East longitude MULTIPLE / MANDATORY |
         // | MIKADO AUTOMATIC var29=[-25] South latitude MULTIPLE / MANDATORY |
         // | MIKADO AUTOMATIC var30=[10] North latitude MULTIPLE / MANDATORY  |
         // +------------------------------------------------------------------+
         i=0;
         GmdgeographicElement4gmdEX_GeographicBoundingBoxes geexgbb;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmdextent4gmdEX_GeographicDescription().
                                           getGmdEX_Extent4gmdEX_GeographicDescription().
                                           getGmdgeographicElement4gmdEX_GeographicBoundingBoxess())
         {
            i++;
            geexgbb = (GmdgeographicElement4gmdEX_GeographicBoundingBoxes)xmlFragment;
            System.out.println("["+i+"]var27="+geexgbb.getGmdEX_GeographicBoundingBox().
                                                       getGmdwestBoundLongitude().
                                                       getGcoDecimal4gmdwestBoundLongitude().
                                                       getContent());
            System.out.println("["+i+"]var28="+geexgbb.getGmdEX_GeographicBoundingBox().
                                                       getGmdeastBoundLongitude().
                                                       getGcoDecimal4gmdeastBoundLongitude().
                                                       getContent());
            System.out.println("["+i+"]var29="+geexgbb.getGmdEX_GeographicBoundingBox().
                                               getGmdsouthBoundLatitude().
                                               getGcoDecimal4gmdsouthBoundLatitude().
                                               getContent());
            System.out.println("["+i+"]var30="+geexgbb.getGmdEX_GeographicBoundingBox().
                                                       getGmdnorthBoundLatitude().
                                                       getGcoDecimal4gmdnorthBoundLatitude().
                                                       getContent());
         }

         // +------------------------------------------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var31=[D01] Mooring - data type MULTIPLE / OPTIONAL                                                   |
         // | MIKADO AUTOMATIC var32=[1996-11-04T00:00:00] Mooring - reference date MULTIPLE / OPTIONAL                              |
         // | MIKADO AUTOMATIC var33=[Herlé MERCIER] Mooring - principal investigator - name MULTIPLE / OPTIONAL                     |
         // | MIKADO AUTOMATIC var34=[487] Mooring - principal investigator - laboratory MULTIPLE / OPTIONAL                         |
         // | MIKADO AUTOMATIC var35=[Mooring on the Atlantic ... meters] Mooring - description MULTIPLE / OPTIONAL                  |
         // | MIKADO AUTOMATIC var36=[-38,-20] Mooring - coordinates MULTIPLE / OPTIONAL                                             |
         // |                                                                                                                        |
         // | MIKADO AUTOMATIC var31=[H72] Mooring - data type MULTIPLE / OPTIONAL                                                   |
         // | MIKADO AUTOMATIC var32=[1996-11-04T00:00:00] Mooring - reference date MULTIPLE / OPTIONAL                              |
         // | MIKADO AUTOMATIC var33=[Herlé MERCIER] Mooring - principal investigator - name MULTIPLE / OPTIONAL                     |
         // | MIKADO AUTOMATIC var34=[487] Mooring - principal investigator - laboratory MULTIPLE / OPTIONAL                         |
         // | MIKADO AUTOMATIC var35=[Mooring on the Atlantic Ridge, ... thermistor chain] Mooring - description MULTIPLE / OPTIONAL |
         // | MIKADO AUTOMATIC var36=[-38,-20] Mooring - coordinates MULTIPLE / OPTIONAL                                             |
         // +------------------------------------------------------------------------------------------------------------------------+         
         i=0;
         Gmiobjective4moorings gmiobjective4moorings;
         for(XmlFragment xmlFragment : csr.getGmiacquisitionInformation().
                                           getGmiMI_AcquisitionInformation().
                                           getGmiobjective4mooringss())
         {
            i++;
            gmiobjective4moorings = (Gmiobjective4moorings)xmlFragment;
            System.out.println("["+i+"]var31="+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmisensingInstrument().
                                                                     getGmiMI_Instrument().
                                                                     getGmitype4gmiMI_SensorTypeCode().
                                                                     getSdnSDN_DataCategoryCode().
                                                                     getCodeListValue().
                                                                     getValue());
            System.out.println("         "+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                 getGmisensingInstrument().
                                                                 getGmiMI_Instrument().
                                                                 getGmitype4gmiMI_SensorTypeCode().
                                                                 getSdnSDN_DataCategoryCode().
                                                                 getContent());            
            System.out.println("["+i+"]var32="+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmiobjectiveOccurrence().
                                                                     getGmiMI_Event4id().
                                                                     getGmitime().
                                                                     getGcoDateTime().
                                                                     getContent());
            System.out.println("["+i+"]var33="+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmisensingInstrument().
                                                                     getGmiMI_Instrument().
                                                                     getGmimountedOn().
                                                                     getGmiMI_Platform().
                                                                     getGmisponsor().
                                                                     getGmdCI_ResponsibleParty4gmdindividualName().
                                                                     getGmdindividualName().
                                                                     getGcoCharacterString4gmdindividualName().
                                                                     getContent());
            System.out.println("["+i+"]var34="+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmisensingInstrument().
                                                                     getGmiMI_Instrument().
                                                                     getGmimountedOn().
                                                                     getGmiMI_Platform().
                                                                     getGmisponsor().
                                                                     getGmdCI_ResponsibleParty4gmdindividualName().
                                                                     getGmdorganisationName().
                                                                     getSdnSDN_EDMOCode().
                                                                     getCodeListValue4sdnSDN_EDMOCode().
                                                                     getValue());
            System.out.println("         "+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                 getGmisensingInstrument().
                                                                 getGmiMI_Instrument().
                                                                 getGmimountedOn().
                                                                 getGmiMI_Platform().
                                                                 getGmisponsor().
                                                                 getGmdCI_ResponsibleParty4gmdindividualName().
                                                                 getGmdorganisationName().
                                                                 getSdnSDN_EDMOCode().
                                                                 getContent());
            System.out.println("["+i+"]var35="+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmifunction().
                                                                     getGcoCharacterString4gmifunction().
                                                                     getContent());
            System.out.println("["+i+"]var36="+gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmiextent().
                                                                     getGmdEX_Extent4gmdEX_GeographicBoundingBox().
                                                                     getGmdgeographicElement4gmdEX_GeographicBoundingBox().
                                                                     getGmdEX_GeographicBoundingBox().       
                                                                     getGmdwestBoundLongitude().
                                                                     getGcoDecimal4gmdwestBoundLongitude().
                                                                     getContent()+","
                                              +gmiobjective4moorings.getSdnSDN_Objective4moorings().
                                                                     getGmiextent().
                                                                     getGmdEX_Extent4gmdEX_GeographicBoundingBox().
                                                                     getGmdgeographicElement4gmdEX_GeographicBoundingBox().
                                                                     getGmdEX_GeographicBoundingBox().       
                                                                     getGmdnorthBoundLatitude().
                                                                     getGcoDecimal4gmdnorthBoundLatitude().
                                                                     getContent());
         }
         
         // +------------------------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var37=[H10] Samples - data type MULTIPLE / OPTIONAL                                 |
         // | MIKADO AUTOMATIC var38=[1996-11-04T00:00:00] Samples - reference date MULTIPLE / OPTIONAL            |
         // | MIKADO AUTOMATIC var39=[Laurent MEMERY] Samples - principal investigator - name MULTIPLE / OPTIONAL  |
         // | MIKADO AUTOMATIC var40=[1046] Samples - principal investigator - laboratory MULTIPLE / OPTIONAL      |
         // | MIKADO AUTOMATIC var41=[Neil Brown CTD casts, up to 6000m] Samples - description MULTIPLE / OPTIONAL |
         // | MIKADO AUTOMATIC var42=[CSRU001] Samples - Units MULTIPLE / OPTIONAL                                 |
         // | MIKADO AUTOMATIC var43=[44] Samples - No MULTIPLE / OPTIONAL                                         |
         // |                                                                                                      |
         // | MIKADO AUTOMATIC var37=[H09] Samples - data type MULTIPLE / OPTIONAL                                 |
         // | MIKADO AUTOMATIC var38=[1996-11-04T00:00:00] Samples - reference date MULTIPLE / OPTIONAL            |
         // | MIKADO AUTOMATIC var39=[Michel ARHAN] Samples - principal investigator - name MULTIPLE / OPTIONAL    |
         // | MIKADO AUTOMATIC var40=[487] Samples - principal investigator - laboratory MULTIPLE / OPTIONAL       |
         // | MIKADO AUTOMATIC var41=[Water bottle ... of 64 bottles] Samples - description MULTIPLE / OPTIONAL    |
         // | MIKADO AUTOMATIC var42=[CSRU001] Samples - Units MULTIPLE / OPTIONAL                                 |
         // | MIKADO AUTOMATIC var43=[40] Samples - No MULTIPLE / OPTIONAL                                         |
         // |                                                                                                      |
         // | ...                                                                                                  |
         // +------------------------------------------------------------------------------------------------------+
         i=0;
         Gmiobjective4samples gmiobjective4samples;
         for(XmlFragment xmlFragment : csr.getGmiacquisitionInformation().
             getGmiMI_AcquisitionInformation().
             getGmiobjective4sampless())
         {
            i++;
            gmiobjective4samples = (Gmiobjective4samples)xmlFragment;
            System.out.println("["+i+"]var37="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmisensingInstrument().
                                                                    getGmiMI_Instrument().
                                                                    getGmitype4gmiMI_SensorTypeCode().
                                                                    getSdnSDN_DataCategoryCode().
                                                                    getCodeListValue().
                                                                    getValue());
            System.out.println("         "+    gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmisensingInstrument().
                                                                    getGmiMI_Instrument().
                                                                    getGmitype4gmiMI_SensorTypeCode().
                                                                    getSdnSDN_DataCategoryCode().
                                                                    getContent());
            System.out.println("["+i+"]var38="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmiobjectiveOccurrence().
                                                                    getGmiMI_Event4id().
                                                                    getGmitime().
                                                                    getGcoDateTime().
                                                                    getContent());
            System.out.println("["+i+"]var39="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmisensingInstrument().
                                                                    getGmiMI_Instrument().
                                                                    getGmimountedOn().
                                                                    getGmiMI_Platform().
                                                                    getGmisponsor().
                                                                    getGmdCI_ResponsibleParty4gmdindividualName().
                                                                    getGmdindividualName().
                                                                    getGcoCharacterString4gmdindividualName().
                                                                    getContent());
            System.out.println("["+i+"]var40="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmisensingInstrument().
                                                                    getGmiMI_Instrument().
                                                                    getGmimountedOn().
                                                                    getGmiMI_Platform().
                                                                    getGmisponsor().
                                                                    getGmdCI_ResponsibleParty4gmdindividualName().
                                                                    getGmdorganisationName().
                                                                    getSdnSDN_EDMOCode().
                                                                    getCodeListValue4sdnSDN_EDMOCode().
                                                                    getValue());
            System.out.println("         "+    gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmisensingInstrument().
                                                                    getGmiMI_Instrument().
                                                                    getGmimountedOn().
                                                                    getGmiMI_Platform().
                                                                    getGmisponsor().
                                                                    getGmdCI_ResponsibleParty4gmdindividualName().
                                                                    getGmdorganisationName().
                                                                    getSdnSDN_EDMOCode().
                                                                    getContent());
            System.out.println("["+i+"]var41="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getGmifunction().
                                                                    getGcoCharacterString4gmifunction().
                                                                    getContent());
            System.out.println("["+i+"]var42="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getSdnSDN_SamplingActivity().
                                                                    getSdnunit().
                                                                    getSdnSDN_CSRUnitCode().
                                                                    getCodeListValue4sdnSDN_CSRUnitCode().
                                                                    getValue());
            System.out.println("         "+    gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getSdnSDN_SamplingActivity().
                                                                    getSdnunit().
                                                                    getSdnSDN_CSRUnitCode().
                                                                    getContent());
            System.out.println("["+i+"]var43="+gmiobjective4samples.getSdnSDN_Objective4samples().
                                                                    getSdnSDN_SamplingActivity().
                                                                    getSdnquantity().
                                                                    getContent());
         }
         
         
         // +---------------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var60=[This is line 1] (Curves-description) MULTIPLE / OPTIONAL            |
         // | MIKADO AUTOMATIC var62=[line1] (Curves-name) MULTIPLE / OPTIONAL                            |
         // | MIKADO AUTOMATIC var63=[-68.548849 ... 59.400296] (Curves-coordinates) MULTIPLE / OPTIONAL  |
         // | MIKADO AUTOMATIC var60=[This is line 2] (Curves-description) MULTIPLE / OPTIONAL            |
         // | MIKADO AUTOMATIC var62=[line2] (Curves-name) MULTIPLE / OPTIONAL                            |
         // | MIKADO AUTOMATIC var63=[112.963503 ... 5.916728] (Curves-coordinates) MULTIPLE / OPTIONAL   |
         // | MIKADO AUTOMATIC var60=[This is line 3] (Curves-description) MULTIPLE / OPTIONAL            |
         // | MIKADO AUTOMATIC var62=[line3] (Curves-name) MULTIPLE / OPTIONAL                            |
         // | MIKADO AUTOMATIC var63=[-76.816333 ... -57.079131] (Curves-coordinates) MULTIPLE / OPTIONAL |
         // +---------------------------------------------------------------------------------------------+
         i=0;
         GmlcurveMember gmlcurveMember;  
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getGmdextent4gmdEX_GeographicDescription().
                                           getGmdEX_Extent4gmdEX_GeographicDescription().
                                           getGmdgeographicElement4curve().
                                           getGmdEX_BoundingPolygon4curve().
                                           getGmdpolygon4curve().
                                           getGmlMultiCurve().getGmlcurveMembers())
         {
            i++;
            gmlcurveMember = (GmlcurveMember)xmlFragment;
            System.out.println("["+i+"]var60="+gmlcurveMember.getGmlLineString().getGmldescription().getContent());
            System.out.println("["+i+"]var62="+gmlcurveMember.getGmlLineString().getGmlname().getContent());
            System.out.println("["+i+"]var63="+gmlcurveMember.getGmlLineString().getGmlposList().getContent());
         }
         
         // +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
         // | MIKADO AUTOMATIC var50=[http://seadatanet.maris2.nl/isocodelists/sdncodelists/publications-Codelists.xml#SDN_PUBCode_151] (Documentation URL) {NEW} MULTIPLE / OPTIONAL |
         // +-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+         
         i=0;
         SdnadditionalDocumentation sdnadditionalDocumentation;
         for(XmlFragment xmlFragment : csr.getGmdidentificationInfo4csr().
                                           getSdnSDN_DataIdentification4csr().
                                           getSdnadditionalDocumentations())
         {
            i++;
            sdnadditionalDocumentation = (SdnadditionalDocumentation)xmlFragment;
            System.out.println("["+i+"]var50="+sdnadditionalDocumentation.getXlinkhref().getValue());
         }
         
         // +------------------------------------------------------------------+
         // | PRINT XML CSR FROM MEMORY (CSR_ISO19139_full_example_v4.0.0.xml) |
         // +------------------------------------------------------------------+
         StringBuffer xmlCsr = Csr19139.getCleanXml(csr);
         System.out.println();
         System.out.println("=======================");
         System.out.println("XML REBUILD FROM MEMORY");
         System.out.println("=======================");
         System.out.println(xmlCsr.toString());
         
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }
   }   
}