예제 #1
0
 protected void setUp() throws Exception {
   schema = SchemaManager.getSchemaForSchema();
   assertNotNull(schema);
   for (int i = 0; i < elementNames.length; i++) {
     Element elm = schema.getElement(schemaQName(elementNames[i]));
     if (elm == null) throw new AssertionFailedError("Can't get element " + elementNames[i]);
     elementMap.put(elementNames[i], elm);
   }
 }
예제 #2
0
  public void testElements() {
    Element element = schema.getElement(schemaQName("element"));

    List attribs = element.getAllAttributes();
    checkNameList(element_attribs, attribs, false);

    List arrays = element.getAllArrays();
    checkNameList(element_arrays, arrays, true);
  }
예제 #3
0
  public void testAttribute() {

    CompositeMap schemaCm = new CompositeMap(null, SchemaConstant.SCHEMA_NAMESPACE, "schema");
    CompositeMap attributes = new CompositeMap(null, SchemaConstant.SCHEMA_NAMESPACE, "attributes");
    schemaCm.addChild(attributes);
    System.out.println("schemaCm:\n" + schemaCm.toXML());

    Element element = schema.getSchemaManager().getElement(attributes);
    assertNotNull(element);

    CompositeMap elementCm = new CompositeMap(null, SchemaConstant.SCHEMA_NAMESPACE, "element");
    CompositeMap newAttributes =
        new CompositeMap(null, SchemaConstant.SCHEMA_NAMESPACE, "attributes");
    elementCm.addChild(newAttributes);
    System.out.println("elementCm:\n" + elementCm.toXML());

    Element newElement = schema.getSchemaManager().getElement(newAttributes);
    //        assertNull(newElement);
    assertNotNull(newElement);
  }