本文整理汇总了Java中org.apache.ws.commons.schema.XmlSchemaType类的典型用法代码示例。如果您正苦于以下问题:Java XmlSchemaType类的具体用法?Java XmlSchemaType怎么用?Java XmlSchemaType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaType类属于org.apache.ws.commons.schema包,在下文中一共展示了XmlSchemaType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
public static void add(XmlSchema schema, XmlSchemaObject object) {
if (object instanceof XmlSchemaImport) {
add(schema, (XmlSchemaImport) object);
} else if (object instanceof XmlSchemaInclude) {
add(schema, (XmlSchemaInclude) object);
} else if (object instanceof XmlSchemaElement) {
add(schema, (XmlSchemaElement) object);
} else if (object instanceof XmlSchemaType) {
add(schema, (XmlSchemaType) object);
} else if (object instanceof XmlSchemaGroup) {
add(schema, (XmlSchemaGroup) object);
} else if (object instanceof XmlSchemaAttributeGroup) {
add(schema, (XmlSchemaAttributeGroup) object);
} else if (object instanceof XmlSchemaAttribute) {
add(schema, (XmlSchemaAttribute) object);
} else {
schema.getItems().add(object);
}
}
示例2: remove
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
public static void remove(XmlSchema schema, XmlSchemaObject object) {
if (object instanceof XmlSchemaImport) {
remove(schema, (XmlSchemaImport) object);
} else if (object instanceof XmlSchemaInclude) {
remove(schema, (XmlSchemaInclude) object);
} else if (object instanceof XmlSchemaElement) {
remove(schema, (XmlSchemaElement) object);
} else if (object instanceof XmlSchemaType) {
remove(schema, (XmlSchemaType) object);
} else if (object instanceof XmlSchemaGroup) {
remove(schema, (XmlSchemaGroup) object);
} else if (object instanceof XmlSchemaAttributeGroup) {
remove(schema, (XmlSchemaAttributeGroup) object);
} else if (object instanceof XmlSchemaAttribute) {
remove(schema, (XmlSchemaAttribute) object);
} else {
schema.getItems().remove(object);
}
}
示例3: handleAllCasesOfComplexTypes
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
private void handleAllCasesOfComplexTypes(XmlSchemaType schemaType,
AxisMessage message,
List partNameList,
String qnameSuffix) throws CodeGenerationException {
// if a complex type name exits for a element then
// we keep that complex type to support unwrapping
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
if (cmplxType.getContentModel() == null) {
if (cmplxType.getParticle() != null) {
processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList,
qnameSuffix);
}
} else {
// now lets handle case with extensions
processComplexContentModel(cmplxType, message, partNameList, qnameSuffix);
}
// handle attributes here
processAttributes(cmplxType, message, partNameList, qnameSuffix);
}
}
示例4: addType
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
private void addType(QName typeQName, XmlSchemaType type) {
// skip built in xml schema types
if (XML_SCHEMA_NS.equals(typeQName.getNamespaceURI())) {
return;
}
XmlTypeInfo typeInfo = createXmlTypeInfo(typeQName, type);
xmlTypes.put(typeQName, typeInfo);
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = (XmlSchemaComplexType) type;
// process elements nested inside of this element
List<XmlSchemaElement> elements = getNestedElements(complexType);
for (XmlSchemaElement element : elements) {
addNestedElement(element, typeInfo);
}
}
}
示例5: loadSchema
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
void loadSchema(XmlSchema schema) {
XmlSchemaObjectCollection schemaItems = schema.getItems();
// Iterate XML Schema items
for (int i = 0; i < schemaItems.getCount(); i++) {
XmlSchemaObject schemaObject = schemaItems.getItem(i);
NeutralSchema neutralSchema;
if (schemaObject instanceof XmlSchemaType) {
neutralSchema = parse((XmlSchemaType) schemaObject, schema);
} else if (schemaObject instanceof XmlSchemaElement) {
neutralSchema = parseElement((XmlSchemaElement) schemaObject, schema);
} else if (schemaObject instanceof XmlSchemaInclude) {
continue; // nothing to do for includes
} else {
throw new RuntimeException("Unhandled XmlSchemaObject: " + schemaObject.getClass().getCanonicalName());
}
schemas.put(neutralSchema.getType(), neutralSchema);
partialSchemas.clear();
}
}
示例6: parse
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
private NeutralSchema parse(XmlSchemaType type, String name, XmlSchema schema) {
NeutralSchema prior = partialSchemas.get(type);
if (prior != null) {
// we already have a schema of this type
NeutralSchema nSchema = getSchemaFactory().copySchema(prior);
return nSchema;
}
if (type instanceof XmlSchemaComplexType) {
NeutralSchema complexSchema = getSchemaFactory().createSchema(name);
partialSchemas.put(type, complexSchema); // avoid infinite recursion in self-referential
// schemas
return parseComplexType((XmlSchemaComplexType) type, complexSchema, schema);
} else if (type instanceof XmlSchemaSimpleType) {
return parseSimpleType((XmlSchemaSimpleType) type, schema, name);
} else {
throw new RuntimeException("Unsupported schema type: " + type.getClass().getCanonicalName());
}
}
示例7: removeXmlSchemaObjects
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
public static void removeXmlSchemaObjects(XmlSchema schema) {
XmlSchemaType type = null;
if ((type = schema.getTypeByName("ConvertigoErrorContextVariable")) != null)
XmlSchemaUtils.remove(schema, type);
if ((type = schema.getTypeByName("ConvertigoErrorContext")) != null)
XmlSchemaUtils.remove(schema, type);
if ((type = schema.getTypeByName("ConvertigoError")) != null)
XmlSchemaUtils.remove(schema, type);
}
示例8: walkElement
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
protected void walkElement(XmlSchema xmlSchema, XmlSchemaElement obj) {
walkAnnotated(xmlSchema, obj);
QName refName = obj.getRefName();
QName typeName = obj.getSchemaTypeName();
XmlSchemaType xmlSchemaType = obj.getSchemaType();
if (refName != null) {
if (deep) {
walkByElementRef(xmlSchema, refName);
}
} else if (typeName != null) {
if (deep) {
walkByTypeName(xmlSchema, typeName);
}
} else if (xmlSchemaType != null) {
if (xmlSchemaType instanceof XmlSchemaComplexType) {
walkComplexType(xmlSchema, (XmlSchemaComplexType)xmlSchemaType);
} else if (xmlSchemaType instanceof XmlSchemaSimpleType) {
walkSimpleType(xmlSchema, (XmlSchemaSimpleType)xmlSchemaType);
}
}
}
示例9: createXmlSchemaType
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
/**
* Maps a COBOL data item to an XML schema type.
* <ul>
* <li>COBOL elementary data items are mapped to XML Schema simple types.</li>
* <li>COBOL structures are mapped to XML schema complex Types.</li>
* </ul>
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @return a corresponding XML schema type
*/
public XmlSchemaType createXmlSchemaType(final XsdDataItem xsdDataItem) {
if (xsdDataItem.getXsdType() == null) {
return null;
}
switch (xsdDataItem.getXsdType()) {
case COMPLEX:
return createXmlSchemaComplexType(xsdDataItem);
case STRING:
return createAlphaXmlSchemaSimpleType(xsdDataItem, "string");
case HEXBINARY:
return createAlphaXmlSchemaSimpleType(xsdDataItem, "hexBinary");
case SHORT:
return createNumericXmlSchemaSimpleType(xsdDataItem, "short");
case USHORT:
return createNumericXmlSchemaSimpleType(xsdDataItem,
"unsignedShort");
case INT:
return createNumericXmlSchemaSimpleType(xsdDataItem, "int");
case UINT:
return createNumericXmlSchemaSimpleType(xsdDataItem, "unsignedInt");
case LONG:
return createNumericXmlSchemaSimpleType(xsdDataItem, "long");
case ULONG:
return createNumericXmlSchemaSimpleType(xsdDataItem, "unsignedLong");
case INTEGER:
return createNumericXmlSchemaSimpleType(xsdDataItem, "integer");
case DECIMAL:
return createNumericXmlSchemaSimpleType(xsdDataItem, "decimal");
case FLOAT:
return createNumericXmlSchemaSimpleType(xsdDataItem, "float");
case DOUBLE:
return createNumericXmlSchemaSimpleType(xsdDataItem, "double");
default:
return null;
}
}
示例10: createXmlSchemaElement
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
/**
* Create an XML Schema element from a COBOL data item.
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @return the XML schema element
*/
public XmlSchemaElement createXmlSchemaElement(final XsdDataItem xsdDataItem) {
XmlSchemaElement element = new XmlSchemaElement();
element.setName(xsdDataItem.getXsdElementName());
if (xsdDataItem.getMaxOccurs() != 1) {
element.setMaxOccurs(xsdDataItem.getMaxOccurs());
}
if (xsdDataItem.getMinOccurs() != 1) {
element.setMinOccurs(xsdDataItem.getMinOccurs());
}
/*
* Create this element schema type, then if its a simple type set it as
* an anonymous type. Otherwise, it is a named complex type, so
* reference it by name.
*/
XmlSchemaType xmlSchemaType = createXmlSchemaType(xsdDataItem);
if (xmlSchemaType == null) {
return null;
}
if (xmlSchemaType instanceof XmlSchemaSimpleType) {
element.setSchemaType(xmlSchemaType);
} else {
element.setSchemaTypeName(xmlSchemaType.getQName());
}
if (getModel().addLegStarAnnotations()) {
element.setAnnotation(_annotationEmitter
.createLegStarAnnotation(xsdDataItem));
}
return element;
}
示例11: createXmlSchemaElement
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
/**
* Create an XML Schema element from a COBOL data item.
*
* @param xsdDataItem COBOL data item decorated with XSD attributes
* @return the XML schema element
*/
public XmlSchemaElement createXmlSchemaElement(final XsdDataItem xsdDataItem) {
// Let call add root elements if he needs to so for now pretend this is
// not a root element
XmlSchemaElement element = new XmlSchemaElement(getXsd(), false);
element.setName(xsdDataItem.getXsdElementName());
if (xsdDataItem.getMaxOccurs() != 1) {
element.setMaxOccurs(xsdDataItem.getMaxOccurs());
}
if (xsdDataItem.getMinOccurs() != 1) {
element.setMinOccurs(xsdDataItem.getMinOccurs());
}
/*
* Create this element schema type, then if its a simple type set it as
* an anonymous type. Otherwise, it is a named complex type, so
* reference it by name.
*/
XmlSchemaType xmlSchemaType = createXmlSchemaType(xsdDataItem);
if (xmlSchemaType == null) {
return null;
}
if (xmlSchemaType instanceof XmlSchemaSimpleType) {
element.setSchemaType(xmlSchemaType);
} else {
element.setSchemaTypeName(xmlSchemaType.getQName());
}
if (getConfig().addLegStarAnnotations()) {
element.setAnnotation(_annotationEmitter
.createLegStarAnnotation(xsdDataItem));
}
return element;
}
示例12: getParameterListForOperation
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
/**
* Retrieves list of parameter names & their type for a given operation
* @param operation
*/
private static String getParameterListForOperation(AxisOperation operation) {
//Logic copied from BuilderUtil.buildsoapMessage(...)
StringBuffer paramList = new StringBuffer();
AxisMessage axisMessage =
operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
XmlSchemaElement xmlSchemaElement = axisMessage.getSchemaElement();
if(xmlSchemaElement != null){
XmlSchemaType schemaType = xmlSchemaElement.getSchemaType();
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = ((XmlSchemaComplexType)schemaType);
XmlSchemaParticle particle = complexType.getParticle();
if (particle instanceof XmlSchemaSequence || particle instanceof XmlSchemaAll) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase)particle;
Iterator iterator = xmlSchemaGroupBase.getItems().getIterator();
while (iterator.hasNext()) {
XmlSchemaElement innerElement = (XmlSchemaElement)iterator.next();
QName qName = innerElement.getQName();
if (qName == null && innerElement.getSchemaTypeName()
.equals(org.apache.ws.commons.schema.constants.Constants.XSD_ANYTYPE)) {
break;
}
long minOccurs = innerElement.getMinOccurs();
boolean nillable = innerElement.isNillable();
String name =
qName != null ? qName.getLocalPart() : innerElement.getName();
String type = innerElement.getSchemaTypeName().toString();
paramList.append(","+type +" " +name);
}
}
}
}
//remove first ","
String list = paramList.toString();
return list.replaceFirst(",", "");
}
示例13: processSchemaList
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
private void processSchemaList() {
// get the operation schema and process.
XmlSchema operationSchema = getXmlSchema(elementQname);
XmlSchemaElement messageElement = operationSchema.getElementByName(elementQname.getLocalPart());
mainXmlNode = new XmlNode(elementQname.getLocalPart(), elementQname.getNamespaceURI(), false,
(messageElement.getMaxOccurs() != 1), "");
QName messageSchemaTypeName = messageElement.getSchemaTypeName();
XmlSchemaType schemaType;
XmlSchema schemaOfType;
if (messageSchemaTypeName != null) {
schemaType = operationSchema.getTypeByName(messageSchemaTypeName);
if (schemaType == null) {
schemaOfType = getXmlSchema(messageSchemaTypeName);
/* When sending a response as a simple type element, schemaOfType will set as null from getXmlSchema
method. therefore this IF statement is added to avoid the NPE. */
if (schemaOfType != null) {
schemaType = schemaOfType.getTypeByName(messageSchemaTypeName.getLocalPart());
}
} else {
schemaOfType = operationSchema;
}
} else {
schemaType = messageElement.getSchemaType();
schemaOfType = operationSchema;
}
if (schemaType != null) {
processSchemaType(schemaType, mainXmlNode, schemaOfType);
} else {
// nothing to do
}
}
示例14: getSchemaTypeOfElement
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
private XmlSchemaType getSchemaTypeOfElement(XmlSchema schema, XmlSchemaElement element) {
XmlSchemaType type = element.getSchemaType();
if (type == null) {
QName typeName = element.getSchemaTypeName();
type = schema.getTypeByName(typeName.getLocalPart());
if (type == null) {
schema = getXmlSchema(typeName);
type = schema.getTypeByName(typeName.getLocalPart());
}
}
return type;
}
示例15: handleAllCasesOfComplexTypes
import org.apache.ws.commons.schema.XmlSchemaType; //导入依赖的package包/类
private boolean handleAllCasesOfComplexTypes(XmlSchemaType schemaType,
AxisMessage message,
List partNameList,
String qnameSuffix) throws CodeGenerationException {
// if a complex type name exits for a element then
// we keep that complex type to support unwrapping
if (schemaType instanceof XmlSchemaComplexType) {
XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType;
XmlSchemaObjectCollection xmlObjectCollection = cmplxType.getAttributes();
if (xmlObjectCollection.getCount() != 0)
return false;
if (cmplxType.getContentModel() == null) {
if (cmplxType.getParticle() != null) {
return processXMLSchemaSequence(cmplxType.getParticle(), message, partNameList,
qnameSuffix);
}
} else {
// now lets handle case with extensions
return processComplexContentModel(cmplxType, message, partNameList, qnameSuffix);
}
// handle attributes here
// processAttributes(cmplxType, message, partNameList, qnameSuffix);
}
return false;
}