本文整理汇总了Java中org.apache.ws.commons.schema.XmlSchemaAttribute类的典型用法代码示例。如果您正苦于以下问题:Java XmlSchemaAttribute类的具体用法?Java XmlSchemaAttribute怎么用?Java XmlSchemaAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlSchemaAttribute类属于org.apache.ws.commons.schema包,在下文中一共展示了XmlSchemaAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addXmlSchemaStatItem
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的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: getKey
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
public static String getKey(Object element) {
String key = element.getClass().getSimpleName();
if (element instanceof NamedList) {
key = ((NamedList) element).getName().toLowerCase() + "_folder";
} else if (element instanceof XmlSchema) {
key = "schema";
} else if (element instanceof XmlSchemaDocumentation || element instanceof XmlSchemaAppInfo) {
key = "notation";
} else if (element instanceof XmlSchemaObject) {
key = key.contains("Extension") ?
"extension" :
key.substring(9).replaceAll("(\\p{Upper})", "_$1").toLowerCase().substring(1);
if (element instanceof XmlSchemaElement) {
key += ((XmlSchemaElement)element).getRefName() != null ? "_ref":"";
}
else if (element instanceof XmlSchemaAttribute) {
key += ((XmlSchemaAttribute)element).getRefName() != null ? "_ref":"";
}
} else {
key = "unresolved";
}
return key;
}
示例3: add
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的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);
}
}
示例4: remove
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的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);
}
}
示例5: walkSimpleContentExtension
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
protected void walkSimpleContentExtension(XmlSchema xmlSchema, XmlSchemaSimpleContentExtension obj) {
walkAnnotated(xmlSchema, obj);
QName baseTypeName = obj.getBaseTypeName();
if ((baseTypeName != null) && deep) {
walkByTypeName(xmlSchema, baseTypeName);
}
XmlSchemaObjectCollection attributes = obj.getAttributes();
for (int i = 0; i < attributes.getCount(); i++) {
XmlSchemaObject attribute = attributes.getItem(i);
if (attribute instanceof XmlSchemaAttribute) {
walkAttribute(xmlSchema, (XmlSchemaAttribute)attribute);
} else if (attribute instanceof XmlSchemaAttributeGroupRef) {
walkAttributeGroupRef(xmlSchema, (XmlSchemaAttributeGroupRef)attribute);
}
}
XmlSchemaAnyAttribute xmlSchemaAnyAttribute = obj.getAnyAttribute();
if (xmlSchemaAnyAttribute != null) {
walkAnyAttribute(xmlSchema, xmlSchemaAnyAttribute);
}
}
示例6: walkAttributeGroup
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
protected void walkAttributeGroup(XmlSchema xmlSchema, XmlSchemaAttributeGroup obj) {
walkAnnotated(xmlSchema, obj);
XmlSchemaObjectCollection attributes = obj.getAttributes();
for (int i = 0; i < attributes.getCount(); i++) {
XmlSchemaObject attribute = attributes.getItem(i);
if (attribute instanceof XmlSchemaAttribute) {
walkAttribute(xmlSchema, (XmlSchemaAttribute)attribute);
} else if (attribute instanceof XmlSchemaAttributeGroupRef) {
walkAttributeGroupRef(xmlSchema, (XmlSchemaAttributeGroupRef)attribute);
}
}
XmlSchemaAnyAttribute xmlSchemaAnyAttribute = obj.getAnyAttribute();
if (xmlSchemaAnyAttribute != null) {
walkAnyAttribute(xmlSchema, xmlSchemaAnyAttribute);
}
}
示例7: getXmlSchemaObject
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
@Override
public XmlSchemaAttribute getXmlSchemaObject(XmlSchemaCollection collection, XmlSchema schema) {
String namespace = getNodeNameSpace();
String namespaceURI = getNodeNameSpaceURI();
boolean hasQName = !namespace.equals("") && !namespaceURI.equals("");
XmlSchemaAttribute attribute = XmlSchemaUtils.makeDynamic(this, new XmlSchemaAttribute());
attribute.setName(getStepNodeName());
attribute.setSchemaTypeName(getSimpleTypeAffectation());
if (hasQName) {
attribute.setQName(new QName(namespaceURI,getStepNodeName(),namespace));
}
else {
attribute.setUse(XmlSchemaUtils.attributeUseRequired);
}
addXmlSchemaAnnotation(attribute);
return attribute;
}
示例8: parseAttribute
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
private static final Attribute parseAttribute(final XmlSchemaAttribute attribute, final XmlSchema schema,
final Xsd2UmlConfig config) {
final String name = config.getPlugin().nameFromSchemaAttributeName(attribute.getQName());
final List<TaggedValue> taggedValues = new LinkedList<TaggedValue>();
taggedValues.addAll(annotations(attribute, config));
final XmlSchemaSimpleType simpleType = attribute.getSchemaType();
final Identifier type;
if (simpleType != null) {
type = config.ensureId(getSimpleTypeName(simpleType));
} else {
type = config.ensureId(attribute.getSchemaTypeName());
}
final Multiplicity multiplicity = multiplicity(range(Occurs.ONE, Occurs.ONE));
return new Attribute(Identifier.random(), name, type, multiplicity, taggedValues);
}
示例9: parseFields
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
private static final List<Attribute> parseFields(final XmlSchemaComplexType schemaComplexType,
final XmlSchema schema, final Xsd2UmlConfig context) {
final List<Attribute> attributes = new LinkedList<Attribute>();
final XmlSchemaObjectCollection schemaItems = schemaComplexType.getAttributes();
for (int i = 0, count = schemaItems.getCount(); i < count; i++) {
final XmlSchemaObject schemaObject = schemaItems.getItem(i);
if (schemaObject instanceof XmlSchemaAttribute) {
final XmlSchemaAttribute schemaAttribute = (XmlSchemaAttribute) schemaObject;
attributes.add(parseAttribute(schemaAttribute, schema, context));
} else {
throw new AssertionError(schemaObject);
}
}
// parseAttributes(schemaComplexType.getAttributes(), schema);
attributes.addAll(parseParticle(schemaComplexType.getParticle(), schema, context));
return Collections.unmodifiableList(attributes);
}
示例10: decorateImage
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
public Image decorateImage(Image image, Object element) {
Image decoratedImage = image;
if (element == null) {
decoratedImage = null;
} else if (element instanceof XmlSchemaParticle) {
XmlSchemaParticle particle = (XmlSchemaParticle) element;
long min = particle.getMinOccurs();
long max = particle.getMaxOccurs();
String occur = null;
if (min == 0) {
occur = "zero";
if (max > 0) {
occur += "_" + (max == 1 ? "one" : max == Long.MAX_VALUE ? "unbounded" : "n");
}
} else if (min == 1) {
if (max > 1) {
occur = "one_" + (max == Long.MAX_VALUE ? "unbounded" : "n");
}
} else {
occur = "n";
if (max > min) {
occur += "_" + (max == Long.MAX_VALUE ? "unbounded" : "m");
}
}
if (occur != null) {
decoratedImage = getOverlayImageOccur(decoratedImage, element, occur);
}
} else if (element instanceof XmlSchemaAttribute) {
XmlSchemaAttribute attribute = (XmlSchemaAttribute) element;
XmlSchemaUse use = attribute.getUse();
if (use.equals(XmlSchemaUtils.attributeUseOptional)) {
decoratedImage = getOverlayImageOccur(decoratedImage, element, "zero_one");
}
}
return decoratedImage;
}
示例11: getXmlSchemaAttributeByName
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
private static XmlSchemaAttribute getXmlSchemaAttributeByName(String projectName, String name) {
XmlSchemaAttribute xmlSchemaAttribute = null;
XmlSchemaCollection xmlSchemaCollection;
try {
xmlSchemaCollection = Engine.theApp.schemaManager.getSchemasForProject(projectName);
for (XmlSchema xmlSchema : xmlSchemaCollection.getXmlSchemas()) {
xmlSchemaAttribute = xmlSchema.getAttributeByName(new QName(xmlSchema.getTargetNamespace(), name));
if (xmlSchemaAttribute != null)
return xmlSchemaAttribute;
}
} catch (Exception e) {}
return null;
}
示例12: compare
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
public int compare(XmlSchemaAttribute o1, XmlSchemaAttribute o2) {
try {
return o1.getName().compareTo(o2.getName());
}
catch (Exception e) {
return 0;
}
}
示例13: attributesToSortedSet
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
public static SortedSet<XmlSchemaAttribute> attributesToSortedSet(XmlSchemaObjectCollection attrs) {
SortedSet<XmlSchemaAttribute> result = new TreeSet<XmlSchemaAttribute>(XmlSchemaUtils.attributeNameComparator);
for (Iterator<XmlSchemaAttribute> i = GenericUtils.cast(attrs.getIterator()); i.hasNext();) {
result.add(i.next());
}
return result;
}
示例14: walkComplexType
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
protected void walkComplexType(XmlSchema xmlSchema, XmlSchemaComplexType obj) {
walkAnnotated(xmlSchema, obj);
XmlSchemaObjectCollection attributes = obj.getAttributes();
for (int i = 0; i < attributes.getCount(); i++) {
XmlSchemaObject attribute = attributes.getItem(i);
if (attribute instanceof XmlSchemaAttribute) {
walkAttribute(xmlSchema, (XmlSchemaAttribute) attribute);
} else if (attribute instanceof XmlSchemaAttributeGroupRef) {
walkAttributeGroupRef(xmlSchema, (XmlSchemaAttributeGroupRef) attribute);
}
}
XmlSchemaContentModel xmlSchemaContentModel = obj.getContentModel();
XmlSchemaParticle xmlSchemaParticle = obj.getParticle();
if (xmlSchemaContentModel != null) {
if (xmlSchemaContentModel instanceof XmlSchemaSimpleContent) {
walkSimpleContent(xmlSchema, (XmlSchemaSimpleContent)xmlSchemaContentModel);
} else if (xmlSchemaContentModel instanceof XmlSchemaComplexContent) {
walkComplexContent(xmlSchema, (XmlSchemaComplexContent)xmlSchemaContentModel);
}
} else if (xmlSchemaParticle != null) {
if (xmlSchemaParticle instanceof XmlSchemaSequence) {
walkSequence(xmlSchema, (XmlSchemaSequence)xmlSchemaParticle);
} else if (xmlSchemaParticle instanceof XmlSchemaChoice) {
walkChoice(xmlSchema, (XmlSchemaChoice)xmlSchemaParticle);
} else if (xmlSchemaParticle instanceof XmlSchemaAll) {
walkAll(xmlSchema, (XmlSchemaAll)xmlSchemaParticle);
} else if (xmlSchemaParticle instanceof XmlSchemaGroupRef) {
walkGroupRef(xmlSchema, (XmlSchemaGroupRef)xmlSchemaParticle);
}
}
}
示例15: walkSimpleContentRestriction
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入依赖的package包/类
protected void walkSimpleContentRestriction(XmlSchema xmlSchema, XmlSchemaSimpleContentRestriction obj) {
walkAnnotated(xmlSchema, obj);
QName baseTypeName = obj.getBaseTypeName();
if ((baseTypeName != null) && deep) {
walkByTypeName(xmlSchema, baseTypeName);
}
XmlSchemaObjectCollection attributes = obj.getAttributes();
for (int i = 0; i < attributes.getCount(); i++) {
XmlSchemaObject attribute = attributes.getItem(i);
if (attribute instanceof XmlSchemaAttribute) {
walkAttribute(xmlSchema, (XmlSchemaAttribute)attribute);
} else if (attribute instanceof XmlSchemaAttributeGroupRef) {
walkAttributeGroupRef(xmlSchema, (XmlSchemaAttributeGroupRef)attribute);
}
}
XmlSchemaSimpleType xmlSchemaSimpleType = obj.getBaseType();
if (xmlSchemaSimpleType != null) {
walkSimpleType(xmlSchema, xmlSchemaSimpleType);
}
XmlSchemaAnyAttribute xmlSchemaAnyAttribute = obj.getAnyAttribute();
if (xmlSchemaAnyAttribute != null) {
walkAnyAttribute(xmlSchema, xmlSchemaAnyAttribute);
}
XmlSchemaObjectCollection facets = obj.getFacets();
for (int i = 0; i < facets.getCount(); i++) {
XmlSchemaObject facet = facets.getItem(i);
walkFacet(xmlSchema, (XmlSchemaFacet)facet);
}
}