예제 #1
0
void ComplexBaseInputField::xmlData( QDomDocument &document, QDomElement &parent )
{
  QDomElement element = document.createElement( mName );

  XSD::Element::List elements = mType->elements();
  XSD::Element::List::ConstIterator elemIt;
  for ( elemIt = elements.constBegin(); elemIt != elements.constEnd(); ++elemIt ) {
    InputField *field = childField( (*elemIt).name() );
    if ( !field ) {
      qDebug( "ComplexBaseInputField: No child found" );
    } else {
      field->xmlData( document, element );
    }
  }

  XSD::Attribute::List attributes = mType->attributes();
  XSD::Attribute::List::ConstIterator attrIt;
  for ( attrIt = attributes.constBegin(); attrIt != attributes.constEnd(); ++attrIt ) {
    InputField *field = childField( (*attrIt).name() );
    if ( !field ) {
      qDebug( "ComplexBaseInputField: No child found" );
    } else {
      element.setAttribute( field->name(), field->data() );
    }
  }

  parent.appendChild( element );
}
예제 #2
0
QString SimpleBaseInputField::data() const
{
  if ( mType->subType() == Schema::SimpleType::TypeRestriction ) {
    InputField *field = mFields.first();
    if ( !field ) {
      qDebug( "SimpleBaseInputField: No child found" );
    } else {
      field->data();
    }
  } else {
    qDebug( "SimpleBaseInputField: Unsupported subtype" );
  }

  return QString();
}