本文整理汇总了Java中com.sun.xml.xsom.XSType类的典型用法代码示例。如果您正苦于以下问题:Java XSType类的具体用法?Java XSType怎么用?Java XSType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XSType类属于com.sun.xml.xsom包,在下文中一共展示了XSType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getComplexTypeToElementName
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private Map<QName, List<QName>> getComplexTypeToElementName(ClassOutline classOutline) {
Map<QName, List<QName>> complexTypeToElementName = new HashMap<QName, List<QName>>();
XSSchemaSet schemaSet = classOutline.target.getSchemaComponent().getRoot();
for (XSSchema schema : schemaSet.getSchemas()) {
Map<String, XSElementDecl> elemDecls = schema.getElementDecls();
for (Entry<String, XSElementDecl> entry : elemDecls.entrySet()) {
XSElementDecl decl = entry.getValue();
XSType xsType = decl.getType();
if (xsType.getName() == null) {
continue;
}
QName type = new QName(xsType.getTargetNamespace(), xsType.getName());
List<QName> qnames = complexTypeToElementName.get(type);
if (qnames == null) {
qnames = new ArrayList<QName>();
complexTypeToElementName.put(type, qnames);
}
qnames.add(new QName(decl.getTargetNamespace(), decl.getName()));
}
}
return complexTypeToElementName;
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:27,代码来源:SchemaProcessor.java
示例2: 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
示例3: elementDecl
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
/**
* Creates node for element declaration with additional attributes.
*
* @param decl Element declaration.
* @param extraAtts Additional attributes.
*/
private void elementDecl(XSElementDecl decl, String extraAtts) {
XSType type = decl.getType();
// TODO: various other attributes
String str = MessageFormat.format("Element name=\"{0}\"{1}{2}",
new Object[]{
decl.getName(),
type.isLocal() ? "" : " type=\"{"
+ type.getTargetNamespace() + "}"
+ type.getName() + "\"", extraAtts});
SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator());
this.currNode.add(newNode);
this.currNode = newNode;
if (type.isLocal()) {
if (type.isLocal()) {
type.visit(this);
}
}
this.currNode = (SchemaTreeNode) this.currNode.getParent();
}
开发者ID:jolie,项目名称:jolie,代码行数:31,代码来源:SchemaTreeTraverser.java
示例4: elementDecl
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private void elementDecl( XSElementDecl decl, String extraAtts ) {
XSType type = decl.getType();
// TODO: various other attributes
println(MessageFormat.format("<element name=\"{0}\"{1}{2}{3}>",
new Object[]{
decl.getName(),
type.isLocal()?"":" type=\"{"+
type.getTargetNamespace()+'}'+
type.getName()+'\"',
extraAtts,
type.isLocal()?"":"/"
}));
if(type.isLocal()) {
indent++;
if(type.isLocal()) type.visit(this);
indent--;
println("</element>");
}
}
开发者ID:jolie,项目名称:jolie,代码行数:25,代码来源:SchemaWriter.java
示例5: 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
示例6: XsTypeToMetadataType
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
static int XsTypeToMetadataType(XSType xsType) {
String name = "";
if (xsType != null) {
name = xsType.getName();
}
if ("byte".equalsIgnoreCase(name)) {
return ProductData.TYPE_UINT8;
} else if ("integer".equalsIgnoreCase(name)) {
return ProductData.TYPE_INT32;
} else if ("double".equalsIgnoreCase(name) ||
"real".equalsIgnoreCase(name) ||
"float".equalsIgnoreCase(name)) {
return ProductData.TYPE_FLOAT32;
} else if ("date".equals(name) ||
"dateTime".equals(name)) {
return ProductData.TYPE_UTC;
} else {
return ProductData.TYPE_ASCII;
}
}
开发者ID:senbox-org,项目名称:s2tbx,代码行数:21,代码来源:RapidEyeL1SchemaHelper.java
示例7: XsTypeToMetadataType
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private static int XsTypeToMetadataType(XSType xsType) {
String name = "";
if (xsType != null) {
name = xsType.getName();
}
if ("byte".equalsIgnoreCase(name)) {
return ProductData.TYPE_UINT8;
} else if ("integer".equalsIgnoreCase(name)) {
return ProductData.TYPE_INT32;
} else if ("double".equalsIgnoreCase(name) ||
"real".equalsIgnoreCase(name)) {
return ProductData.TYPE_FLOAT32;
} else if ("date".equals(name) ||
"dateTime".equals(name)) {
return ProductData.TYPE_UTC;
} else {
return ProductData.TYPE_ASCII;
}
}
开发者ID:senbox-org,项目名称:s2tbx,代码行数:20,代码来源:DimapSchemaHelper.java
示例8: getConstraints
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
public ContentPriorityIF getConstraints(SchemaElementIF element)
{
XSType type = element.getXSType(schemaSet);
if (tagToConstraints.containsKey(type))
{
return tagToConstraints.get(type);
}
else
{
XSDConstraintsMiner constraintsMiner = new XSDConstraintsMiner();
type.visit(constraintsMiner);
ContentPriorityIF contentPriority = constraintsMiner.getContentPriority();
return contentPriority;
}
}
开发者ID:terraframe,项目名称:Runway-SDK,代码行数:18,代码来源:XSDConstraintsManager.java
示例9: isDerivedFromComplexType
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private boolean isDerivedFromComplexType(XSSchema schema, String localPart) {
XSType base = schema.getType(localPart);
if (base != null) {
if (base.isSimpleType()) {
typeFlag.add(TypeFlag.NO_ABSTRACT_GML);
typeFlag.add(TypeFlag.NO_FEATURE);
typeFlag.add(TypeFlag.NO_FEATURE_COLLECTION);
typeFlag.add(TypeFlag.NO_CITY_OBJECT);
typeFlag.add(TypeFlag.NO_GEOMETRY);
typeFlag.add(TypeFlag.NO_FEATURE_PROPERTY);
typeFlag.add(TypeFlag.NO_GEOMETRY_PROPERTY);
return false;
} else
return element.getType().isDerivedFrom(base);
}
return false;
}
开发者ID:citygml4j,项目名称:citygml4j,代码行数:20,代码来源:ElementDecl.java
示例10: getPossibleValues
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
/**
* Retrieves allowed values for a restricted type
*
* @param inputName
* SOAP input
* @return allowed values for the input or an empty list if the type of the
* input is not a string restriction
*/
public List<String> getPossibleValues(String inputName) {
List<String> values = new ArrayList<String>();
XSElementDecl element = schemaElements.get(inputName);
if (element == null)
return values;
XSType type = element.getType();
if (type == null || !(type instanceof XSRestrictionSimpleType))
return values;
XSRestrictionSimpleType res = (XSRestrictionSimpleType) type;
String baseType = res.getBaseType().getName();
// allow only xsd:string "enumerations"
if (!baseType.equals("string"))
return values;
for (XSFacet facet : res.getDeclaredFacets()) {
String value = facet.getValue().toString();
values.add(value);
}
return values;
}
开发者ID:impactcentre,项目名称:iif-generic-soap-client,代码行数:34,代码来源:WsdlDocument.java
示例11: hasAnnotation
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
public static boolean hasAnnotation(XSType xsType, QName annotationElementName) {
if (xsType.getName() == null) {
return false;
}
Element annotationElement = getAnnotationElement(xsType.getAnnotation(), annotationElementName);
if (annotationElement != null) {
return true;
}
if (xsType.getBaseType() != null && !xsType.getBaseType().equals(xsType)) {
return hasAnnotation(xsType.getBaseType(), annotationElementName);
}
return false;
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:14,代码来源:SchemaProcessorUtil.java
示例12: _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
示例13: createSimpleType
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private TypeDefinition createSimpleType( XSType type, XSElementDecl element, Range range )
{
checkType( type );
TypeInlineDefinition right = new TypeInlineDefinition( parsingContext, element.getName().replace("-","_"), XsdUtils.xsdToNativeType( type.getName() ), range );
if ( element.isNillable() ) {
TypeInlineDefinition left = new TypeInlineDefinition( parsingContext, element.getName().replace("-","_"), NativeType.VOID, range );
return new TypeChoiceDefinition( parsingContext, element.getName().replace("-","_"), range, left, right );
} else {
return right;
}
}
开发者ID:jolie,项目名称:jolie,代码行数:15,代码来源:XsdToJolieConverterImpl.java
示例14: checkForNativeType
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
/**
* Checks whether a native type for a given simple type is defined.
*/
private void checkForNativeType( XSType type, String msg )
throws ConversionException
{
if ( XsdUtils.xsdToNativeType( type.getName() ) == null ) {
if ( !strict() ) {
log( Level.WARNING, msg + " Name: " + type.getName() );
} else {
throw new ConversionException( ERROR_SIMPLE_TYPE + msg + " Name: " + type.getName() );
}
}
}
开发者ID:jolie,项目名称:jolie,代码行数:15,代码来源:XsdToJolieConverterImpl.java
示例15: contains
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
public boolean contains(XSType type) {
if( typeSet.contains(type) ) {
return true;
} else {
XSType baseType = type.getBaseType();
if( baseType == null ) {
return false;
} else {
// climb the super type hierarchy
return contains(baseType);
}
}
}
开发者ID:jolie,项目名称:jolie,代码行数:14,代码来源:TypeClosure.java
示例16: iterateTypes
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
public Iterator<XSType> iterateTypes() {
return new Iterators.Map<XSType,XSSchema>(iterateSchema()) {
protected Iterator<XSType> apply(XSSchema u) {
return u.iterateTypes();
}
};
}
开发者ID:jolie,项目名称:jolie,代码行数:8,代码来源:SchemaSetImpl.java
示例17: isDerivedFrom
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
public boolean isDerivedFrom(XSType t) {
XSType x = this;
while(true) {
if(t==x)
return true;
XSType s = x.getBaseType();
if(s==x)
return false;
x = s;
}
}
开发者ID:jolie,项目名称:jolie,代码行数:12,代码来源:SimpleTypeImpl.java
示例18: listDirectSubstitutables
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private static XSType[] listDirectSubstitutables( XSType _this ) {
ArrayList r = new ArrayList();
// TODO: handle @block
Iterator itr = ((SchemaImpl)_this.getOwnerSchema()).parent.iterateTypes();
while( itr.hasNext() ) {
XSType t = (XSType)itr.next();
if( t.getBaseType()==_this )
r.add(t);
}
return (XSType[]) r.toArray(new XSType[r.size()]);
}
开发者ID:jolie,项目名称:jolie,代码行数:13,代码来源:Util.java
示例19: buildSubstitutables
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
private static void buildSubstitutables( XSType head, XSType _this, Set substitutables ) {
if(!isSubstitutable(head,_this))
return; // no derived type of _this can substitute head.
if(substitutables.add(_this)) {
XSType[] child = listDirectSubstitutables(_this);
for( int i=0; i<child.length; i++ )
buildSubstitutables( head, child[i], substitutables );
}
}
开发者ID:jolie,项目名称:jolie,代码行数:11,代码来源:Util.java
示例20: updateSubstitutabilityMap
import com.sun.xml.xsom.XSType; //导入依赖的package包/类
public void updateSubstitutabilityMap() {
ElementDecl parent = this;
XSType type = this.getType();
boolean rused = false;
boolean eused = false;
while( (parent=(ElementDecl)parent.getSubstAffiliation())!=null ) {
if(parent.isSubstitutionDisallowed(XSType.SUBSTITUTION))
continue;
boolean rd = parent.isSubstitutionDisallowed(XSType.RESTRICTION);
boolean ed = parent.isSubstitutionDisallowed(XSType.EXTENSION);
if( (rd && rused) || ( ed && eused ) ) continue;
XSType parentType = parent.getType();
while(type!=parentType) {
if(type.getDerivationMethod()==XSType.RESTRICTION) rused = true;
else eused = true;
type = type.getBaseType();
if(type==null) // parentType and type doesn't share the common base type. a bug in the schema.
break;
if( type.isComplexType() ) {
rd |= type.asComplexType().isSubstitutionProhibited(XSType.RESTRICTION);
ed |= type.asComplexType().isSubstitutionProhibited(XSType.EXTENSION);
}
}
if( (rd && rused) || ( ed && eused ) ) continue;
// this element can substitute "parent"
parent.addSubstitutable(this);
}
}
开发者ID:jolie,项目名称:jolie,代码行数:39,代码来源:ElementDecl.java
注:本文中的com.sun.xml.xsom.XSType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论