void SimpleBaseInputField::setData( const QString &data ) { if ( mType->subType() == Schema::SimpleType::TypeRestriction ) { InputField *field = mFields.first(); if ( !field ) { qDebug( "SimpleBaseInputField: No child found" ); } else { field->setData( data ); } } else { qDebug( "SimpleBaseInputField: Unsupported subtype" ); } }
void ComplexBaseInputField::setXMLData( const QDomElement &element ) { if ( mName != element.tagName() ) { qDebug( "ComplexBaseInputField: Wrong dom element passed: expected %s, got %s", qPrintable( mName ), qPrintable( element.tagName() ) ); return; } // elements if ( mType->isArray() ) { InputField *field = childField( "item" ); field->setXMLData( element ); } else { QDomNode node = element.firstChild(); while ( !node.isNull() ) { QDomElement child = node.toElement(); if ( !child.isNull() ) { InputField *field = childField( child.tagName() ); if ( !field ) { qDebug( "ComplexBaseInputField: Child field %s does not exists", qPrintable( child.tagName() ) ); } else { field->setXMLData( child ); } } node = node.nextSibling(); } } // attributes QDomNamedNodeMap nodes = element.attributes(); for ( int i = 0; i < nodes.count(); ++i ) { QDomNode node = nodes.item( i ); QDomAttr attr = node.toAttr(); InputField *field = childField( attr.name() ); if ( !field ) { qDebug( "ComplexBaseInputField: Child field %s does not exists", qPrintable( attr.name() ) ); } else { field->setData( attr.value() ); } } }