KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dom4j > samples > DatatypeDemo


1 /*
2  * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3  *
4  * This software is open source.
5  * See the bottom of this file for the licence.
6  *
7  * $Id: DatatypeDemo.java,v 1.4 2005/01/29 14:52:57 maartenc Exp $
8  */

9
10 package org.dom4j.samples;
11
12 import org.dom4j.Document;
13 import org.dom4j.datatype.DatatypeDocumentFactory;
14 import org.dom4j.io.SAXReader;
15
16 /**
17  * A simple test program to demonstrate using XML Schema Data Types
18  *
19  * @author <a HREF="mailto:jstrachan@apache.org">James Strachan </a>
20  * @version $Revision: 1.4 $
21  */

22 public class DatatypeDemo extends AbstractDemo {
23
24     public static void main(String JavaDoc[] args) {
25         run(new DatatypeDemo(), args);
26     }
27
28     public DatatypeDemo() {
29     }
30
31     protected Document parse(String JavaDoc xmlFile) throws Exception JavaDoc {
32         SAXReader reader = new SAXReader();
33         reader.setDocumentFactory(DatatypeDocumentFactory.getInstance());
34         return reader.read(xmlFile);
35     }
36
37     protected void process(Document document) throws Exception JavaDoc {
38         getXMLWriter().write(document);
39     }
40 }
41
42 /*
43  * Redistribution and use of this software and associated documentation
44  * ("Software"), with or without modification, are permitted provided that the
45  * following conditions are met:
46  *
47  * 1. Redistributions of source code must retain copyright statements and
48  * notices. Redistributions must also contain a copy of this document.
49  *
50  * 2. Redistributions in binary form must reproduce the above copyright notice,
51  * this list of conditions and the following disclaimer in the documentation
52  * and/or other materials provided with the distribution.
53  *
54  * 3. The name "DOM4J" must not be used to endorse or promote products derived
55  * from this Software without prior written permission of MetaStuff, Ltd. For
56  * written permission, please contact dom4j-info@metastuff.com.
57  *
58  * 4. Products derived from this Software may not be called "DOM4J" nor may
59  * "DOM4J" appear in their names without prior written permission of MetaStuff,
60  * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
61  *
62  * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
63  *
64  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
65  * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
66  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
67  * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
68  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
69  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
70  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
71  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
72  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
73  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
74  * POSSIBILITY OF SUCH DAMAGE.
75  *
76  * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
77  *
78  * $Id: DatatypeDemo.java,v 1.4 2005/01/29 14:52:57 maartenc Exp $
79  */

80
Popular Tags