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


Java XmlCursor.insertComment方法代码示例

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


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

示例1: processChoice

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void processChoice( SchemaParticle sp, XmlCursor xmlc, boolean mixed )
{
	SchemaParticle[] spc = sp.getParticleChildren();
	if( !_skipComments )
		xmlc.insertComment( "You have a CHOICE of the next " + String.valueOf( spc.length ) + " items at this level" );

	for( int i = 0; i < spc.length; i++ )
	{
		processParticle( spc[i], xmlc, mixed );
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:12,代码来源:SampleXmlUtil.java

示例2: processAll

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void processAll( SchemaParticle sp, XmlCursor xmlc, boolean mixed )
{
	SchemaParticle[] spc = sp.getParticleChildren();
	if( !_skipComments )
		xmlc.insertComment( "You may enter the following " + String.valueOf( spc.length ) + " items in any order" );

	for( int i = 0; i < spc.length; i++ )
	{
		processParticle( spc[i], xmlc, mixed );
		if( mixed && i < spc.length - 1 )
			xmlc.insertChars( pick( WORDS ) );
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:14,代码来源:SampleXmlUtil.java

示例3: addElementTypeAndRestricionsComment

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void addElementTypeAndRestricionsComment( SchemaLocalElement element, XmlCursor xmlc )
{

	SchemaType type = element.getType();
	if( _typeComment && ( type != null && type.isSimpleType() ) )
	{
		String info = "";

		XmlAnySimpleType[] values = type.getEnumerationValues();
		if( values != null && values.length > 0 )
		{
			info = " - enumeration: [";
			for( int c = 0; c < values.length; c++ )
			{
				if( c > 0 )
					info += ",";

				info += values[c].getStringValue();
			}

			info += "]";
		}

		if( type.isAnonymousType() )
			xmlc.insertComment( "anonymous type" + info );
		else
			xmlc.insertComment( "type: " + type.getName().toString() + info );
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:30,代码来源:SampleXmlUtil.java

示例4: determineMinMaxForSample

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private int determineMinMaxForSample(SchemaParticle sp, XmlCursor xmlc)
{
    int minOccurs = sp.getIntMinOccurs();
    int maxOccurs = sp.getIntMaxOccurs();
    
    if (minOccurs == maxOccurs)
        return minOccurs;
    
    int result = minOccurs;
    if (result == 0)
        result = 1;
    
    if (sp.getParticleType() != SchemaParticle.ELEMENT)
        return result;
    
    // it probably only makes sense to put comments in front of individual elements that repeat
    
    if (sp.getMaxOccurs() == null)
    {
        // xmlc.insertComment("The next " + getItemNameOrType(sp, xmlc) + " may be repeated " + minOccurs + " or more times");
        // 删除 注解
        /*            if (minOccurs == 0)
            xmlc.insertComment("Zero or more repetitions:");
        else
            xmlc.insertComment(minOccurs + " or more repetitions:");*/
    }
    else if (sp.getIntMaxOccurs() > 1)
    {
        xmlc.insertComment(minOccurs + " to " + String.valueOf(sp.getMaxOccurs()) + " repetitions:");
    }
    else
    {
        // 删除注解
        //xmlc.insertComment("Optional:");
    }
    return result;
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:38,代码来源:RestfulApiSchemaManager.java

示例5: createSampleForType

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的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

示例6: determineMinMaxForSample

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private int determineMinMaxForSample( SchemaParticle sp, XmlCursor xmlc )
{
	int minOccurs = sp.getIntMinOccurs();
	int maxOccurs = sp.getIntMaxOccurs();

	if( minOccurs == maxOccurs )
		return minOccurs;

	if( minOccurs == 0 && ignoreOptional )
		return 0;

	int result = minOccurs;
	if( result == 0 )
		result = 1;

	if( sp.getParticleType() != SchemaParticle.ELEMENT )
		return result;

	// it probably only makes sense to put comments in front of individual
	// elements that repeat

	if( !_skipComments )
	{
		if( sp.getMaxOccurs() == null )
		{
			// xmlc.insertComment("The next " + getItemNameOrType(sp, xmlc) + "
			// may
			// be repeated " + minOccurs + " or more times");
			if( minOccurs == 0 )
				xmlc.insertComment( "Zero or more repetitions:" );
			else
				xmlc.insertComment( minOccurs + " or more repetitions:" );
		}
		else if( sp.getIntMaxOccurs() > 1 )
		{
			xmlc.insertComment( minOccurs + " to " + String.valueOf( sp.getMaxOccurs() ) + " repetitions:" );
		}
		else
		{
			xmlc.insertComment( "Optional:" );
		}
	}

	return result;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:46,代码来源:SampleXmlUtil.java

示例7: processWildCard

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void processWildCard( SchemaParticle sp, XmlCursor xmlc, boolean mixed )
{
	if( !_skipComments )
		xmlc.insertComment( "You may enter ANY elements at this point" );
	// xmlc.insertElement("AnyElement");
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:7,代码来源:SampleXmlUtil.java

示例8: processWildCard

import org.apache.xmlbeans.XmlCursor; //导入方法依赖的package包/类
private void processWildCard(SchemaParticle sp, XmlCursor xmlc, boolean mixed)
{
    xmlc.insertComment("You may enter ANY elements at this point");
    xmlc.insertElement("AnyElement");
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:6,代码来源:RestfulApiSchemaManager.java


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