public XMLDescriptor addEmployeeDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Employee.class);
    descriptor.setDefaultRootElement("employee");

    XMLCompositeObjectMapping addr = new XMLCompositeObjectMapping();
    addr.setAttributeName("address");
    addr.setXPath("address");
    addr.setReferenceClass(Address.class);
    descriptor.addMapping(addr);

    XMLCompositeCollectionMapping phone = new XMLCompositeCollectionMapping();
    phone.setAttributeName("phoneNumbers");
    phone.setXPath("phone-number");
    phone.setReferenceClass(PhoneNumber.class);
    phone.useCollectionClass(ArrayList.class);
    descriptor.addMapping(phone);

    XMLAnyObjectMapping object = new XMLAnyObjectMapping();
    object.setAttributeName("anyObject");
    object.setXPath("any-object");
    descriptor.addMapping(object);

    XMLAnyCollectionMapping anyCollection = new XMLAnyCollectionMapping();
    anyCollection.setAttributeName("anyCollection");
    anyCollection.setXPath("any-collection");
    anyCollection.useCollectionClass(ArrayList.class);
    descriptor.addMapping(anyCollection);

    this.addDescriptor(descriptor);
    return descriptor;
  }
  public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(AnyCollectionRoot.class);
    descriptor.setDefaultRootElement("root");

    XMLAnyCollectionMapping mapping = new XMLAnyCollectionMapping();
    mapping.setAttributeName("any");
    mapping.setGetMethodName("getAny");
    mapping.setSetMethodName("setAny");
    descriptor.addMapping(mapping);

    return descriptor;
  }
  public ClassDescriptor buildRootDescriptor() {
    XMLDescriptor descriptor = new XMLDescriptor();
    descriptor.setJavaClass(Root.class);
    descriptor.setDefaultRootElement("root");

    XMLAnyCollectionMapping mapping = new XMLAnyCollectionMapping();
    mapping.setAttributeName("any");
    mapping.setGetMethodName("getAny");
    mapping.setSetMethodName("setAny");
    mapping.setKeepAsElementPolicy(UnmarshalKeepAsElementPolicy.KEEP_UNKNOWN_AS_ELEMENT);
    descriptor.addMapping(mapping);

    return descriptor;
  }