private void addXmimeToSchema(XmlSchema root) { XmlSchemaUtils.addImportIfNeeded(root, AbstractXOPType.XML_MIME_NS); }
public static List<XmlSchemaObject> getContentElements(XmlSchemaComplexType type, SchemaCollection collection) { List<XmlSchemaObject> results = new ArrayList<XmlSchemaObject>(); QName baseTypeName = getBaseType(type); if (baseTypeName != null) { XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName); // recurse onto the base type ... results.addAll(getContentElements(baseType, collection)); // and now process our sequence. XmlSchemaSequence extSequence = getContentSequence(type); if (extSequence != null) { for (XmlSchemaSequenceMember item : extSequence.getItems()) { /* * For now, leave the return type alone. Fix some day. */ results.add((XmlSchemaObject)item); } } return results; } else { // no base type, the simple case. XmlSchemaSequence sequence = getSequence(type); for (XmlSchemaSequenceMember item : sequence.getItems()) { results.add((XmlSchemaObject)item); } return results; } }
public static List<XmlSchemaAnnotated> getContentAttributes(XmlSchemaComplexType type, SchemaCollection collection) { List<XmlSchemaAnnotated> results = new ArrayList<>(); QName baseTypeName = getBaseType(type); if (baseTypeName != null) { XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName); // recurse onto the base type ... results.addAll(getContentAttributes(baseType, collection)); // and now process our sequence. List<XmlSchemaAttributeOrGroupRef> extAttrs = getContentAttributes(type); results.addAll(extAttrs); return results; } // no base type, the simple case. List<XmlSchemaAttributeOrGroupRef> attrs = type.getAttributes(); results.addAll(attrs); return results; }
XmlSchema localSchema, XmlSchema elementSchema) { QName qn = getElementQualifiedName(element, localSchema); if (qn == null) { throw new RuntimeException("isElementQualified on anonymous element."); return isElementNameQualified(element, elementSchema) || (localSchema != null && !(qn.getNamespaceURI().equals(localSchema.getTargetNamespace()))); } else { return isElementNameQualified(element, elementSchema);
private void addCrossImportsType(XmlSchema schema, XmlSchemaType schemaType) { // the base type might cross schemas. if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType)schemaType; XmlSchemaUtils.addImportIfNeeded(schema, complexType.getBaseSchemaTypeName()); addCrossImports(schema, complexType.getContentModel()); addCrossImportsAttributeList(schema, complexType.getAttributes()); // could it be a choice or something else? if (complexType.getParticle() instanceof XmlSchemaChoice) { XmlSchemaChoice choice = XmlSchemaUtils.getChoice(complexType); addCrossImports(schema, choice); } else if (complexType.getParticle() instanceof XmlSchemaAll) { XmlSchemaAll all = XmlSchemaUtils.getAll(complexType); addCrossImports(schema, all); } else { XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(complexType); addCrossImports(schema, sequence); } } } private void addCrossImports(XmlSchema schema, XmlSchemaAll all) {
return isAttributeNameQualified(attribute, attributeSchema) || (localSchema != null && !(attribute.getQName().getNamespaceURI().equals(localSchema.getTargetNamespace()))); } else { return isAttributeNameQualified(attribute, attributeSchema);
QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, currentSchema); String elementNamespaceURI = elementQName.getNamespaceURI(); && XmlSchemaUtils.isElementQualified(element, true, currentSchema, elementSchema); elementInfo.xmlName = prefixAccumulator.xmlElementString(elementQName, qualified);
public static void unsupportedConstruct(String messageKey, String what, QName subjectName, XmlSchemaObject subject) { Message message = new Message(messageKey, LOG, what, subjectName == null ? "anonymous" : subjectName, cleanedUpSchemaSource(subject)); LOG.severe(message.toString()); throw new UnsupportedConstruct(message); }
public static List<XmlSchemaObject> getContentElements(XmlSchemaComplexType type, SchemaCollection collection) { List<XmlSchemaObject> results = new ArrayList<>(); QName baseTypeName = XmlSchemaUtils.getBaseType(type); if (baseTypeName != null) { XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName); // recurse onto the base type ... results.addAll(getContentElements(baseType, collection)); // and now process our sequence. XmlSchemaSequence extSequence = getContentSequence(type); if (extSequence != null) { for (XmlSchemaSequenceMember item : extSequence.getItems()) { /* * For now, leave the return type alone. Fix some day. */ results.add((XmlSchemaObject)item); } } return results; } // no base type, the simple case. XmlSchemaSequence sequence = getSequence(type); for (XmlSchemaSequenceMember item : sequence.getItems()) { results.add((XmlSchemaObject)item); } return results; }
public void complexTypeConstructorAndAccessors(QName name, XmlSchemaComplexType type) { accessors = new StringBuilder(); utils = new JavascriptUtils(code); List<XmlSchemaObject> items = JavascriptUtils.getContentElements(type, xmlSchemaCollection); List<XmlSchemaAnnotated> attrs = XmlSchemaUtils.getContentAttributes(type, xmlSchemaCollection); final String elementPrefix = "this._"; String typeObjectName = nameManager.getJavascriptName(name); code.append("//\n"); code.append("// Constructor for XML Schema item " + name.toString() + "\n"); code.append("//\n"); code.append("function " + typeObjectName + " () {\n"); // to assist in debugging we put a type property into every object. utils.appendLine("this.typeMarker = '" + typeObjectName + "';"); for (XmlSchemaObject thing : items) { ParticleInfo itemInfo = ParticleInfo.forLocalItem(thing, xmlSchema, xmlSchemaCollection, prefixAccumulator, type.getQName()); constructItem(type, elementPrefix, typeObjectName, itemInfo); } for (XmlSchemaAnnotated thing : attrs) { AttributeInfo itemInfo = AttributeInfo.forLocalItem(thing, xmlSchema, xmlSchemaCollection, prefixAccumulator, type.getQName()); constructOneItem(type, elementPrefix, typeObjectName, itemInfo); } code.append("}\n\n"); code.append(accessors.toString()); }
private void addCrossImportsType(XmlSchema schema, XmlSchemaType schemaType) { // the base type might cross schemas. if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType)schemaType; XmlSchemaUtils.addImportIfNeeded(schema, complexType.getBaseSchemaTypeName()); addCrossImports(schema, complexType.getContentModel()); addCrossImportsAttributeList(schema, complexType.getAttributes()); // could it be a choice or something else? if (complexType.getParticle() instanceof XmlSchemaChoice) { XmlSchemaChoice choice = XmlSchemaUtils.getChoice(complexType); addCrossImports(schema, choice); } else if (complexType.getParticle() instanceof XmlSchemaAll) { XmlSchemaAll all = XmlSchemaUtils.getAll(complexType); addCrossImports(schema, all); } else { XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(complexType); addCrossImports(schema, sequence); } } } private void addCrossImports(XmlSchema schema, XmlSchemaAll all) {
XmlSchema localSchema, XmlSchema elementSchema) { QName qn = getElementQualifiedName(element, localSchema); if (qn == null) { throw new RuntimeException("isElementQualified on anonymous element."); return isElementNameQualified(element, elementSchema) || (localSchema != null && !(qn.getNamespaceURI().equals(localSchema.getTargetNamespace()))); return isElementNameQualified(element, elementSchema);
return isAttributeNameQualified(attribute, attributeSchema) || (localSchema != null && !(attribute.getQName().getNamespaceURI().equals(localSchema.getTargetNamespace()))); return isAttributeNameQualified(attribute, attributeSchema);
utils.appendLine("cxfjsutils.trace('processing " + itemInfo.getJavascriptName() + "');"); XmlSchemaElement element = (XmlSchemaElement)itemInfo.getParticle(); QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, xmlSchema); String elementNamespaceURI = elementQName.getNamespaceURI(); boolean elementNoNamespace = "".equals(elementNamespaceURI); && XmlSchemaUtils.isElementQualified(element, itemInfo.isGlobal(), xmlSchema, elementSchema);
public static void unsupportedConstruct(String messageKey, String what, QName subjectName, XmlSchemaObject subject) { Message message = new Message(messageKey, LOG, what, subjectName == null ? "anonymous" : subjectName, cleanedUpSchemaSource(subject)); LOG.severe(message.toString()); throw new UnsupportedConstruct(message); }
public static void addUtilityTypesToSchema(XmlSchema root) { XmlSchemaUtils.addImportIfNeeded(root, UTILITY_TYPES_SCHEMA_NS); }
private void addCrossImportsType(XmlSchema schema, XmlSchemaType schemaType) { // the base type might cross schemas. if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType)schemaType; XmlSchemaUtils.addImportIfNeeded(schema, complexType.getBaseSchemaTypeName()); addCrossImports(schema, complexType.getContentModel()); addCrossImportsAttributeList(schema, complexType.getAttributes()); // could it be a choice or something else? if (complexType.getParticle() instanceof XmlSchemaChoice) { XmlSchemaChoice choice = XmlSchemaUtils.getChoice(complexType); addCrossImports(schema, choice); } else if (complexType.getParticle() instanceof XmlSchemaAll) { XmlSchemaAll all = XmlSchemaUtils.getAll(complexType); addCrossImports(schema, all); } else { XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(complexType); addCrossImports(schema, sequence); } } } private void addCrossImports(XmlSchema schema, XmlSchemaAll all) {
public static List<XmlSchemaObject> getContentElements(XmlSchemaComplexType type, SchemaCollection collection) { List<XmlSchemaObject> results = new ArrayList<XmlSchemaObject>(); QName baseTypeName = getBaseType(type); if (baseTypeName != null) { XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName); // recurse onto the base type ... results.addAll(getContentElements(baseType, collection)); // and now process our sequence. XmlSchemaSequence extSequence = getContentSequence(type); if (extSequence != null) { for (XmlSchemaSequenceMember item : extSequence.getItems()) { /* * For now, leave the return type alone. Fix some day. */ results.add((XmlSchemaObject)item); } } return results; } else { // no base type, the simple case. XmlSchemaSequence sequence = getSequence(type); for (XmlSchemaSequenceMember item : sequence.getItems()) { results.add((XmlSchemaObject)item); } return results; } }
public static List<XmlSchemaAnnotated> getContentAttributes(XmlSchemaComplexType type, SchemaCollection collection) { List<XmlSchemaAnnotated> results = new ArrayList<>(); QName baseTypeName = getBaseType(type); if (baseTypeName != null) { XmlSchemaComplexType baseType = (XmlSchemaComplexType)collection.getTypeByQName(baseTypeName); // recurse onto the base type ... results.addAll(getContentAttributes(baseType, collection)); // and now process our sequence. List<XmlSchemaAttributeOrGroupRef> extAttrs = getContentAttributes(type); results.addAll(extAttrs); return results; } // no base type, the simple case. List<XmlSchemaAttributeOrGroupRef> attrs = type.getAttributes(); results.addAll(attrs); return results; }
XmlSchema localSchema, XmlSchema elementSchema) { QName qn = getElementQualifiedName(element, localSchema); if (qn == null) { throw new RuntimeException("isElementQualified on anonymous element."); return isElementNameQualified(element, elementSchema) || (localSchema != null && !(qn.getNamespaceURI().equals(localSchema.getTargetNamespace()))); return isElementNameQualified(element, elementSchema);