本文整理汇总了Java中org.apache.ws.commons.schema.XmlSchemaComplexType类的典型用法代码示例。如果您正苦于以下问题:Java XmlSchemaComplexType类的具体用法?Java XmlSchemaComplexType怎么用?Java XmlSchemaComplexType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaComplexType类属于org.apache.ws.commons.schema包,在下文中一共展示了XmlSchemaComplexType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addXmlSchemaStatItem
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
private static XmlSchemaElement addXmlSchemaStatItem(XmlSchema schema, String name, int minOccurs) {
XmlSchemaComplexType itemType = new XmlSchemaComplexType(schema);
itemType.setName("ConvertigoStatsItemType");
XmlSchemaAttribute averageAttribute = new XmlSchemaAttribute();
averageAttribute.setName("average");
averageAttribute.setSchemaTypeName(Constants.XSD_STRING);
itemType.getAttributes().add(averageAttribute);
XmlSchemaAttribute currentAttribute = new XmlSchemaAttribute();
currentAttribute.setName("current");
currentAttribute.setSchemaTypeName(Constants.XSD_STRING);
itemType.getAttributes().add(currentAttribute);
XmlSchemaUtils.add(schema, itemType);
XmlSchemaElement hostElement = new XmlSchemaElement();
hostElement.setName(name);
hostElement.setMinOccurs(minOccurs);
hostElement.setMaxOccurs(1);
hostElement.setSchemaTypeName(itemType.getQName());
return hostElement;
}
示例2: getXmlSchemaObject
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
element.setType(cType);
XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
SchemaMeta.setContainerXmlSchemaGroupBase(element, sequence);
XmlSchemaElement elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
sequence.getItems().add(elt);
elt.setName("filePath");
elt.setMinOccurs(0);
elt.setMaxOccurs(1);
elt.setSchemaTypeName(Constants.XSD_STRING);
return element;
}
示例3: getXmlSchemaObject
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
@Override
public XmlSchemaElement getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
XmlSchemaElement element = (XmlSchemaElement) super.getXmlSchemaObject(collection, schema);
element.setSchemaTypeName(null);
XmlSchemaComplexType cType = XmlSchemaUtils.makeDynamic(this, new XmlSchemaComplexType(schema));
element.setType(cType);
XmlSchemaSequence sequence = XmlSchemaUtils.makeDynamic(this, new XmlSchemaSequence());
cType.setParticle(sequence);
int count = getTagsCount();
for (int i = 0; i < count + 1; i++) {
XmlSchemaElement elt = XmlSchemaUtils.makeDynamic(this, new XmlSchemaElement());
elt.setName(getTag(i));
elt.setMinOccurs(0);
if (i == count) {
elt.setMaxOccurs(Long.MAX_VALUE);
}
elt.setSchemaTypeName(getSimpleTypeAffectation());
sequence.getItems().add(elt);
}
return element;
}
示例4: addSchemaResponseElement
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
protected XmlSchemaElement addSchemaResponseElement(XmlSchema xmlSchema) {
String nsURI = xmlSchema.getTargetNamespace();
String prefix = xmlSchema.getNamespaceContext().getPrefix(nsURI);
String localName = getXsdResponseElementName();
XmlSchemaElement xmlSchemaElement = new XmlSchemaElement();
xmlSchemaElement.setName(localName);
xmlSchemaElement.setQName(new QName(nsURI, localName, prefix));
XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(xmlSchema);
XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
XmlSchemaElement responseElement = new XmlSchemaElement();
responseElement.setName("response");
responseElement.setSchemaTypeName(new QName(nsURI, getXsdResponseTypeName(), prefix));
xmlSchemaSequence.getItems().add(responseElement);
xmlSchemaComplexType.setParticle(xmlSchemaSequence);
xmlSchemaElement.setSchemaType(xmlSchemaComplexType);
XmlSchemaUtils.add(xmlSchema, xmlSchemaElement);
return xmlSchemaElement;
}
示例5: addSchemaResponseType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
protected XmlSchemaComplexType addSchemaResponseType(XmlSchema xmlSchema) {
String nsURI = xmlSchema.getTargetNamespace();
String prefix = xmlSchema.getNamespaceContext().getPrefix(nsURI);
String localName = getXsdResponseElementName()+ "Type";
XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType(xmlSchema);
xmlSchemaComplexType.setName(localName);
XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
XmlSchemaElement documentElement = new XmlSchemaElement();
documentElement.setName("document");
documentElement.setSchemaTypeName(new QName(nsURI, getXsdResponseTypeName(), prefix));
xmlSchemaSequence.getItems().add(documentElement);
xmlSchemaComplexType.setParticle(xmlSchemaSequence);
XmlSchemaUtils.add(xmlSchema, xmlSchemaComplexType);
return xmlSchemaComplexType;
}
示例6: build
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
/**
* Process each element in the input Schema.
* <p/>
*
* @param xmlSchema the XML schema with COBOL annotations
* @return a map of root elements in the XML schema, each one mapped to its
* composite types constituents
* @throws Xsd2ConverterException if parsing the XML schema fails
*/
public Map < String, RootCompositeType > build(XmlSchema xmlSchema)
throws Xsd2ConverterException {
log.debug("visit XML Schema started");
Map < String, RootCompositeType > rootComplexTypes = new LinkedHashMap < String, RootCompositeType >();
for (Entry < QName, XmlSchemaElement > entry : xmlSchema.getElements()
.entrySet()) {
if (entry.getValue().getSchemaType() instanceof XmlSchemaComplexType) {
CobolAnnotations cobolAnnotations = new CobolAnnotations(
entry.getValue());
XmlSchemaComplexType xsdComplexType = (XmlSchemaComplexType) entry
.getValue().getSchemaType();
RootCompositeType compositeTypes = new RootCompositeType(
cobolAnnotations.getCobolName());
String complexTypeName = getComplexTypeName(xsdComplexType);
rootComplexTypes.put(complexTypeName, compositeTypes);
visit(xsdComplexType, compositeTypes, complexTypeName);
}
}
log.debug("visit XML Schema ended");
return rootComplexTypes;
}
示例7: createSchemaTypeForMethodPart
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) {
XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace);
QName elementName =
new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix);
XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
XmlSchemaElement globalElement = new XmlSchemaElement();
globalElement.setSchemaType(complexType);
globalElement.setName(localPartName);
globalElement.setQName(elementName);
xmlSchema.getItems().add(globalElement);
xmlSchema.getElements().add(elementName, globalElement);
typeTable.addComplexSchema(localPartName, elementName);
return complexType;
}
示例8: handleAllCasesOfComplexTypes
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的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);
}
}
示例9: finalizeSchemaCompilation
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
/**
* Completes the schema compilation process by writing the
* mappers and the classes in a batch if needed
*
* @throws SchemaCompilationException
*/
private void finalizeSchemaCompilation() throws SchemaCompilationException {
//write the extension mapping class
writer.writeExtensionMapper(
processedTypeMetaInfoMap.values().toArray(
new BeanWriterMetaInfoHolder[processedTypeMetaInfoMap.size()]));
if (options.isWrapClasses()) {
writer.writeBatch();
}
// resets the changed types
for (XmlSchemaComplexType xmlSchemaComplexType : changedComplexTypeSet) {
xmlSchemaComplexType.setName(null);
}
for (XmlSchemaSimpleType xmlSchemaSimpleType : changedSimpleTypeSet) {
xmlSchemaSimpleType.setName(null);
}
for (XmlSchemaElement xmlSchemaElement : changedElementSet) {
xmlSchemaElement.setSchemaTypeName(null);
}
}
示例10: visit
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
/**
* Process a regular XML schema element.
*
* @param xmlSchema the input XML schema
* @param xsdElement the XML Schema element to process
* @param level the current level in the elements hierarchy.
* @param avroFields array of fields being populated
* @throws Xsd2AvroTranslatorException if processing fails
*/
private void visit(XmlSchema xmlSchema, final XmlSchemaElement xsdElement,
final int level, final ArrayNode avroFields)
throws Xsd2AvroTranslatorException {
/*
* If this element is referencing another, it might not be useful to
* process it.
*/
if (xsdElement.getRef().getTarget() != null) {
return;
}
log.debug("process started for element = " + xsdElement.getName());
if (xsdElement.getSchemaType() instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xsdType = (XmlSchemaComplexType) xsdElement
.getSchemaType();
int nextLevel = level + 1;
final ArrayNode avroChildrenFields = MAPPER.createArrayNode();
visit(xmlSchema, xsdType, nextLevel, avroChildrenFields);
ContainerNode avroRecordType = buildAvroCompositeType(
getAvroTypeName(xsdType), avroChildrenFields,
xsdElement.getMaxOccurs() > 1,
xsdElement.getMinOccurs() == 0
&& xsdElement.getMaxOccurs() == 1);
ObjectNode avroRecordElement = MAPPER.createObjectNode();
avroRecordElement.put("type", avroRecordType);
avroRecordElement.put("name", getAvroFieldName(xsdElement));
avroFields.add(avroRecordElement);
} else if (xsdElement.getSchemaType() instanceof XmlSchemaSimpleType) {
visit((XmlSchemaSimpleType) xsdElement.getSchemaType(), level,
getAvroFieldName(xsdElement), xsdElement.getMinOccurs(),
xsdElement.getMaxOccurs(), avroFields);
}
log.debug("process ended for element = " + xsdElement.getName());
}
示例11: addType
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的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);
}
}
}
示例12: writeSchema
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
@Override
public void writeSchema(XmlSchema root) {
XmlSchemaComplexType complex = new XmlSchemaComplexType(root, true);
complex.setName(getSchemaType().getLocalPart());
XmlSchemaSequence sequence = new XmlSchemaSequence();
complex.setParticle(sequence);
AegisType kType = getKeyType();
AegisType vType = getValueType();
XmlSchemaElement element = new XmlSchemaElement(root, false);
sequence.getItems().add(element);
element.setName(getEntryName().getLocalPart());
element.setMinOccurs(0);
element.setMaxOccurs(Long.MAX_VALUE);
XmlSchemaComplexType evType = new XmlSchemaComplexType(root, false);
element.setType(evType);
XmlSchemaSequence evSequence = new XmlSchemaSequence();
evType.setParticle(evSequence);
createElement(root, evSequence, getKeyName(), kType, false);
createElement(root, evSequence, getValueName(), vType, true);
}
示例13: setup
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
/**
* Initialization method, parses XSD for complexTypes and referenceTypes
*/
@PostConstruct
public void setup() {
complexTypes = new HashMap<String, XmlSchemaComplexType>();
Resource xsdResource = resourceLoader.getResource(xsdLocation);
Resource extensionXsdResource = resourceLoader.getResource(extensionXsdLocation);
// extract complex types from base schema
cacheComplexTypesFromResource(xsdResource, xsdParentLocation);
// extract complex types from extension schema
cacheComplexTypesFromResource(extensionXsdResource, extensionXsdParentLocation);
// extract and cache the reference types from the complexTypes
cacheReferenceTypes();
extractBaseTypesFromCache();
refSourceCache = new HashMap<String, DidRefSource>();
// extract the Did configuration objects
entityConfigs = extractEntityConfigs();
refConfigs = addExternalKeyFields(extractRefConfigs());
naturalKeys = extractNaturalKeys();
}
示例14: cacheComplexTypes
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
/**
* extract all complex types from a schema and cache into a map
*/
private void cacheComplexTypes(XmlSchema schema) {
XmlSchemaObjectCollection schemaItems = schema.getItems();
int numElements = schemaItems.getCount();
// Iterate XML Schema items
for (int i = 0; i < numElements; i++) {
XmlSchemaObject schemaObject = schemaItems.getItem(i);
if (schemaObject instanceof XmlSchemaComplexType) {
XmlSchemaComplexType complexType = (XmlSchemaComplexType) schemaObject;
String elementTypeName = complexType.getName();
complexTypes.put(elementTypeName, complexType);
}
}
}
示例15: extractBaseTypesFromCache
import org.apache.ws.commons.schema.XmlSchemaComplexType; //导入依赖的package包/类
/**
* Remove parent types from the complexTypes cache.
* We are only interested in the leaf node extended types.
*/
private void extractBaseTypesFromCache() {
// find all the parent types
Set<String> baseTypeSet = new HashSet<String>();
for (XmlSchemaComplexType complexType : complexTypes.values()) {
// this needs to also respect restriction
String baseName = extractBaseTypeName(complexType);
if (baseName != null) {
baseTypeSet.add(baseName);
}
}
// remove all the baseTypes from reference Cache
for (String baseType : baseTypeSet) {
referenceTypes.remove(baseType);
}
}