01: /* Copyright 2004 The Apache Software Foundation
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * 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.datetime;
17:
18: import org.apache.xmlbeans.samples.datetime.DatetimeDocument;
19:
20: /**
21: * A class with which to test the DateTime sample.
22: */
23: public class DateTimeTest {
24: /**
25: * Tests the DateTime sample.
26: *
27: * @param args An array in which the first item is a path to an XML file
28: * based on the schema in datetime.xsd.
29: */
30: public static void main(String[] args) {
31: // Create an instance of this sample to work with.
32: DateTime sample = new DateTime();
33:
34: // Create an schema type instance from the XML indicated by the path.
35: DatetimeDocument doc = sample.parseXml(args[0]);
36:
37: sample.printInstance(doc);
38:
39: // Validate the XML.
40: boolean exampleIsValid = sample.validateXml(doc);
41: assert exampleIsValid;
42:
43: //Creating a new XML document
44: sample.createDocument(doc, args[1]);
45:
46: }
47: }
|