protected Attribute createAttribute(Element node) throws Exception {
  String typeStr;
  String name;
  int type;
  Attribute result;
  ArrayList<String> values;
  ProtectedProperties metadata;
  Vector<Element> list;
  ArrayList<Attribute> atts;
  result=null;
  name=node.getAttribute(ATT_NAME);
  typeStr=node.getAttribute(ATT_TYPE);
  if (typeStr.equals(VAL_NUMERIC)) {
    type=Attribute.NUMERIC;
  }
 else   if (typeStr.equals(VAL_DATE)) {
    type=Attribute.DATE;
  }
 else   if (typeStr.equals(VAL_NOMINAL)) {
    type=Attribute.NOMINAL;
  }
 else   if (typeStr.equals(VAL_STRING)) {
    type=Attribute.STRING;
  }
 else   if (typeStr.equals(VAL_RELATIONAL)) {
    type=Attribute.RELATIONAL;
  }
 else {
    throw new Exception("Attribute type '" + typeStr + "' is not supported!");
  }
  metadata=createMetadata(node);
switch (type) {
case Attribute.NUMERIC:
    if (metadata == null) {
      result=new Attribute(name);
    }
 else {
      result=new Attribute(name,metadata);
    }
  break;
case Attribute.DATE:
if (metadata == null) {
  result=new Attribute(name,node.getAttribute(ATT_FORMAT));
}
 else {
  result=new Attribute(name,node.getAttribute(ATT_FORMAT),metadata);
}
break;
case Attribute.NOMINAL:
values=createLabels(node);
if (metadata == null) {
result=new Attribute(name,values);
}
 else {
result=new Attribute(name,values,metadata);
}
break;
case Attribute.STRING:
if (metadata == null) {
result=new Attribute(name,(ArrayList<String>)null);
}
 else {
result=new Attribute(name,(ArrayList<String>)null,metadata);
}
break;
case Attribute.RELATIONAL:
list=getChildTags(node,TAG_ATTRIBUTES);
node=list.get(0);
atts=createAttributes(node,new int[1]);
if (metadata == null) {
result=new Attribute(name,new Instances(name,atts,0));
}
 else {
result=new Attribute(name,new Instances(name,atts,0),metadata);
}
break;
}
return result;
}

protected Attribute createAttribute ( Element node ) throws Exception { String typeStr ; String name ; int type ; Attribute result ; ArrayList < String > values ; ProtectedProperties metadata ; Vector < Element > list ; ArrayList < Attribute > atts ; result = null ; name = node . getAttribute ( ATT_NAME ) ; typeStr = node . getAttribute ( ATT_TYPE ) ; if ( typeStr . equals ( VAL_NUMERIC ) ) { type = Attribute . NUMERIC ; } else if ( typeStr . equals ( VAL_DATE ) ) { type = Attribute . DATE ; } else if ( typeStr . equals ( VAL_NOMINAL ) ) { type = Attribute . NOMINAL ; } else if ( typeStr . equals ( VAL_STRING ) ) { type = Attribute . STRING ; } else if ( typeStr . equals ( VAL_RELATIONAL ) ) { type = Attribute . RELATIONAL ; } else { throw new Exception ( "Attribute type '" + typeStr + "' is not supported!" ) ; } metadata = createMetadata ( node ) ; switch ( type ) { case Attribute . NUMERIC : if ( metadata == null ) { result = new Attribute ( name ) ; } else { result = new Attribute ( name , metadata ) ; } break ; case Attribute . DATE : if ( metadata == null ) { result = new Attribute ( name , node . getAttribute ( ATT_FORMAT ) ) ; } else { result = new Attribute ( name , node . getAttribute ( ATT_FORMAT ) , metadata ) ; } break ; case Attribute . NOMINAL : values = createLabels ( node ) ; if ( metadata == null ) { result = new Attribute ( name , values ) ; } else { result = new Attribute ( name , values , metadata ) ; } break ; case Attribute . STRING : if ( metadata == null ) { result = new Attribute ( name , ( ArrayList < String > ) null ) ; } else { result = new Attribute ( name , ( ArrayList < String > ) null , metadata ) ; } break ; case Attribute . RELATIONAL : list = getChildTags ( node , TAG_ATTRIBUTES ) ; node = list . get ( 0 ) ; atts = createAttributes ( node , new int [ 1 ] ) ; if ( metadata == null ) { result = new Attribute ( name , new Instances ( name , atts , 0 ) ) ; } else { result = new Attribute ( name , new Instances ( name , atts , 0 ) , metadata ) ; } break ; } return result ; }
creates an attribute from the given xml node
