public XmlSchemaElement getElementByName(QName name) { return (XmlSchemaElement)elements.getItem(name); }
/** * Get name for item from another schema. * * @param table the other schema table * @param xsdObject the object for which we seek a name * @return the name */ protected static QName getName(final XmlSchemaObjectTable table, final XmlSchemaObject xsdObject) { for (Iterator < ? > it = table.getNames(); it.hasNext();) { QName name = (QName) it.next(); if (xsdObject == table.getItem(name)) { return name; } } return null; }
/** * Creates XML schema complex type with the given namespace and the name. * @param cparams The common parameters used in the schema generator * @param namespace The namespace of the complex type * @param name The name of the complex type * @param global Signal if the newly created type is global or not * @return The newly create XML schema complex type */ private static XmlSchemaComplexType createComplexType(CommonParams cparams, String namespace, String name, boolean global) { XmlSchema schema = retrieveSchema(cparams, namespace); XmlSchemaComplexType type = new XmlSchemaComplexType(schema); Map<QName, XmlSchemaComplexType> typeMap = cparams.getTypeMap(); if (global) { QName qname = new QName(namespace, name); if (typeMap.containsKey(qname)) { int suffix = 1; // start with 2, if T is there, the next one would be T2 while (typeMap.containsKey(new QName(namespace, name + (++suffix)))); name = name + suffix; qname = new QName(namespace, name); } type.setName(name); cparams.getTypeMap().put(qname, type); schema.getItems().add(type); schema.getSchemaTypes().add(qname, type); } return type; }
/** * Creates new XmlSchemaRedefine */ public XmlSchemaRedefine() { items = new XmlSchemaObjectCollection(); schemaTypes = new XmlSchemaObjectTable(); groups = new XmlSchemaObjectTable(); attributeGroups = new XmlSchemaObjectTable(); }
XmlSchemaObjectTable objTable = schema.getElements(); Iterator elementNames = objTable.getNames();
private void buildXmlTypeInfos() { for (final XmlSchema schema : xmlSchemaCollection.getXmlSchemas()) { // Global Elements for (final Iterator iterator = schema.getElements().getValues(); iterator.hasNext(); ) { final XmlSchemaElement globalElement = (XmlSchemaElement) iterator.next(); addGlobalElement(globalElement); } // Global Types for (final Iterator iterator = schema.getSchemaTypes().getValues(); iterator.hasNext(); ) { final XmlSchemaType globalType = (XmlSchemaType) iterator.next(); addType(globalType.getQName(), globalType); } } }
XmlSchema schema = retrieveSchema(cparams, namespace); schema.getItems().add(element); schema.getElements().add(qname, element);
/** * Creates new XmlSchemaRedefine */ public XmlSchemaRedefine() { items = new XmlSchemaObjectCollection(); schemaTypes = new XmlSchemaObjectTable(); groups = new XmlSchemaObjectTable(); attributeGroups = new XmlSchemaObjectTable(); }
public QName[] getElementNames() { List<QName> result = new ArrayList<QName>(); Iterator<?> iterator = schema.getElements().getNames(); while (iterator.hasNext()) { QName name = (QName) iterator.next(); result.add(name); } return result.toArray(new QName[result.size()]); }
new FileInputStream(xsdFile), xsdEncoding), null); XmlSchemaObjectTable schemaElements = xsd.getElements(); Iterator < ? > it = schemaElements.getValues(); while (it.hasNext()) { Object element = it.next();
public XmlSchemaType getTypeByName(QName name) { return (XmlSchemaType)schemaTypes.getItem(name); }
/** * Create a nex XML schema element. * <p/> * We use the source URI to mark these injected elements. * * @param typeQName the element type * @param elementQName the element name * @param schema the XML schema */ public static void addXmlSchemaElement(final QName typeQName, final QName elementQName, final XmlSchema schema) { XmlSchemaElement el = new XmlSchemaElement(); el.setQName(elementQName); el.setName(elementQName.getLocalPart()); el.setSchemaTypeName(typeQName); el.setSchemaType(schema.getTypeByName(typeQName)); el.setSourceURI(XsdConstants.INJECTED_ELEMENT); schema.getElements().add(elementQName, el); schema.getItems().add(el); }
/** * Creates new XmlSchemaRedefine */ public XmlSchemaRedefine() { items = new XmlSchemaObjectCollection(); schemaTypes = new XmlSchemaObjectTable(); groups = new XmlSchemaObjectTable(); attributeGroups = new XmlSchemaObjectTable(); }
} else { XmlSchemaAttribute attribute = (XmlSchemaAttribute) attributes .getItem(name); if (deep) { if (attribute == null) {