本文整理汇总了Java中com.sun.xml.xsom.XSTerm.asModelGroup方法的典型用法代码示例。如果您正苦于以下问题:Java XSTerm.asModelGroup方法的具体用法?Java XSTerm.asModelGroup怎么用?Java XSTerm.asModelGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.xsom.XSTerm
的用法示例。
在下文中一共展示了XSTerm.asModelGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findModelGroups
import com.sun.xml.xsom.XSTerm; //导入方法依赖的package包/类
private static Collection<? extends XSDeclaration> findModelGroups(final XSComplexType complexType) {
XSContentType contentType = complexType.getExplicitContent();
if (contentType == null) {
contentType = complexType.getContentType();
}
final XSParticle particle = contentType.asParticle();
if (particle != null && !particle.isRepeated()) {
final XSTerm term = particle.getTerm();
if (term instanceof XSModelGroupDecl) {
return Collections.singletonList((XSModelGroupDecl)term);
} else {
final XSModelGroup modelGroup = term.asModelGroup();
return modelGroup != null ? findModelGroups(modelGroup) : Collections.<XSModelGroupDecl>emptyList();
}
} else {
return Collections.emptyList();
}
}
示例2: _valueToDocument
import com.sun.xml.xsom.XSTerm; //导入方法依赖的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 );
}
}
}
}
示例3: getModelGroup
import com.sun.xml.xsom.XSTerm; //导入方法依赖的package包/类
private XSModelGroup getModelGroup( XSModelGroupDecl modelGroupDecl, XSTerm term )
{
if ( (modelGroupDecl = term.asModelGroupDecl()) != null ) {
return modelGroupDecl.getModelGroup();
} else if ( term.isModelGroup() ) {
return term.asModelGroup();
} else {
return null;
}
}