public void testXercesIncomplete() throws Exception {
   XSModel xsModel = getXSModel("testIncomplete.xml", "test.xsd");
   XSElementDeclaration elementDeclaration = xsModel.getElementDeclaration("a", "");
   XSComplexTypeDefinition typeDefinition =
       (XSComplexTypeDefinition) elementDeclaration.getTypeDefinition();
   CMBuilder cmBuilder = new CMBuilder(new CMNodeFactory());
   XSCMValidator validator = cmBuilder.getContentModel((XSComplexTypeDecl) typeDefinition, true);
   int[] ints = validator.startContentModel();
   Vector vector = validator.whatCanGoHere(ints);
   XSElementDecl o = (XSElementDecl) vector.get(0);
   assertEquals("b", o.getName());
 }
  public void testXercesForCompletion() throws Exception {
    XSModel xsModel = getXSModel("testCompletion.xml", "test.xsd");
    PsiElement element = myFixture.getFile().findElementAt(getEditor().getCaretModel().getOffset());
    XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);

    assert tag != null;
    XSElementDeclaration elementDeclaration =
        xsModel.getElementDeclaration(tag.getLocalName(), tag.getNamespace());
    XSComplexTypeDefinition typeDefinition =
        (XSComplexTypeDefinition) elementDeclaration.getTypeDefinition();
    CMBuilder cmBuilder = new CMBuilder(new CMNodeFactory());
    XSCMValidator validator = cmBuilder.getContentModel((XSComplexTypeDecl) typeDefinition, true);
    int[] ints = validator.startContentModel();
    Vector vector = validator.whatCanGoHere(ints);
    XSElementDecl o = (XSElementDecl) vector.get(0);
    assertEquals("b", o.getName());
  }
 /**
  * [schema default]
  *
  * @return The canonical lexical representation of the declaration's {value constraint} value.
  * @see <a href="http://www.w3.org/TR/xmlschema-1/#e-schema_default>XML Schema Part 1: Structures
  *     [schema default]</a>
  */
 public String getSchemaDefault() {
   return fDeclaration == null ? null : fDeclaration.getConstraintValue();
 }