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


Java SchemaType类代码示例

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


SchemaType类属于org.apache.xmlbeans包,在下文中一共展示了SchemaType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: createSample

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
public String createSample( SchemaType sType )
{
	XmlObject object = XmlObject.Factory.newInstance();
	XmlCursor cursor = object.newCursor();
	// Skip the document node
	cursor.toNextToken();
	// Using the type and the cursor, call the utility method to get a
	// sample XML payload for that Schema element
	createSampleForType( sType, cursor );
	// Cursor now contains the sample payload
	// Pretty print the result. Note that the cursor is positioned at the
	// end of the doc so we use the original xml object that the cursor was
	// created upon to do the xmlText() against.

	cursor.dispose();

	XmlOptions options = new XmlOptions();
	options.put( XmlOptions.SAVE_PRETTY_PRINT );
	options.put( XmlOptions.SAVE_PRETTY_PRINT_INDENT, 3 );
	options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );
	options.setSaveOuter();
	String result = object.xmlText( options );

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

示例3: createSampleForType

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
public static String createSampleForType( SchemaType sType )
{
	XmlObject object = XmlObject.Factory.newInstance();
	XmlCursor cursor = object.newCursor();
	// Skip the document node
	cursor.toNextToken();
	// Using the type and the cursor, call the utility method to get a
	// sample XML payload for that Schema element
	new SampleXmlUtil( false ).createSampleForType( sType, cursor );
	// Cursor now contains the sample payload
	// Pretty print the result. Note that the cursor is positioned at the
	// end of the doc so we use the original xml object that the cursor was
	// created upon to do the xmlText() against.

	cursor.dispose();
	XmlOptions options = new XmlOptions();
	options.put( XmlOptions.SAVE_PRETTY_PRINT );
	options.put( XmlOptions.SAVE_PRETTY_PRINT_INDENT, 3 );
	options.put( XmlOptions.SAVE_AGGRESSIVE_NAMESPACES );
	options.setSaveOuter();
	String result = object.xmlText( options );

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

示例4: pickLength

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
private int pickLength( SchemaType sType )
{
	XmlInteger length = ( XmlInteger )sType.getFacet( SchemaType.FACET_LENGTH );
	if( length != null )
		return length.getBigIntegerValue().intValue();
	XmlInteger min = ( XmlInteger )sType.getFacet( SchemaType.FACET_MIN_LENGTH );
	XmlInteger max = ( XmlInteger )sType.getFacet( SchemaType.FACET_MAX_LENGTH );
	int minInt, maxInt;
	if( min == null )
		minInt = 0;
	else
		minInt = min.getBigIntegerValue().intValue();
	if( max == null )
		maxInt = Integer.MAX_VALUE;
	else
		maxInt = max.getBigIntegerValue().intValue();
	// We try to keep the length of the array within reasonable limits,
	// at least 1 item and at most 3 if possible
	if( minInt == 0 && maxInt >= 1 )
		minInt = 1;
	if( maxInt > minInt + 2 )
		maxInt = minInt + 2;
	if( maxInt < minInt )
		maxInt = minInt;
	return minInt + pick( maxInt - minInt );
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:27,代码来源:SampleXmlUtil.java

示例5: startInterface

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
void startInterface(SchemaType sType) throws IOException {
  String shortName = sType.getShortJavaName();

  String baseInterface = findJavaType(sType.getBaseType());

  /*
   * StringBuffer specializedInterfaces = new StringBuffer(); if (sType.getSimpleVariety() == SchemaType.ATOMIC &&
   * sType.getPrimitiveType().getBuiltinTypeCode() == SchemaType.BTC_DECIMAL) { int bits = sType.getDecimalSize(); if
   * (bits == SchemaType.SIZE_BIG_INTEGER) specializedInterfaces.append(", org.apache.xmlbeans.BigIntegerValue" ); if
   * (bits == SchemaType.SIZE_LONG) specializedInterfaces.append(", org.apache.xmlbeans.LongValue"); if (bits <=
   * SchemaType.SIZE_INT) specializedInterfaces.append(", org.apache.xmlbeans.IntValue"); } if
   * (sType.getSimpleVariety() == SchemaType.LIST) specializedInterfaces.append(", org.apache.xmlbeans.ListValue"); if
   * (sType.getSimpleVariety() == SchemaType.UNION) { SchemaType ctype = sType.getUnionCommonBaseType(); String
   * javaTypeHolder = javaTypeHolderForType(ctype); if (javaTypeHolder != null) specializedInterfaces.append(", " +
   * javaTypeHolder); }
   */

  emit("public interface " + shortName + " extends " + baseInterface + getExtensionInterfaces(sType));
  emit("{");
  indent();
  emitSpecializedAccessors(sType);
}
 
开发者ID:nortal,项目名称:j-road,代码行数:23,代码来源:XteeSchemaCodePrinter.java

示例6: getBaseClass

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
String getBaseClass(SchemaType sType) {
  SchemaType baseType = findBaseType(sType.getBaseType());

  switch (sType.getSimpleVariety()) {
  case SchemaType.NOT_SIMPLE:
    // non-simple-content: inherit from base type impl
    if (!XmlObject.type.equals(baseType))
      return baseType.getFullJavaImplName();
    return "org.apache.xmlbeans.impl.values.XmlComplexContentImpl";

  case SchemaType.ATOMIC:
    // We should only get called for restrictions
    assert(!sType.isBuiltinType());
    return getAtomicRestrictionType(sType);

  case SchemaType.LIST:
    return "org.apache.xmlbeans.impl.values.XmlListImpl";

  case SchemaType.UNION:
    return "org.apache.xmlbeans.impl.values.XmlUnionImpl";

  default:
    throw new IllegalStateException();
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:26,代码来源:XteeSchemaCodePrinter.java

示例7: printConstructor

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
void printConstructor(SchemaType sType, String shortName) throws IOException {
  emit("");
  emit("public " + shortName + "(org.apache.xmlbeans.SchemaType sType)");
  startBlock();
  emit("super(sType" + (sType.getSimpleVariety() == SchemaType.NOT_SIMPLE ? "" : ", " + !sType.isSimpleType())
      + ");");
  endBlock();

  if (sType.getSimpleVariety() != SchemaType.NOT_SIMPLE) {
    emit("");
    emit("protected " + shortName + "(org.apache.xmlbeans.SchemaType sType, boolean b)");
    startBlock();
    emit("super(sType, b);");
    endBlock();
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:17,代码来源:XteeSchemaCodePrinter.java

示例8: startClass

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
void startClass(SchemaType sType, boolean isInner) throws IOException {
  String shortName = sType.getShortJavaImplName();
  String baseClass = getBaseClass(sType);
  StringBuffer interfaces = new StringBuffer();
  interfaces.append(sType.getFullJavaName().replace('$', '.'));

  if (sType.getSimpleVariety() == SchemaType.UNION) {
    SchemaType[] memberTypes = sType.getUnionMemberTypes();
    for (int i = 0; i < memberTypes.length; i++)
      interfaces.append(", " + memberTypes[i].getFullJavaName().replace('$', '.'));
  }

  emit("public " + (isInner ? "static " : "") + "class " + shortName + " extends " + baseClass + " implements "
      + interfaces.toString());

  startBlock();

  emit("private static final long serialVersionUID = 1L;");
}
 
开发者ID:nortal,项目名称:j-road,代码行数:20,代码来源:XteeSchemaCodePrinter.java

示例9: emitPost

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
void emitPost(SchemaType sType, int opType, String identifier, boolean isAttr, String index) throws IOException {
  SchemaTypeImpl sImpl = getImpl(sType);
  if (sImpl == null)
    return;

  PrePostExtension ext = sImpl.getPrePostExtension();
  if (ext != null) {
    if (ext.hasPreCall()) {
      endBlock();
    }

    if (ext.hasPostCall())
      emit(ext.getStaticHandler() + ".postSet(" + prePostOpString(opType) + ", this, " + identifier + ", " + isAttr
          + ", " + index + ");");
  }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:17,代码来源:XteeSchemaCodePrinter.java

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

示例11: printExtensionImplMethods

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
private void printExtensionImplMethods(SchemaType sType) throws IOException {
  SchemaTypeImpl sImpl = getImpl(sType);
  if (sImpl == null)
    return;

  InterfaceExtension[] exts = sImpl.getInterfaceExtensions();
  if (exts != null)
    for (int i = 0; i < exts.length; i++) {
      InterfaceExtension.MethodSignature[] methods = exts[i].getMethods();
      if (methods != null) {
        for (int j = 0; j < methods.length; j++) {
          printJavaDoc("Implementation method for interface " + exts[i].getStaticHandler());
          printInterfaceMethodDecl(methods[j]);
          startBlock();
          printInterfaceMethodImpl(exts[i].getStaticHandler(), methods[j]);
          endBlock();
        }
      }
    }
}
 
开发者ID:nortal,项目名称:j-road,代码行数:21,代码来源:XteeSchemaCodePrinter.java

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

示例13: pickLength

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
private int pickLength(SchemaType sType)
{
    XmlInteger length = (XmlInteger) sType.getFacet(SchemaType.FACET_LENGTH);
    if (length != null)
        return length.getBigIntegerValue().intValue();
    XmlInteger min    = (XmlInteger) sType.getFacet(SchemaType.FACET_MIN_LENGTH);
    XmlInteger max    = (XmlInteger) sType.getFacet(SchemaType.FACET_MAX_LENGTH);
    int minInt, maxInt;
    if (min == null)
        minInt = 0;
    else
        minInt = min.getBigIntegerValue().intValue();
    if (max == null)
        maxInt = Integer.MAX_VALUE;
    else
        maxInt = max.getBigIntegerValue().intValue();
    // We try to keep the length of the array within reasonable limits,
    // at least 1 item and at most 3 if possible
    if (minInt == 0 && maxInt >= 1)
        minInt = 1;
    if (maxInt > minInt + 2)
        maxInt = minInt + 2;
    if (maxInt < minInt)
        maxInt = minInt;
    return minInt + pick(maxInt-minInt);
}
 
开发者ID:HuaweiSNC,项目名称:OpsDev,代码行数:27,代码来源:RestfulApiSchemaManager.java

示例14: findPlainBase64Types

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
/**
 * @param sts
 * @return array list
 */
private static List findPlainBase64Types(SchemaTypeSystem sts) {
    ArrayList allSeenTypes = new ArrayList();

    allSeenTypes.addAll(Arrays.asList(sts.documentTypes()));
    allSeenTypes.addAll(Arrays.asList(sts.globalTypes()));

    ArrayList base64Types = new ArrayList();

    for (Iterator iterator = allSeenTypes.iterator(); iterator.hasNext();) {
        SchemaType stype = (SchemaType)iterator.next();
        findPlainBase64Types(stype, base64Types, new ArrayList());
    }

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

示例15: qualifySubstitutionGroup

import org.apache.xmlbeans.SchemaType; //导入依赖的package包/类
/**
  * Qualifies a valid member of a substitution group. This method tries to use the
  * built-in {@link XmlObject#substitute(QName, SchemaType)} and if succesful returns
  * a valid substitution which is usable (not disconnected). If it fails, it uses
  * low-level {@link XmlCursor} manipulation to qualify the substitution group. Note
  * that if the latter is the case the resulting document is disconnected and should
  * no longer be manipulated. Thus, use it as a final step after all markup is included.
  *
  * If newType is null, this method will skip {@link XmlObject#substitute(QName, SchemaType)}
  * and directly use {@link XmlCursor}. This can be used, if you are sure that the substitute
  * is not in the list of (pre-compiled) valid substitutions (this is the case if a schema
  * uses another schema's type as a base for elements. E.g. om:Observation uses gml:_Feature
  * as the base type).
  *
  * @param xobj
  * 		the abstract element
  * @param newInstance
  * 		the new {@link QName} of the instance
  * @param newType the new schemaType. if null, cursors will be used and the resulting object
  * 		will be disconnected.
  * @return if successful applied {@link XmlObject#substitute(QName, SchemaType)} a living object with a
  * 		type == newType is returned. Otherwise null is returned as you can no longer manipulate the object.
  */
 public static XmlObject qualifySubstitutionGroup(XmlObject xobj, QName newInstance, SchemaType newType) {
   XmlObject	substitute = null;

   if (newType != null) {
     substitute = xobj.substitute(newInstance, newType);
     if (substitute != null && substitute.schemaType() == newType
  && substitute.getDomNode().getLocalName().equals(newInstance.getLocalPart()))
     {
return substitute;
     }
   }

   XmlCursor cursor = xobj.newCursor();
   cursor.setName(newInstance);
   QName qName = new QName("http://www.w3.org/2001/XMLSchema-instance", "type");
   cursor.removeAttribute(qName);
   cursor.toNextToken();
   if (cursor.isNamespace()) {
     cursor.removeXml();
   }

   cursor.dispose();

   return null;
 }
 
开发者ID:pinaraf,项目名称:ebics,代码行数:49,代码来源:EbicsXmlFactory.java


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