本文整理匯總了Java中org.apache.ws.commons.schema.utils.XmlSchemaObjectBase類的典型用法代碼示例。如果您正苦於以下問題:Java XmlSchemaObjectBase類的具體用法?Java XmlSchemaObjectBase怎麽用?Java XmlSchemaObjectBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
XmlSchemaObjectBase類屬於org.apache.ws.commons.schema.utils包,在下文中一共展示了XmlSchemaObjectBase類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addField
import org.apache.ws.commons.schema.utils.XmlSchemaObjectBase; //導入依賴的package包/類
/**
* Add a field with associated properties to a complex type.
*
* @param index the order of the field in the parent complex type
* @param xsdSchemaObject the potential field
* @param xsdSchemaObject the potential field
* @param fields the parent complex type's fields collection
* @param compositeTypes the lists of composite types being populated
*/
private void addField(int fieldIndex, XmlSchemaObjectBase xsdSchemaObject,
Map < String, Object > fields, RootCompositeType compositeTypes) {
if (xsdSchemaObject instanceof XmlSchemaElement) {
XmlSchemaElement xsdElement = (XmlSchemaElement) xsdSchemaObject;
fields.put(getFieldName(xsdElement),
getProps(fieldIndex, xsdElement, compositeTypes));
} else if (xsdSchemaObject instanceof XmlSchemaChoice) {
XmlSchemaChoice xsdChoice = (XmlSchemaChoice) xsdSchemaObject;
fields.put(getFieldName(xsdChoice),
getProps(fieldIndex, xsdChoice, compositeTypes));
}
// TODO Add Groups
}
示例2: visit
import org.apache.ws.commons.schema.utils.XmlSchemaObjectBase; //導入依賴的package包/類
/**
* Visit a base XSD element.
* <p/>
* Could be any of:
* <ul>
* <li>A regular element</li>
* <li>A reference to a group</li>
* <li>A choice</li>
* </ul>
*
* @param xmlSchema the input XML schema
* @param element the base element
* @param level the current level in the hierarchy
* @param avroFields an array of avro fields being populated
*/
private void visit(XmlSchema xmlSchema, XmlSchemaObjectBase element,
final int level, final ArrayNode avroFields) {
if (element instanceof XmlSchemaElement) {
visit(xmlSchema, (XmlSchemaElement) element, level, avroFields);
} else if (element instanceof XmlSchemaGroupRef) {
XmlSchemaGroupRef groupRef = (XmlSchemaGroupRef) element;
XmlSchemaGroup group = xmlSchema.getGroups().get(
groupRef.getRefName());
visit(xmlSchema, group.getParticle(), level, avroFields);
} else if (element instanceof XmlSchemaChoice) {
visit(xmlSchema, (XmlSchemaChoice) element, level, avroFields);
}
}