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


Java XSElementDecl类代码示例

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


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

示例1: validateIsFaultType

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
public static boolean validateIsFaultType(NamespaceType namespace, SchemaElementType type, File baseSchemaDir)
    throws Exception {
    XSOMParser parser = new XSOMParser();
    parser.setErrorHandler(new DefaultErrorHandler());

    parser.parse(new File(baseSchemaDir.getAbsolutePath() + File.separator + namespace.getLocation()));

    XSSchemaSet sset = parser.getResult();
    XSComplexType bfct = sset.getComplexType(IntroduceConstants.BASEFAULTS_NAMESPACE, "BaseFaultType");
    XSElementDecl ct = sset.getElementDecl(namespace.getNamespace(), type.getType());
    if (ct.getType().isDerivedFrom(bfct)) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:17,代码来源:MethodViewer.java

示例2: getComplexTypeToElementName

import com.sun.xml.xsom.XSElementDecl; //导入依赖的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

示例3: groupProcessing

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
private void groupProcessing(
	Value value,
	XSElementDecl xsDecl,
	SOAPElement element,
	SOAPEnvelope envelope,
	boolean first,
	XSModelGroup modelGroup,
	XSSchemaSet sSet,
	String messageNamespace )
	throws SOAPException
{

	XSParticle[] children = modelGroup.getChildren();
	XSTerm currTerm;
	for( XSParticle child : children ) {
		currTerm = child.getTerm();
		if ( currTerm.isModelGroup() ) {
			groupProcessing( value, xsDecl, element, envelope, first, currTerm.asModelGroup(), sSet, messageNamespace );
		} else {
			termProcessing( value, element, envelope, first, currTerm, child.getMaxOccurs(), sSet, messageNamespace );
		}
	}
}
 
开发者ID:jolie,项目名称:jolie,代码行数:24,代码来源:SoapProtocol.java

示例4: elementDecl

import com.sun.xml.xsom.XSElementDecl; //导入依赖的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

示例5: elementDecl

import com.sun.xml.xsom.XSElementDecl; //导入依赖的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

示例6: setDocComment

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
private static void setDocComment(FieldOutline fo, FieldInfo attrInfo) {
    XSComponent xsComp = fo.getPropertyInfo().getSchemaComponent();
    if (xsComp != null && xsComp instanceof XSParticle) {
        XSParticle xsParticle = (XSParticle) xsComp;
        XSTerm xsTerm = xsParticle.getTerm();
        XSElementDecl elemndecl = xsTerm.asElementDecl();
        if (elemndecl.getDefaultValue() != null) {
            attrInfo.setValue(elemndecl.getDefaultValue().value);
            attrInfo.setFixedValue(false);
        } else if (elemndecl.getFixedValue() != null) {
            attrInfo.setValue(elemndecl.getFixedValue().value);
            attrInfo.setFixedValue(true);
        }

        String attrDoc = ModelBuilder.getDocumentation(xsTerm);
        attrInfo.setDocComment(attrDoc);
    }
}
 
开发者ID:agodet,项目名称:wadlcodegenerator,代码行数:19,代码来源:ClassModelBuilder.java

示例7: elementDeclSimple

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
private XmlForm elementDeclSimple(XSElementDecl decl, XSSimpleType simpleType) {
  FormElement element = declSimple(simpleType, decl.getName(), decl.getDefaultValue(), decl.getFixedValue());
  if (element == null)
    return null;
  
  XmlWriter writer = new XmlElementWriter(decl.getName(), null,
      new TextXmlWriter(new FormElementWriter(element)));
  
  XmlReader reader = new XmlElementReader(decl.getName(), null,
      new TextXmlReader(new FormElementHandler(element)));
  
  if (ignoreWhitespace)
    reader = WhitespaceReader.appendTo(reader);

  return new XmlFormImpl(element, writer, reader);
}
 
开发者ID:reinra,项目名称:dynaform,代码行数:17,代码来源:XmlFormBuilder.java

示例8: addSchemaElements

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
private void addSchemaElements() {
	for (Map.Entry<String, XSComplexType> entry : schemaObject
			.getComplexTypes().entrySet()) {
		XSContentType content = entry.getValue().getContentType();
		XSParticle particle = content.asParticle();
		if (particle != null) {
			XSTerm term = particle.getTerm();
			if (term.isModelGroup()) {
				XSParticle[] particles = term.asModelGroup().getChildren();
				for (XSParticle p : particles) {
					XSTerm pterm = p.getTerm();
					if (pterm.isElementDecl()) {
						XSElementDecl e = pterm.asElementDecl();
						schemaElements.put(e.getName(), e);
					}
				}
			}
		}
	}
}
 
开发者ID:impactcentre,项目名称:iif-generic-soap-client,代码行数:21,代码来源:WsdlDocument.java

示例9: getPossibleValues

import com.sun.xml.xsom.XSElementDecl; //导入依赖的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

示例10: isMultiValued

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
/**
 * Checks if "maxOccurs" of the element definition is greater than 1, i.e.,
 * if the SOAP message can contain several values for one input
 * 
 * @param inputName
 *            The element name
 * @return
 */
public boolean isMultiValued(String inputName) {
	for (Map.Entry<String, XSComplexType> entry : schemaObject
			.getComplexTypes().entrySet()) {
		XSContentType content = entry.getValue().getContentType();
		XSParticle particle = content.asParticle();
		if (particle != null) {
			XSTerm term = particle.getTerm();
			if (term.isModelGroup()) {
				XSParticle[] particles = term.asModelGroup().getChildren();
				for (XSParticle p : particles) {
					XSTerm pterm = p.getTerm();
					if (pterm.isElementDecl()) {
						XSElementDecl e = pterm.asElementDecl();
						if (e.getName().equals(inputName)) {
							return p.isRepeated();
						}
					}
				}
			}
		}
	}

	return false;
}
 
开发者ID:impactcentre,项目名称:iif-generic-soap-client,代码行数:33,代码来源:WsdlDocument.java

示例11: getPrefixOrNull

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
private String getPrefixOrNull( XSElementDecl decl )
{
	if ( decl.getOwnerSchema().elementFormDefault() ) {
		return namespacePrefixMap.get( decl.getOwnerSchema().getTargetNamespace() );
	}
	return null;
}
 
开发者ID:jolie,项目名称:jolie,代码行数:8,代码来源:SoapProtocol.java

示例12: termProcessing

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
private void termProcessing( Value value, SOAPElement element, SOAPEnvelope envelope, boolean first,
	XSTerm currTerm, int getMaxOccur,
	XSSchemaSet sSet, String messageNamespace )
	throws SOAPException
{

	if ( currTerm.isElementDecl() ) {
		ValueVector vec;
		XSElementDecl currElementDecl = currTerm.asElementDecl();
		String name = currElementDecl.getName();
		String prefix = (first) ? getPrefix( currElementDecl ) : getPrefixOrNull( currElementDecl );
		SOAPElement childElement;
		if ( (vec = value.children().get( name )) != null ) {
			int k = 0;
			while( vec.size() > 0 && (getMaxOccur > k || getMaxOccur == XSParticle.UNBOUNDED) ) {
				if ( prefix == null ) {
					childElement = element.addChildElement( name );
				} else {
					childElement = element.addChildElement( name, prefix );
				}
				Value v = vec.remove( 0 );
				valueToTypedSOAP(
					v,
					currElementDecl,
					childElement,
					envelope,
					false,
					sSet,
					messageNamespace );
				k++;
			}
		}
	}

}
 
开发者ID:jolie,项目名称:jolie,代码行数:36,代码来源:SoapProtocol.java

示例13: checkDefaultAndFixed

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
/**
 * Emit an alert in case we find a "default" or "fixed" attribute
 */
private void checkDefaultAndFixed( XSElementDecl element )
{
	if ( element.getDefaultValue() != null ) {
		log( Level.WARNING, WARNING_DEFAULT_ATTRIBUTE + " Element: " + element.getName() );
	}

	if ( element.getFixedValue() != null ) {
		log( Level.WARNING, WARNING_FIXED_ATTRIBUTE + " Element: " + element.getName() );
	}

}
 
开发者ID:jolie,项目名称:jolie,代码行数:15,代码来源:XsdToJolieConverterImpl.java

示例14: createSimpleType

import com.sun.xml.xsom.XSElementDecl; //导入依赖的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

示例15: iterateElementDecls

import com.sun.xml.xsom.XSElementDecl; //导入依赖的package包/类
public Iterator<XSElementDecl> iterateElementDecls() {
    return new Iterators.Map<XSElementDecl,XSSchema>(iterateSchema()) {
        protected Iterator<XSElementDecl> apply(XSSchema u) {
            return u.iterateElementDecls();
        }
    };
}
 
开发者ID:jolie,项目名称:jolie,代码行数:8,代码来源:SchemaSetImpl.java


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