'Create new data field of specified name,value and type.
Also \'required\',\'desc\' and \'options\' fields can be set.
Alternatively other XML object can be passed in as the \'node\' parameted to replicate it as a new datafiled.'

def __init__(self, name=None, value=None, typ=None, required=0, label=None, desc=None, options=[], node=None):

    Node.__init__(self, 'field', node=node)
    if name:
        self.setVar(name)
    if (type(value) in [list, tuple]):
        self.setValues(value)
    elif value:
        self.setValue(value)
    if typ:
        self.setType(typ)
    elif ((not typ) and (not node)):
        self.setType('text-single')
    if required:
        self.setRequired(required)
    if label:
        self.setLabel(label)
    if desc:
        self.setDesc(desc)
    if options:
        self.setOptions(options)
