private static void factorySetupType(XmlSchemaAttribute element, SchemaCollection schemaCollection, AttributeInfo attributeInfo) { attributeInfo.type = element.getSchemaType(); if (attributeInfo.type == null) { if (element.getSchemaTypeName().equals(Constants.XSD_ANYTYPE)) { attributeInfo.anyType = true; } else { attributeInfo.type = schemaCollection.getTypeByQName(element.getSchemaTypeName()); if (attributeInfo.type == null && !element.getSchemaTypeName() .getNamespaceURI().equals(Constants.URI_2001_SCHEMA_XSD)) { JavascriptUtils.unsupportedConstruct("MISSING_TYPE", element.getSchemaTypeName() .toString(), element.getQName(), element); } } } else if (attributeInfo.type.getQName() != null && Constants.XSD_ANYTYPE.equals(attributeInfo.type.getQName())) { attributeInfo.anyType = true; } }
/** * Adds the given parameter to the complex type. * @param complexType The complex type which the attribute will be added to * @param name The name of the attribute * @param xsdType The type of the attribute */ @SuppressWarnings("unchecked") private static void addAttributeToComplexType(XmlSchemaComplexType complexType, String name, QName xsdType) { XmlSchemaAttribute attr = new XmlSchemaAttribute(); attr.setName(name); attr.setSchemaTypeName(xsdType); attr.setUse(new XmlSchemaUse("optional")); XmlSchemaAttribute tmpAttr; for (Iterator<XmlSchemaAttribute> itr = complexType.getAttributes().getIterator(); itr.hasNext();) { tmpAttr = itr.next(); if (tmpAttr.getName().equals(attr.getName())) { /* current attribute is already set, nothing more to do */ return; } } complexType.getAttributes().add(attr); }
public static boolean isAttributeNameQualified(XmlSchemaAttribute attribute, XmlSchema schema) { if (attribute.isRef()) { throw new RuntimeException("isElementNameQualified on element with ref="); } if (attribute.getForm().equals(XmlSchemaForm.QUALIFIED)) { return true; } if (attribute.getForm().equals(XmlSchemaForm.UNQUALIFIED)) { return false; } return schema.getAttributeFormDefault().equals(XmlSchemaForm.QUALIFIED); }
private boolean getAttributeQualification(XmlSchemaAttribute attr, String uri) { QName schemaName = attr.getQName(); boolean qualified = false; if (attr.getForm() == XmlSchemaForm.QUALIFIED) { qualified = true; } else { qualified = WSDLUtils.isElementFormQualified(xmlSchemaList, schemaName); } return qualified; }
/** * Obtain a suitable name for use in Javascript for an attribute. This function * is purely a tribute to the awful modularity of XmlSchema. * @param attribute * @param qualified * @return */ public String xmlAttributeString(XmlSchemaAttribute attribute, boolean qualified) { if (qualified) { // What if there were a prefix in the element's qname? This is not apparently // something that happens in this environment. String prefix = getPrefix(attribute.getQName().getNamespaceURI()); collect(prefix, attribute.getQName().getNamespaceURI()); return prefix + ":" + attribute.getName(); } return attribute.getName(); // use the non-qualified name. }
QName schemaTypeName = att.getSchemaTypeName(); if (schemaTypeName != null) { if (att.getWireName() != null) { if (baseSchemaTypeMap.containsKey(schemaTypeName)) { metainf.registerMapping(att.getWireName(), schemaTypeName, baseSchemaTypeMap.get(schemaTypeName).toString(), SchemaConstants.ATTRIBUTE_TYPE); String use = att.getUse().toString(); if (USE_NONE.equals(use) || USE_OPTIONAL.equals(use)) { metainf.addtStatus(att.getWireName(), SchemaConstants.OPTIONAL_TYPE); att.addMetaInfo( SchemaConstants.SchemaCompilerInfoHolder.CLASSNAME_KEY, className); if (att.getDefaultValue() != null) { metainf.registerDefaultValue(att.getWireName(), att.getDefaultValue()); if (att.getFixedValue() != null) { metainf.registerDefaultValue(att.getWireName(), att.getFixedValue()); metainf.registerFixedQName(att.getWireName()); metainf.registerMapping(att.getWireName(), schemaTypeName, processedTypemap.get(schemaTypeName).toString(), SchemaConstants.ATTRIBUTE_TYPE);
private void addOneSchemaCrossImports(XmlSchema schema) { /* * We need to visit all the top-level items. */ for (XmlSchemaElement element : schema.getElements().values()) { addElementCrossImportsElement(schema, element); } for (XmlSchemaAttribute attribute : schema.getAttributes().values()) { XmlSchemaUtils.addImportIfNeeded(schema, attribute.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, attribute.getSchemaTypeName()); } for (XmlSchemaType type : schema.getSchemaTypes().values()) { addCrossImportsType(schema, type); } }
QName attrName = attribute.getQName(); if (attrName.getNamespaceURI().isEmpty()) { attrName = new QName(uri, attrName.getLocalPart()); if (attribute.getUse() == XmlSchemaUse.NONE || attribute.getUse() == XmlSchemaUse.OPTIONAL) { CorbaType attType = null; if (attribute.getSchemaType() != null) { attType = convertSchemaToCorbaType(attribute.getSchemaType(), checkPrefix(attrName), attribute.getSchemaType(), null, true); if (attType != null) { attType = processPrimitiveType(attribute.getSchemaTypeName()); if (attribute.getSchemaType() != null) { membertype = convertSchemaToCorbaType(attribute.getSchemaType(), attrName, attribute.getSchemaType(), null, false); } else { membertype = processPrimitiveType(attribute.getSchemaTypeName());
XmlSchema localSchema, XmlSchema attributeSchema) { if (attribute.getQName() == null) { throw new RuntimeException("getSchemaQualifier on anonymous element."); if (attribute.isRef()) { throw new RuntimeException("getSchemaQualified on the 'from' side of ref=."); return isAttributeNameQualified(attribute, attributeSchema) || (localSchema != null && !(attribute.getQName().getNamespaceURI().equals(localSchema.getTargetNamespace()))); } else { return isAttributeNameQualified(attribute, attributeSchema);
XmlSchemaAttribute attr = new XmlSchemaAttribute(); XmlSchemaAnnotation annotation = handleAnnotation(annotationEl); attr.setAnnotation(annotation); attr.setUnhandledAttributes((Attr[]) attrs.toArray(new Attr[0]));
if (asBoolean(xmlFacets.getAttribute(), false)) final XmlSchemaAttribute xmlSchemaAttribute = new XmlSchemaAttribute(schema, false); xmlSchemaAttribute.setName(name); final XmlSchemaType visit = valueResolvedType.visit(this); if (visit instanceof XmlSchemaSimpleType) xmlSchemaAttribute.setSchemaTypeName(visit.getQName()); xmlSchemaAttribute.setSchemaType((XmlSchemaSimpleType) visit);
if (item instanceof XmlSchemaAttribute) { final XmlSchemaAttribute attribute = (XmlSchemaAttribute) item; final Object old = typeInfo.attributes.put(attribute.getQName().getLocalPart(), attribute.getSchemaTypeName()); if (old != null) { throw new IllegalArgumentException("Complain to your expert group member, spec does not support attributes with the same local name and differing namespaces: original: " + old + ", duplicate local name: " + attribute);
String attributeNamespaceURI = attribute.getQName().getNamespaceURI(); boolean attributeNoNamespace = "".equals(attributeNamespaceURI); attributeInfo.javascriptName = attribute.getQName().getLocalPart(); attributeInfo.defaultValue = attribute.getDefaultValue(); attributeInfo.fixedValue = attribute.getFixedValue(); attributeInfo.use = attribute.getUse(); factorySetupType(attribute, schemaCollection, attributeInfo); } else { // any
XmlSchemaAttribute attribute = new XmlSchemaAttribute(root, false); complex.getAttributes().add(attribute); attribute.setName(name.getLocalPart()); AegisType type = getType(inf, name); attribute.setSchemaTypeName(type.getSchemaType()); String ns = name.getNamespaceURI(); if (!ns.equals(root.getTargetNamespace())) {
sequenceDataAttr = (XmlSchemaAttribute) sequenceDataObject; defGroup.addElementEntry(new StaticOutputElement(dataService, sequenceDataAttr.getName(), sequenceDataAttr .getName(), sequenceDataAttr.getName(), DBConstants.DBSFields.COLUMN, DBConstants.DBSFields.ATTRIBUTE, namespace, sequenceDataAttr.getSchemaTypeName(), new HashSet<String>(), DBConstants.DataCategory.VALUE, DBConstants.ResultTypes.XML, null, ParamValue.PARAM_VALUE_SCALAR, null));
private void addCrossImportsAttributeList(XmlSchema schema, List<XmlSchemaAttributeOrGroupRef> list) { for (XmlSchemaAttributeOrGroupRef attr : list) { QName ref = null; if (attr instanceof XmlSchemaAttribute) { ref = ((XmlSchemaAttribute)attr).getRef().getTargetQName(); } else { XmlSchemaAttributeGroupRef groupRef = (XmlSchemaAttributeGroupRef)attr; ref = groupRef.getRef().getTargetQName(); } if (ref != null) { XmlSchemaUtils.addImportIfNeeded(schema, ref); } } }
private static void processAttributes(XmlSchemaComplexType complexType, String opName, String qnameSuffix, TypeMapper typeMap) { for (XmlSchemaObject item : complexType.getAttributes()) { XmlSchemaAttribute xmlSchemaAttribute; if (item instanceof XmlSchemaAttribute) { xmlSchemaAttribute = (XmlSchemaAttribute) item; populateClassName(xmlSchemaAttribute.getMetaInfoMap(), typeMap, opName, false, xmlSchemaAttribute.getName(), qnameSuffix); } } }
Attr[] unhandled = attributeObj.getUnhandledAttributes();
if (item instanceof XmlSchemaAttribute) { final XmlSchemaAttribute attribute = (XmlSchemaAttribute) item; if (attribute.getRefName().equals(SOAP_ARRAY_TYPE)) { for (final Attr attr : attribute.getUnhandledAttributes()) { final QName attQName = new QName(attr.getNamespaceURI(), attr.getLocalName()); if (WSDL_ARRAY_TYPE.equals(attQName)) {