Example #1
0
 private void addCrossImports(XmlSchema schema, XmlSchemaContentModel contentModel) {
   if (contentModel == null) {
     return;
   }
   XmlSchemaContent content = contentModel.getContent();
   if (content == null) {
     return;
   }
   if (content instanceof XmlSchemaComplexContentExtension) {
     XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
     XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
     addCrossImportsAttributeList(schema, extension.getAttributes());
     XmlSchemaParticle particle = extension.getParticle();
     if (particle instanceof XmlSchemaSequence) {
       addCrossImports(schema, (XmlSchemaSequence) particle);
     } else if (particle instanceof XmlSchemaChoice) {
       addCrossImports(schema, (XmlSchemaChoice) particle);
     } else if (particle instanceof XmlSchemaAll) {
       addCrossImports(schema, (XmlSchemaAll) particle);
     }
   } else if (content instanceof XmlSchemaComplexContentRestriction) {
     XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
     XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
     addCrossImportsAttributeList(schema, restriction.getAttributes());
   } else if (content instanceof XmlSchemaSimpleContentExtension) {
     XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;
     XmlSchemaUtils.addImportIfNeeded(schema, extension.getBaseTypeName());
     addCrossImportsAttributeList(schema, extension.getAttributes());
   } else if (content instanceof XmlSchemaSimpleContentRestriction) {
     XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
     XmlSchemaUtils.addImportIfNeeded(schema, restriction.getBaseTypeName());
     addCrossImportsAttributeList(schema, restriction.getAttributes());
   }
 }
Example #2
0
  public static List<XmlSchemaAttributeOrGroupRef> getContentAttributes(XmlSchemaComplexType type) {
    XmlSchemaContentModel model = type.getContentModel();
    if (model == null) {
      return null;
    }
    XmlSchemaContent content = model.getContent();
    if (content == null) {
      return null;
    }
    if (!(content instanceof XmlSchemaComplexContentExtension)) {
      return null;
    }

    // TODO: the anyAttribute case.
    XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension) content;
    return ext.getAttributes();
  }
Example #3
0
  public static QName getBaseType(XmlSchemaComplexType type) {
    XmlSchemaContentModel model = type.getContentModel();
    if (model == null) {
      return null;
    }
    XmlSchemaContent content = model.getContent();
    if (content == null) {
      return null;
    }

    if (!(content instanceof XmlSchemaComplexContentExtension)) {
      return null;
    }

    XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension) content;
    return ext.getBaseTypeName();
  }