Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.samples » enumeration » [javadoc | source]

    1   /*   Copyright 2004 The Apache Software Foundation
    2    *
    3    *   Licensed under the Apache License, Version 2.0 (the "License");
    4    *   you may not use this file except in compliance with the License.
    5    *   You may obtain a copy of the License at
    6    *
    7    *       http://www.apache.org/licenses/LICENSE-2.0
    8    *
    9    *   Unless required by applicable law or agreed to in writing, software
   10    *   distributed under the License is distributed on an "AS IS" BASIS,
   11    *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   12    *   See the License for the specific language governing permissions and
   13    *  limitations under the License.
   14    */
   15   
   16   package org.apache.xmlbeans.samples.enumeration;
   17   
   18   import org.apache.xmlbeans.samples.enumeration.schemaenum.easypo.PurchaseOrderDocument;
   19   import org.apache.xmlbeans.samples.enumeration.schemaenum.pricesummary.PriceSummaryDocument;
   20   
   21   /**
   22    * A class to test the SchemaEnum sample.
   23    */
   24   public class SchemaEnumTest
   25   {
   26       /**
   27        * Tests the SchemaEnum sample.
   28        *
   29        * @param args An array in which the first item is a path to an XML file
   30        * based on the schema in inventory.xsd.
   31        */
   32       public static void main(String[] args)
   33       {
   34           SchemaEnum sample = new SchemaEnum();
   35           PurchaseOrderDocument poDoc = sample.parseXml(args[0]);
   36   
   37           boolean exampleIsValid = sample.validateXml(poDoc);
   38           assert exampleIsValid;
   39   
   40           // Create a new document that summarizes the PO doc.
   41           PriceSummaryDocument summaryDoc = sample.summarizeItems(poDoc);
   42   
   43           boolean summaryIsValid = sample.validateXml(summaryDoc);
   44           assert summaryIsValid;
   45   
   46           // Create a summary of the items based on price.
   47           String sortedItems = sample.sortByThreshold(summaryDoc);
   48   
   49           boolean stringExists = (sortedItems != null);
   50           assert stringExists;
   51       }
   52   }

Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.samples » enumeration » [javadoc | source]