本文整理汇总了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 );
}
}
示例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 ) );
}
}
示例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 );
}
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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");
}
示例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");
}