1   package tests;
2   
3   import junit.framework.TestCase;
4   import org.apache.ws.commons.schema.XmlSchema;
5   import org.apache.ws.commons.schema.XmlSchemaCollection;
6   import org.apache.ws.commons.schema.XmlSchemaElement;
7   import org.apache.ws.commons.schema.XmlSchemaType;
8   
9   import javax.xml.namespace.QName;
10  import javax.xml.transform.stream.StreamSource;
11  import java.io.FileInputStream;
12  import java.io.InputStream;
13  /*
14   * Copyright 2004,2007 The Apache Software Foundation.
15   *
16   * Licensed under the Apache License, Version 2.0 (the "License");
17   * you may not use this file except in compliance with the License.
18   * You may obtain a copy of the License at
19   *
20   *      http://www.apache.org/licenses/LICENSE-2.0
21   *
22   * Unless required by applicable law or agreed to in writing, software
23   * distributed under the License is distributed on an "AS IS" BASIS,
24   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25   * See the License for the specific language governing permissions and
26   * limitations under the License.
27   */
28  
29  public class MixedContentTest extends TestCase {
30      public void testMixedContent() throws Exception {
31          QName ELEMENT_QNAME = new QName("http://soapinterop.org/xsd",
32                                          "complexElt");
33  
34  
35          InputStream is = new FileInputStream(Resources.asURI("mixedContent.xsd"));
36          XmlSchemaCollection schema = new XmlSchemaCollection();
37          XmlSchema s = schema.read(new StreamSource(is), null);
38  
39          XmlSchemaElement elementByName = s.getElementByName(ELEMENT_QNAME);
40          assertNotNull(elementByName);
41  
42          XmlSchemaType schemaType = elementByName.getSchemaType();
43          assertNotNull(schemaType);
44  
45          assertTrue(schemaType.isMixed());
46      }
47  }