def parse_attr(attr, value)
case attr
when NameAttrName
if directelement? or elementform == 'qualified'
@name = XSD::QName.new(targetnamespace, value.source)
else
@name = XSD::QName.new(nil, value.source)
end
when FormAttrName
@form = value.source
when TypeAttrName
@type = value
when RefAttrName
@ref = value
when MaxOccursAttrName
if parent.is_a?(All)
if value.source != '1'
raise Parser::AttrConstraintError.new(
"cannot parse #{value} for #{attr}")
end
end
@maxoccurs = value.source
when MinOccursAttrName
if parent.is_a?(All)
unless ['0', '1'].include?(value.source)
raise Parser::AttrConstraintError.new(
"cannot parse #{value} for #{attr}")
end
end
@minoccurs = value.source
when NillableAttrName
@nillable = (value.source == 'true')
else
nil
end
end