InputStream is = new FileInputStream(Resources.asURI("redefine2.xsd"));
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
XmlSchema schema = schemaCol.read(new StreamSource(is), null);
XmlSchemaObjectTable xsot = schema.getElements();
assertEquals(1, xsot.getCount());
XmlSchemaElement xse = null;
for (Iterator i = xsot.getValues(); i.hasNext(); ) {
xse = (XmlSchemaElement)i.next();
}
assertEquals("vip", xse.getName());
assertEquals(new QName("http://soapinterop.org/types",
"person"),
xse.getSchemaTypeName());
XmlSchemaObjectCollection xsoc = schema.getIncludes();
assertEquals(1, xsoc.getCount());
XmlSchemaRedefine xsr = (XmlSchemaRedefine)xsoc.getItem(0);
xsot = xsr.getSchemaTypes();
assertEquals(1, xsot.getCount());
for (Iterator i = xsot.getNames(); i.hasNext(); ) {
QName qname = (QName)i.next();
assertEquals(new QName("http://soapinterop.org/types",
"person"), qname);
}
XmlSchemaComplexType xsct = null;
for (Iterator i = xsot.getValues(); i.hasNext(); ) {
xsct = (XmlSchemaComplexType)i.next();
}
assertNotNull(xsct);
XmlSchemaContentModel xscm = xsct.getContentModel();