当前位置: 首页>>代码示例>>Java>>正文


Java SchemaType.getContentType方法代码示例

本文整理汇总了Java中org.apache.xmlbeans.SchemaType.getContentType方法的典型用法代码示例。如果您正苦于以下问题:Java SchemaType.getContentType方法的具体用法?Java SchemaType.getContentType怎么用?Java SchemaType.getContentType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xmlbeans.SchemaType的用法示例。


在下文中一共展示了SchemaType.getContentType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findBase64Types

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
/**
 * Populate the base64 types The algo is to look for simpletypes that have base64 content, and
 * then step out of that onestep and get the element. For now there's an extended check to see
 * whether the simple type is related to the Xmime:contentType!
 *
 * @param sts
 */
private static List findBase64Types(SchemaTypeSystem sts) {
    List allSeenTypes = new ArrayList();
    List base64ElementQNamesList = new ArrayList();
    SchemaType outerType;
    //add the document types and global types
    allSeenTypes.addAll(Arrays.asList(sts.documentTypes()));
    allSeenTypes.addAll(Arrays.asList(sts.globalTypes()));

    for (int i = 0; i < allSeenTypes.size(); i++) {
        SchemaType sType = (SchemaType)allSeenTypes.get(i);

        if (sType.getContentType() == SchemaType.SIMPLE_CONTENT &&
                sType.getPrimitiveType() != null) {
            if (org.apache.axis2.namespace.Constants.BASE_64_CONTENT_QNAME
                    .equals(sType.getPrimitiveType().getName())) {
                outerType = sType.getOuterType();
                //check the outer type further to see whether it has the contenttype attribute from
                //XMime namespace
                SchemaProperty[] properties = sType.getProperties();
                for (int j = 0; j < properties.length; j++) {
                    if (org.apache.axis2.namespace.Constants.XMIME_CONTENT_TYPE_QNAME
                            .equals(properties[j].getName())) {
                        //add this only if it is a document type ??
                        if (outerType.isDocumentType()) {
                            base64ElementQNamesList.add(outerType.getDocumentElementName());
                        }
                        break;
                    }
                }
            }
        }
        //add any of the child types if there are any
        allSeenTypes.addAll(Arrays.asList(sType.getAnonymousTypes()));
    }

    return base64ElementQNamesList;
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:45,代码来源:CodeGenerationUtility.java

示例2: createSampleForType

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
/**
 * Cursor position Before: <theElement>^</theElement> After:
 * <theElement><lots of stuff/>^</theElement>
 */
public void createSampleForType( SchemaType stype, XmlCursor xmlc )
{
	_exampleContent = SoapUI.getSettings().getBoolean( WsdlSettings.XML_GENERATION_TYPE_EXAMPLE_VALUE );
	_typeComment = SoapUI.getSettings().getBoolean( WsdlSettings.XML_GENERATION_TYPE_COMMENT_TYPE );
	_skipComments = SoapUI.getSettings().getBoolean( WsdlSettings.XML_GENERATION_SKIP_COMMENTS );

	QName nm = stype.getName();
	if( nm == null && stype.getContainerField() != null )
		nm = stype.getContainerField().getName();

	if( nm != null && excludedTypes.contains( nm ) )
	{
		if( !_skipComments )
			xmlc.insertComment( "Ignoring type [" + nm + "]" );
		return;
	}

	if( _typeStack.contains( stype ) )
		return;

	_typeStack.add( stype );

	try
	{
		if( stype.isSimpleType() || stype.isURType() )
		{
			processSimpleType( stype, xmlc );
			return;
		}

		// complex Type
		// <theElement>^</theElement>
		processAttributes( stype, xmlc );

		// <theElement attri1="string">^</theElement>
		switch( stype.getContentType() )
		{
		case SchemaType.NOT_COMPLEX_TYPE :
		case SchemaType.EMPTY_CONTENT :
			// noop
			break;
		case SchemaType.SIMPLE_CONTENT :
		{
			processSimpleType( stype, xmlc );
		}
			break;
		case SchemaType.MIXED_CONTENT :
			xmlc.insertChars( pick( WORDS ) + " " );
			if( stype.getContentModel() != null )
			{
				processParticle( stype.getContentModel(), xmlc, true );
			}
			xmlc.insertChars( pick( WORDS ) );
			break;
		case SchemaType.ELEMENT_CONTENT :
			if( stype.getContentModel() != null )
			{
				processParticle( stype.getContentModel(), xmlc, false );
			}
			break;
		}
	}
	finally
	{
		_typeStack.remove( _typeStack.size() - 1 );
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:72,代码来源:SampleXmlUtil.java

示例3: describeSchema

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
public String describeSchema(SchemaType sType, int indentLvl) {
	String repr = "";
	String indent = "";
	for (int i=0; i<indentLvl; i++)
		indent += "\t";
	
	String name = "";
	String namespace = "";
	if (sType.getName() != null) {
		name = sType.getName().getLocalPart();
		namespace = sType.getName().getNamespaceURI();
	}
	if (sType.isSimpleType()) {
		repr += indent + "<simpleType name=\"" + name + "\" namespace=\"" + namespace + "\" ";
		// Don't bother describing primitive types further
		if (sType.getSimpleVariety() == SchemaType.ATOMIC && sType.isPrimitiveType())
			return repr + "/>\n";
		repr += ">\n";
		switch (sType.getSimpleVariety()) {
			case SchemaType.ATOMIC:
				repr += indent + "\t<restriction base=\"" + sType.getPrimitiveType().getName() + "\" ";
				if (!facetRestrictions.isEmpty()) {
					repr +=  ">\n";
					for (Map.Entry<String, String[]> entry : facetRestrictions.entrySet()) {
						for (String val : entry.getValue())
							repr += indent + "\t\t<" + entry.getKey() + " value=\"" + val + "\" />\n";
					}
					repr += indent + "\t</restriction>\n";
				} else
					repr += "/>\n";
				break;
			case SchemaType.LIST:
				repr += indent + "\t<list>\n";
				repr += indent + describeSchema(sType.getListItemType(), (indentLvl + 1));
				repr += indent + "\t</list>\n";
				break;
			case SchemaType.UNION:
				repr += indent + "\t<union>\n";
				for (SchemaType memberType : sType.getUnionMemberTypes())
					repr += describeSchema(memberType, (indentLvl + 2));
				repr += indent + "\t</union>\n";
				break;
			default:
				repr += indent + "\tERROR";
				break;
		}
		repr += indent + "</simpleType>\n";
	} else { // Complex type
		repr += indent + "<complexType name=\"" + name + "\" namespace=\"" + namespace + "\" ";
		if (sType.getContentType() == SchemaType.MIXED_CONTENT)
			repr += "mixed=\"true\" ";
		repr += ">\n";
		for (MSPSchemaTypeAttribute attr : attributeProperties) {
			repr += indent + "\t<attribute " + attr.toString() + ">\n";
			repr += attr.getSchemaType().toString((indentLvl + 2));
			repr += indent + "\t</attribute>\n";
		}
		switch (sType.getContentType()) {
			case SchemaType.EMPTY_CONTENT:
				repr += indent + "\t<!-- Empty Content -->\n";
				break;
			case SchemaType.SIMPLE_CONTENT:
				repr += indent + "\t<simpleContent>\n";
				repr += describeSchema(sType.getContentBasedOnType(), (indentLvl + 2));
				repr += indent + "\t</simpleContent>\n";
				break;
			default: //Element or Mixed Content
				repr += indent + "\t<complexContent>\n";
				for (MSPSchemaTypeElement elmt : elementProperties) {
					repr += indent +  "\t\t<element " + elmt.toString() + ">\n";
					repr += elmt.getSchemaType().toString((indentLvl + 3));
					repr += indent + "\t\t</element>\n";
				}
				repr += indent + "\t</complexContent>\n";
				break;
		}
		repr += indent + "</complexType>\n";
	}
	return repr;
}
 
开发者ID:dpinney,项目名称:essence,代码行数:81,代码来源:MSSchemaTypeParser.java

示例4: printInnerType

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
void printInnerType(SchemaType sType, SchemaTypeSystem system) throws IOException {
  emit("");

  printInnerTypeJavaDoc(sType);

  startInterface(sType);

  printStaticTypeDeclaration(sType, system);

  if (sType.isSimpleType()) {
    if (sType.hasStringEnumValues())
      printStringEnumeration(sType);
  } else {
    if (sType.getContentType() == SchemaType.SIMPLE_CONTENT && sType.hasStringEnumValues())
      printStringEnumeration(sType);

    SchemaProperty[] props = getDerivedProperties(sType);

    for (int i = 0; i < props.length; i++) {
      SchemaProperty prop = props[i];

      // change begin - find annotation text
      String xteeTitle = findXteeTitle(prop);
      // change end - find annotation text

      printPropertyGetters(prop.getName(),
                           prop.isAttribute(),
                           prop.getJavaPropertyName(),
                           prop.getJavaTypeCode(),
                           javaTypeForProperty(prop),
                           xmlTypeForProperty(prop),
                           prop.hasNillable() != SchemaProperty.NEVER,
                           prop.extendsJavaOption(),
                           prop.extendsJavaArray(),
                           prop.extendsJavaSingleton(),
                           xteeTitle,
                           i + 1L);

      if (!prop.isReadOnly()) {
        printPropertySetters(prop.getName(),
                             prop.isAttribute(),
                             prop.getJavaPropertyName(),
                             prop.getJavaTypeCode(),
                             javaTypeForProperty(prop),
                             xmlTypeForProperty(prop),
                             prop.hasNillable() != SchemaProperty.NEVER,
                             prop.extendsJavaOption(),
                             prop.extendsJavaArray(),
                             prop.extendsJavaSingleton());
      }
    }

  }

  printNestedInnerTypes(sType, system);

  printFactory(sType);

  endBlock();
}
 
开发者ID:nortal,项目名称:j-road,代码行数:61,代码来源:XteeSchemaCodePrinter.java

示例5: createSampleForType

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
/**
 * Cursor position
 * Before:
 * <theElement>^</theElement>
 * After:
 * <theElement><lots of stuff/>^</theElement>
 */
private void createSampleForType(SchemaType stype, XmlCursor xmlc, Map<String, String> mapValues)
{
    if (_typeStack.contains( stype ))
        return;

    _typeStack.add( stype );
    
    try
    {
        if (stype.isSimpleType() || stype.isURType())
        {
            processSimpleType(stype, xmlc, mapValues);
            return;
        }
        
        // complex Type
        // <theElement>^</theElement>
        processAttributes(stype, xmlc);
        
        // <theElement attri1="string">^</theElement>
        switch (stype.getContentType())
        {
            case SchemaType.NOT_COMPLEX_TYPE :
            case SchemaType.EMPTY_CONTENT :
                // noop
                break;
            case SchemaType.SIMPLE_CONTENT :
                {
                    processSimpleType(stype, xmlc, mapValues);
                }
                break;
            case SchemaType.MIXED_CONTENT :
                xmlc.insertChars(pick(WORDS) + " ");
                if (stype.getContentModel() != null)
                {
                    processParticle(stype.getContentModel(), xmlc, true);
                }
                xmlc.insertChars(pick(WORDS));
                break;
            case SchemaType.ELEMENT_CONTENT :
                if (stype.getContentModel() != null)
                {
                    processParticle(stype.getContentModel(), xmlc, false);
                }
                break;
        }
    }
    finally
    {
        _typeStack.remove( _typeStack.size() - 1 );
    }
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:60,代码来源:RestfulApiSchemaManager.java


注:本文中的org.apache.xmlbeans.SchemaType.getContentType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。