本文整理汇总了Java中org.apache.ws.commons.schema.XmlSchemaAttribute.setUse方法的典型用法代码示例。如果您正苦于以下问题:Java XmlSchemaAttribute.setUse方法的具体用法?Java XmlSchemaAttribute.setUse怎么用?Java XmlSchemaAttribute.setUse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ws.commons.schema.XmlSchemaAttribute
的用法示例。
在下文中一共展示了XmlSchemaAttribute.setUse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: mergeAttributes
import org.apache.ws.commons.schema.XmlSchemaAttribute; //导入方法依赖的package包/类
private static void mergeAttributes(XmlSchema schema, XmlSchemaObjectCollection first, XmlSchemaObjectCollection second) {
// merge only if there attributes
if (first.getCount() != 0 && second.getCount() != 0) {
// copy and sort attributes
Iterator<XmlSchemaAttribute> iFirst = XmlSchemaUtils.attributesToSortedSet(first).iterator();
Iterator<XmlSchemaAttribute> iSecond = XmlSchemaUtils.attributesToSortedSet(second).iterator();
XmlSchemaAttribute aFirst = GenericUtils.nextOrNull(iFirst);
XmlSchemaAttribute aSecond = GenericUtils.nextOrNull(iSecond);
// prepare to receive ordered attributes
XmlSchemaUtils.clear(first);
while (aFirst != null && aSecond != null) {
// compare attributes name
int compare = XmlSchemaUtils.attributeNameComparator.compare(aFirst, aSecond);
if (compare == 0) {
// same name, make it optional if one of them is optional
if (!aFirst.getUse().equals(aSecond.getUse())) {
aFirst.setUse(XmlSchemaUtils.attributeUseOptional);
}
first.add(aFirst);
SchemaMeta.adoptReferences(schema, aFirst, aSecond);
aFirst = GenericUtils.nextOrNull(iFirst);
aSecond = GenericUtils.nextOrNull(iSecond);
} else if (compare < 0) {
// not same name, add the first attribute as optional
aFirst.setUse(XmlSchemaUtils.attributeUseOptional);
first.add(aFirst);
aFirst = GenericUtils.nextOrNull(iFirst);
} else {
// not same name, add the second attribute as optional
aSecond.setUse(XmlSchemaUtils.attributeUseOptional);
first.add(aSecond);
aSecond = GenericUtils.nextOrNull(iSecond);
}
}
// copy tailing attributes as optional
if (aFirst != null || (aFirst = aSecond) != null) {
aFirst.setUse(XmlSchemaUtils.attributeUseOptional);
first.add(aFirst);
}
while (iFirst.hasNext() || (iFirst = iSecond).hasNext()) {
aFirst = iFirst.next();
aFirst.setUse(XmlSchemaUtils.attributeUseOptional);
first.add(aFirst);
}
}
}