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: TestSchemaParse.java,v 1.6 2004/06/25 08:03:48 maartenc Exp $ 8 */ 9 10 package org.dom4j.datatype; 11 12 import java.net.URL; 13 import junit.framework.Test; 14 import junit.framework.TestSuite; 15 import junit.textui.TestRunner; 16 17 import org.dom4j.AbstractTestCase; 18 import org.dom4j.Document; 19 import org.dom4j.io.SAXReader; 20 21 22 /*** Tests the SchemaParser based on a test case provided by 23 * Luis Peña Sánchez 24 * 25 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a> 26 * @version $Revision: 1.6 $ 27 */ 28 public class TestSchemaParse extends AbstractTestCase { 29 30 public static void main( String[] args ) { 31 TestRunner.run( suite() ); 32 } 33 34 public static Test suite() { 35 return new TestSuite( TestSchemaParse.class ); 36 } 37 38 public TestSchemaParse(String name) { 39 super(name); 40 } 41 42 // Test case(s) 43 //------------------------------------------------------------------------- 44 public void testParseSchema() throws Exception { 45 DatatypeDocumentFactory factory = new DatatypeDocumentFactory(); 46 47 SAXReader reader = new SAXReader(); 48 reader.setDocumentFactory( factory ); 49 50 URL url = getClass().getResource("/xml/test/LuisSchema.xsd"); 51 Document schema = reader.read(url); 52 factory.loadSchema(schema); 53 54 log( "Loaded the schema" ); 55 56 // now load an instance document 57 } 58 } 59 60 61 62 63 /* 64 * Redistribution and use of this software and associated documentation 65 * ("Software"), with or without modification, are permitted provided 66 * that the following conditions are met: 67 * 68 * 1. Redistributions of source code must retain copyright 69 * statements and notices. Redistributions must also contain a 70 * copy of this document. 71 * 72 * 2. Redistributions in binary form must reproduce the 73 * above copyright notice, this list of conditions and the 74 * following disclaimer in the documentation and/or other 75 * materials provided with the distribution. 76 * 77 * 3. The name "DOM4J" must not be used to endorse or promote 78 * products derived from this Software without prior written 79 * permission of MetaStuff, Ltd. For written permission, 80 * please contact dom4j-info@metastuff.com. 81 * 82 * 4. Products derived from this Software may not be called "DOM4J" 83 * nor may "DOM4J" appear in their names without prior written 84 * permission of MetaStuff, Ltd. DOM4J is a registered 85 * trademark of MetaStuff, Ltd. 86 * 87 * 5. Due credit should be given to the DOM4J Project - 88 * http://www.dom4j.org 89 * 90 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS 91 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT 92 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 93 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 94 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 95 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 96 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 97 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 98 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 99 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 100 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 101 * OF THE POSSIBILITY OF SUCH DAMAGE. 102 * 103 * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved. 104 * 105 * $Id: TestSchemaParse.java,v 1.6 2004/06/25 08:03:48 maartenc Exp $ 106 */