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


Java XSType.asComplexType方法代码示例

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


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

示例1: isSubstitutable

import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
/**
 * Implements
 * <code>Validation Rule: Schema-Validity Assessment (Element) 1.2.1.2.4</code> 
 */
private static boolean isSubstitutable( XSType _base, XSType derived ) {
    // too ugly to the point that it's almost unbearable.
    // I mean, it's not even transitive. Thus we end up calling this method
    // for each candidate
    if( _base.isComplexType() ) {
        XSComplexType base = _base.asComplexType();
        
        for( ; base!=derived; derived=derived.getBaseType() ) {
            if( base.isSubstitutionProhibited( derived.getDerivationMethod() ) )
                return false;    // Type Derivation OK (Complex)-1
        }
        return true;
    } else {
        // simple type don't have any @block
        return true;
    }
}
 
开发者ID:jolie,项目名称:jolie,代码行数:22,代码来源:Util.java

示例2: getAttributeUse

import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
public XSAttributeUse getAttributeUse( String nsURI, String localName ) {
    UName name = new UName(nsURI,localName);
    
    if(prohibitedAtts.contains(name))       return null;
    
    XSAttributeUse o = attributes.get(name);
    
    
    if(o==null) {
        Iterator<XSAttGroupDecl> itr = iterateAttGroups();
        while(itr.hasNext() && o==null)
            o = itr.next().getAttributeUse(nsURI,localName);
    }
    
    if(o==null) {
        XSType base = getBaseType();
        if(base.asComplexType()!=null)
            o = base.asComplexType().getAttributeUse(nsURI,localName);
    }
    
    return o;
}
 
开发者ID:jolie,项目名称:jolie,代码行数:23,代码来源:ComplexTypeImpl.java

示例3: _valueToDocument

import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
private static void _valueToDocument( Value value, Element element, Document doc, XSType type )
{
	if ( type.isSimpleType() ) {
		element.appendChild( doc.createTextNode( value.strValue() ) );
	} else if ( type.isComplexType() ) {
		String name;
		Value currValue;
		XSComplexType complexType = type.asComplexType();

		// Iterate over attributes
		Collection< ? extends XSAttributeUse > attributeUses = complexType.getAttributeUses();
		for( XSAttributeUse attrUse : attributeUses ) {
			name = attrUse.getDecl().getName();
			if ( (currValue=getAttributeOrNull( value, name )) != null ) {
				element.setAttribute( name, currValue.strValue() );
			}
		}

		XSContentType contentType = complexType.getContentType();
		XSParticle particle = contentType.asParticle();
		if ( contentType.asSimpleType() != null ) {
			element.appendChild( doc.createTextNode( value.strValue() ) );
		} else if ( particle != null ) {
			XSTerm term = particle.getTerm();
			XSModelGroupDecl modelGroupDecl;
			XSModelGroup modelGroup = null;
			if ( (modelGroupDecl=term.asModelGroupDecl()) != null ) {
				modelGroup = modelGroupDecl.getModelGroup();
			} else if ( term.isModelGroup() ) {
				modelGroup = term.asModelGroup();
			}
			if ( modelGroup != null ) {
				_valueToDocument( value, element, doc, modelGroup );
			}
		}
	}
}
 
开发者ID:jolie,项目名称:jolie,代码行数:38,代码来源:XmlUtils.java

示例4: getAttributeWildcard

import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
public XSWildcard getAttributeWildcard() {
    WildcardImpl complete = localAttWildcard;
    
    Iterator<XSAttGroupDecl> itr = iterateAttGroups();
    while( itr.hasNext() ) {
        WildcardImpl w = (WildcardImpl)(itr.next().getAttributeWildcard());
        
        if(w==null)     continue;
        
        if(complete==null)
            complete = w;
        else
            // TODO: the spec says it's intersection,
            // but I think it has to be union.
            complete = complete.union(ownerDocument,w);
    }
    
    if( getDerivationMethod()==RESTRICTION )    return complete;
    
    WildcardImpl base=null;
    XSType baseType = getBaseType();
    if(baseType.asComplexType()!=null)
        base = (WildcardImpl)baseType.asComplexType().getAttributeWildcard();
    
    if(complete==null)  return base;
    if(base==null)      return complete;
    
    return complete.union(ownerDocument,base);
}
 
开发者ID:jolie,项目名称:jolie,代码行数:30,代码来源:ComplexTypeImpl.java

示例5: elementDecl

import com.sun.xml.xsom.XSType; //导入方法依赖的package包/类
@Override
public void elementDecl(XSElementDecl element)
{
  String elementName = element.getName();

  // If the current element has the name being searched store its type
  if (elementName.equals(this.searchName))
  {
    this.searchElement = element;

    // If the element does not refer to a type then return its content type
    // (Example create element)

  }

  // otherwise dig the content of the elements type
  else if (! ( elementName.equals(XMLTags.FIRST_CONDITION_TAG) || elementName.equals(XMLTags.SECOND_CONDITION_TAG) ))
  {
    XSType elementType = element.getType();
    XSComplexType elementComplexType = elementType.asComplexType();
    // if the type of the element is a complex type
    // visit whatever it has in its content.
    if (elementComplexType != null)
    {
      elementComplexType.getContentType().visit(this);
    }
  }
}
 
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:29,代码来源:XSDElementFinder.java


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