本文整理汇总了Java中org.apache.xmlbeans.SchemaType.SIMPLE_CONTENT属性的典型用法代码示例。如果您正苦于以下问题:Java SchemaType.SIMPLE_CONTENT属性的具体用法?Java SchemaType.SIMPLE_CONTENT怎么用?Java SchemaType.SIMPLE_CONTENT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.xmlbeans.SchemaType
的用法示例。
在下文中一共展示了SchemaType.SIMPLE_CONTENT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findBase64Types
/**
* 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;
}
示例2: createSampleForType
/**
* 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 );
}
}
示例3: describeSchema
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;
}
示例4: printInnerType
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();
}
示例5: createSampleForType
/**
* 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 );
}
}