Esempio n. 1
0
ComplexType Parser::parseComplexType( ParserContext *context, const QDomElement &element )
{
  ComplexType newType( d->mNameSpace );

  newType.setName( element.attribute( QLatin1String("name") ) );

  if (debugParsing())
      qDebug() << "complexType:" << d->mNameSpace << newType.name();

  if ( element.hasAttribute( QLatin1String("mixed") ) )
    newType.setContentModel( XSDType::MIXED );

  QDomElement childElement = element.firstChildElement();

  AttributeGroup::List attributeGroups;

  while ( !childElement.isNull() ) {
    NSManager namespaceManager( context, childElement );
    const QName name( childElement.tagName() );
    if ( name.localName() == QLatin1String("all") ) {
      all( context, childElement, newType );
    } else if ( name.localName() == QLatin1String("sequence") ) {
      parseCompositor( context, childElement, newType );
    } else if ( name.localName() == QLatin1String("choice") ) {
      parseCompositor( context, childElement, newType );
    } else if ( name.localName() == QLatin1String("attribute") ) {
      newType.addAttribute( parseAttribute( context, childElement ) );
    } else if ( name.localName() == QLatin1String("attributeGroup") ) {
      AttributeGroup g = parseAttributeGroup( context, childElement );
      attributeGroups.append( g );
    } else if ( name.localName() == QLatin1String("anyAttribute") ) {
      addAnyAttribute( context, childElement, newType );
    } else if ( name.localName() == QLatin1String("complexContent") ) {
      parseComplexContent( context, childElement, newType );
    } else if ( name.localName() == QLatin1String("simpleContent") ) {
      parseSimpleContent( context, childElement, newType );
    } else if ( name.localName() == QLatin1String("annotation") ) {
      Annotation::List annotations = parseAnnotation( context, childElement );
      newType.setDocumentation( annotations.documentation() );
      newType.setAnnotations( annotations );
    }

    childElement = childElement.nextSiblingElement();
  }

  newType.setAttributeGroups( attributeGroups );

  return newType;
}
Esempio n. 2
0
ComplexType Parser::parseComplexType( ParserContext *context,
                                      const QDomElement &complexTypeElement,
                                      const QString elementName )
{
  ComplexType newType( d->mNameSpace );

  newType.setName( complexTypeElement.attribute( "name" ) );

  if ( complexTypeElement.hasAttribute( "mixed" ) )
    newType.setContentModel( XSDType::MIXED );

  QDomElement childElement = complexTypeElement.firstChildElement();

  AttributeGroup::List attributeGroups;

  while ( !childElement.isNull() ) {
    QName name = childElement.tagName();
    if ( name.localName() == "all" ) {
      all( context, childElement, newType );
    } else if ( name.localName() == "sequence" ) {
      parseCompositor( context, childElement, newType );
    } else if ( name.localName() == "choice" ) {
      parseCompositor( context, childElement, newType );
    } else if ( name.localName() == "attribute" ) {
      newType.addAttribute( parseAttribute( context, childElement, elementName ) );
    } else if ( name.localName() == "attributeGroup" ) {
      AttributeGroup g = parseAttributeGroup( context, childElement );
      attributeGroups.append( g );
    } else if ( name.localName() == "anyAttribute" ) {
      addAnyAttribute( context, childElement, newType );
    } else if ( name.localName() == "complexContent" ) {
      parseComplexContent( context, childElement, newType );
    } else if ( name.localName() == "simpleContent" ) {
      parseSimpleContent( context, childElement, newType );
    } else if ( name.localName() == "annotation" ) {
      Annotation::List annotations = parseAnnotation( context, childElement );
      newType.setDocumentation( annotations.documentation() );
      newType.setAnnotations( annotations );
    }

    childElement = childElement.nextSiblingElement();
  }

  newType.setAttributeGroups( attributeGroups );

  return newType;
}
Esempio n. 3
0
Annotation::List Parser::parseAnnotation( ParserContext *context, const QDomElement &element )
{
  Annotation::List result;

  QDomElement child;
  for( child = element.firstChildElement(); !child.isNull();
       child = child.nextSiblingElement() ) {
    NSManager namespaceManager( context, child );
    const QName name( child.tagName() );
    if ( name.localName() == QLatin1String("documentation") ) {
      result.append( Annotation( child ) );
    } else if ( name.localName() == QLatin1String("appinfo") ) {
      result.append( Annotation( child ) );
    }
  }

  return result;
}
Esempio n. 4
0
void Parser::all( ParserContext *context, const QDomElement &element, ComplexType &ct )
{
  QDomElement childElement = element.firstChildElement();

  while ( !childElement.isNull() ) {
    QName name = childElement.tagName();
    if ( name.localName() == "element" ) {
      ct.addElement( parseElement( context, childElement, ct.nameSpace(),
        childElement ) );
    } else if ( name.localName() == "annotation" ) {
      Annotation::List annotations = parseAnnotation( context, childElement );
      ct.setDocumentation( annotations.documentation() );
      ct.setAnnotations( annotations );
    }

    childElement = childElement.nextSiblingElement();
  }
}
Esempio n. 5
0
Annotation::List Parser::parseAnnotation( ParserContext *,
  const QDomElement &element )
{
  Annotation::List result;

  QDomElement e;
  for( e = element.firstChildElement(); !e.isNull();
       e = e.nextSiblingElement() ) {
    QName name = e.tagName();
    if ( name.localName() == "documentation" ) {
      result.append( Annotation( e ) );
    } else if ( name.localName() == "appinfo" ) {
      result.append( Annotation( e ) );
    }
  }

  return result;
}