View Javadoc

1   /**
2    * 
3    */
4   package tests;
5   
6   import java.io.InputStream;
7   
8   import javax.xml.transform.stream.StreamSource;
9   
10  import org.apache.ws.commons.schema.XmlSchema;
11  import org.apache.ws.commons.schema.XmlSchemaCollection;
12  import org.apache.ws.commons.schema.XmlSchemaObjectTable;
13  
14  import junit.framework.TestCase;
15  
16  
17  public class SingleElementNoNamespace extends TestCase {
18  	
19  	public void testReadOneElement() throws Exception {
20  
21  		InputStream is = 
22  			SingleElementNoNamespace.class.
23  				getClassLoader().getResourceAsStream("singleElementNoNamespace.xsd");
24  		XmlSchemaCollection schemaCol = new XmlSchemaCollection();
25  		XmlSchema schema = schemaCol.read(new StreamSource(is), null);
26  		XmlSchemaObjectTable objectTable = schema.getElements();
27  		assertEquals(1, objectTable.getCount());
28  	}
29  }