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


Java SchemaType.getName方法代码示例

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


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

示例1: printNestedInnerTypes

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
void printNestedInnerTypes(SchemaType sType, SchemaTypeSystem system) throws IOException {
  boolean redefinition = sType.getName() != null && sType.getName().equals(sType.getBaseType().getName());
  while (sType != null) {
    SchemaType[] anonTypes = sType.getAnonymousTypes();
    for (int i = 0; i < anonTypes.length; i++) {
      if (anonTypes[i].isSkippedAnonymousType())
        printNestedInnerTypes(anonTypes[i], system);
      else {
        printInnerType(anonTypes[i], system);
      }
    }
    // For redefinition other than by extension for complex types, go
    // ahead and print
    // the anonymous types in the base
    if (!redefinition || (sType.getDerivationType() != SchemaType.DT_EXTENSION && !sType.isSimpleType()))
      break;
    sType = sType.getBaseType();
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:20,代码来源:XteeSchemaCodePrinter.java

示例2: getDerivedProperties

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
private SchemaProperty[] getDerivedProperties(SchemaType sType) {
  // We have to see if this is redefined, because if it is we have
  // to include all properties associated to its supertypes
  QName name = sType.getName();
  if (name != null && name.equals(sType.getBaseType().getName())) {
    SchemaType sType2 = sType.getBaseType();
    // Walk all the redefined types and record any properties
    // not present in sType, because the redefined types do not
    // have a generated class to represent them
    SchemaProperty[] props = sType.getDerivedProperties();
    Map<QName, SchemaProperty> propsByName = new LinkedHashMap<QName, SchemaProperty>();
    for (int i = 0; i < props.length; i++)
      propsByName.put(props[i].getName(), props[i]);
    while (sType2 != null && name.equals(sType2.getName())) {
      props = sType2.getDerivedProperties();
      for (int i = 0; i < props.length; i++)
        if (!propsByName.containsKey(props[i].getName()))
          propsByName.put(props[i].getName(), props[i]);
      sType2 = sType2.getBaseType();
    }
    return propsByName.values().toArray(new SchemaProperty[0]);
  } else
    return sType.getDerivedProperties();
}
 
开发者ID:nortal,项目名称:j-road,代码行数:25,代码来源:XteeSchemaCodePrinter.java

示例3: printNestedTypeImpls

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
void printNestedTypeImpls(SchemaType sType, SchemaTypeSystem system) throws IOException {
  boolean redefinition = sType.getName() != null && sType.getName().equals(sType.getBaseType().getName());
  while (sType != null) {
    SchemaType[] anonTypes = sType.getAnonymousTypes();
    for (int i = 0; i < anonTypes.length; i++) {
      if (anonTypes[i].isSkippedAnonymousType())
        printNestedTypeImpls(anonTypes[i], system);
      else {
        printInnerTypeImpl(anonTypes[i], system, true);
      }
    }
    // For redefinition by extension, go ahead and print the anonymous
    // types in the base
    if (!redefinition || (sType.getDerivationType() != SchemaType.DT_EXTENSION && !sType.isSimpleType()))
      break;
    sType = sType.getBaseType();
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:19,代码来源:XteeSchemaCodePrinter.java

示例4: processSimpleType

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
private void processSimpleType( SchemaType stype, XmlCursor xmlc )
{
	if( _soapEnc )
	{
		QName typeName = stype.getName();
		if( typeName != null )
		{
			xmlc.insertAttributeWithValue( XSI_TYPE, formatQName( xmlc, typeName ) );
		}
	}

	String sample = sampleDataForSimpleType( stype );
	xmlc.insertChars( sample );
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:15,代码来源:SampleXmlUtil.java

示例5: getClosestName

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
/**
 * This method will get the base type for the schema type
 */

@SuppressWarnings( "unused" )
private static QName getClosestName( SchemaType sType )
{
	while( sType.getName() == null )
		sType = sType.getBaseType();

	return sType.getName();
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:13,代码来源:SampleXmlUtil.java

示例6: printInnerTypeJavaDoc

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
void printInnerTypeJavaDoc(SchemaType sType) throws IOException {
  QName name = sType.getName();
  if (name == null) {
    if (sType.isDocumentType())
      name = sType.getDocumentElementName();
    else if (sType.isAttributeType())
      name = sType.getAttributeTypeAttributeName();
    else if (sType.getContainerField() != null)
      name = sType.getContainerField().getName();
  }

  emit("/**");
  if (sType.isDocumentType())
    emit(" * A document containing one " + prettyQName(name) + " element.");
  else if (sType.isAttributeType())
    emit(" * A document containing one " + prettyQName(name) + " attribute.");
  else if (name != null)
    emit(" * An XML " + prettyQName(name) + ".");
  else
    emit(" * An anonymous inner XML type.");
  emit(" *");
  switch (sType.getSimpleVariety()) {
  case SchemaType.NOT_SIMPLE:
    emit(" * This is a complex type.");
    break;
  case SchemaType.ATOMIC:
    emit(" * This is an atomic type that is a restriction of " + getFullJavaName(sType) + ".");
    break;
  case SchemaType.LIST:
    emit(" * This is a list type whose items are " + sType.getListItemType().getFullJavaName() + ".");
    break;
  case SchemaType.UNION:
    emit(" * This is a union type. Instances are of one of the following types:");
    SchemaType[] members = sType.getUnionConstituentTypes();
    for (int i = 0; i < members.length; i++)
      emit(" *     " + members[i].getFullJavaName());
    break;
  }
  emit(" */");
}
 
开发者ID:nortal,项目名称:j-road,代码行数:41,代码来源:XteeSchemaCodePrinter.java

示例7: processAttributes

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
private void processAttributes(SchemaType stype, XmlCursor xmlc)
{
    if (_soapEnc)
    {
        QName typeName = stype.getName();
        if (typeName != null)
        {
            xmlc.insertAttributeWithValue(XSI_TYPE, formatQName(xmlc, typeName));
        }
    }
    
    SchemaProperty[] attrProps = stype.getAttributeProperties();
    for (int i = 0; i < attrProps.length; i++)
    {
        SchemaProperty attr = attrProps[i];
        if (_soapEnc)
        {
            if (SKIPPED_SOAP_ATTRS.contains(attr.getName()))
                continue;
            if (ENC_ARRAYTYPE.equals(attr.getName()))
            {
                SOAPArrayType arrayType = ((SchemaWSDLArrayType)stype.getAttributeModel().getAttribute(attr.getName())).getWSDLArrayType();
                if (arrayType != null)
                    xmlc.insertAttributeWithValue(attr.getName(), formatQName(xmlc, arrayType.getQName()) + arrayType.soap11DimensionString());
                continue;
            }
        }
        String defaultValue = attr.getDefaultText();
        xmlc.insertAttributeWithValue(attr.getName(), defaultValue == null ?
            sampleDataForSimpleType(attr.getType()) : defaultValue);
    }
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:33,代码来源:RestfulApiSchemaManager.java

示例8: getClosestName

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
/**
 * This method will get the base type for the schema type
 */

private static QName getClosestName(SchemaType sType)
{
    while (sType.getName() == null)
        sType = sType.getBaseType();

    return sType.getName();
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:12,代码来源:RestfulApiSchemaManager.java

示例9: 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

示例10: processAttributes

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
private void processAttributes( SchemaType stype, XmlCursor xmlc )
{
	if( _soapEnc )
	{
		QName typeName = stype.getName();
		if( typeName != null )
		{
			xmlc.insertAttributeWithValue( XSI_TYPE, formatQName( xmlc, typeName ) );
		}
	}

	SchemaProperty[] attrProps = stype.getAttributeProperties();
	for( int i = 0; i < attrProps.length; i++ )
	{
		SchemaProperty attr = attrProps[i];
		if( attr.getMinOccurs().intValue() == 0 && ignoreOptional )
			continue;

		if( attr.getName().equals( new QName( "http://www.w3.org/2005/05/xmlmime", "contentType" ) ) )
		{
			xmlc.insertAttributeWithValue( attr.getName(), "application/?" );
			continue;
		}

		if( _soapEnc )
		{
			if( SKIPPED_SOAP_ATTRS.contains( attr.getName() ) )
				continue;
			if( ENC_ARRAYTYPE.equals( attr.getName() ) )
			{
				SOAPArrayType arrayType = ( ( SchemaWSDLArrayType )stype.getAttributeModel().getAttribute(
						attr.getName() ) ).getWSDLArrayType();
				if( arrayType != null )
					xmlc.insertAttributeWithValue( attr.getName(), formatQName( xmlc, arrayType.getQName() )
							+ arrayType.soap11DimensionString() );
				continue;
			}
		}

		String value = null;
		if( multiValues != null )
		{
			String[] values = multiValues.get( attr.getName() );
			if( values != null )
				value = StringUtils.join( values, "," );
		}
		if( value == null )
			value = attr.getDefaultText();
		if( value == null )
			value = sampleDataForSimpleType( attr.getType() );

		xmlc.insertAttributeWithValue( attr.getName(), value );
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:55,代码来源:SampleXmlUtil.java

示例11: 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

示例12: combinationString

import org.apache.xmlbeans.SchemaType; //导入方法依赖的package包/类
private String combinationString(SchemaType sType)
{
 
    XmlDecimal xmlMin = (XmlDecimal) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
    XmlDecimal xmlMax = (XmlDecimal) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
    XmlDecimal xmlLength = (XmlDecimal) sType.getFacet(SchemaType.FACET_LENGTH);

    BigDecimal min = xmlMin != null ? xmlMin.getBigDecimalValue() : null;
    BigDecimal max = xmlMax != null ? xmlMax.getBigDecimalValue() : null;
    BigDecimal length = xmlLength != null ? xmlLength.getBigDecimalValue() : null;
    String[] lstpattern = sType.getPatterns();
    String strName = "";
    if(null != sType.getName())
    {
        strName = sType.getName().getLocalPart();
    }
    
    String datatype = "'STRING'";
    String example = "'string'";
    if (_bIsAttrib)
    {
        StringBuffer strContent = new StringBuffer();
        strContent.append("{");
        strContent.append("'data-type':");
        if("ipv4Address".equalsIgnoreCase(strName))
        {
            datatype = "'IPV4'";
            example = "'127.0.0.1'";
            
        } else if("ipv6Address".equalsIgnoreCase(strName))
        {
            datatype = "'IPV6'";
            example = "'2001:da8:8000:1:202:120:2:101'";
        }  
        strContent.append(datatype);
        
        if(null != length)
        {
            strContent.append(", 'length':'").append(length.toString()).append("'");
        } 
        if(null != min)
        {
            strContent.append(", 'min':'").append(min.toString()).append("'");
        }
        if(null != max)
        {
            strContent.append(", 'max':'").append(max.toString()).append("'");
        }
     /*   if(lstpattern.length > 0)
        {
            strContent.append(", 'pattern':'").append(lstpattern[0]);
        }*/

        strContent.append(", 'example':").append(example);
        strContent.append("}");
        return strContent.toString();
    }
    
    return "string";
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:61,代码来源:RestfulApiSchemaManager.java


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