本文整理汇总了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;
}
}
示例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;
}
示例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 );
}
}
}
示例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();
}
示例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>");
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
}
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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++;
}
}
}
}
示例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() );
}
}
示例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;
}
}
示例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();
}
};
}