org.apache.cxf.common.xmlschema.XmlSchemaUtils类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(12.2k)|赞(0)|评价(0)|浏览(68)

本文整理了Java中org.apache.cxf.common.xmlschema.XmlSchemaUtils类的一些代码示例,展示了XmlSchemaUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlSchemaUtils类的具体详情如下:
包路径:org.apache.cxf.common.xmlschema.XmlSchemaUtils
类名称:XmlSchemaUtils

XmlSchemaUtils介绍

[英]Some functions that avoid problems with Commons XML Schema.
[中]一些避免Commons XML模式出现问题的函数。

代码示例

代码示例来源:origin: apache/cxf

private void addXmimeToSchema(XmlSchema root) {
  XmlSchemaUtils.addImportIfNeeded(root, AbstractXOPType.XML_MIME_NS);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

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;
  }
}

代码示例来源:origin: org.apache.cxf/cxf-core

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;
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

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);

代码示例来源:origin: org.apache.cxf/cxf-api

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) {

代码示例来源:origin: org.apache.cxf/cxf-api

return isAttributeNameQualified(attribute, attributeSchema)
    || (localSchema != null
      && !(attribute.getQName().getNamespaceURI().equals(localSchema.getTargetNamespace())));
} else {
  return isAttributeNameQualified(attribute, attributeSchema);

代码示例来源:origin: apache/cxf

QName elementQName = XmlSchemaUtils.getElementQualifiedName(element, currentSchema);
String elementNamespaceURI = elementQName.getNamespaceURI();
          && XmlSchemaUtils.isElementQualified(element, true, currentSchema,
                             elementSchema);
elementInfo.xmlName = prefixAccumulator.xmlElementString(elementQName, qualified);

代码示例来源:origin: org.apache.cxf/cxf-api

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);
}

代码示例来源:origin: apache/cxf

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;
}

代码示例来源:origin: apache/cxf

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());
}

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

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) {

代码示例来源:origin: org.apache.cxf/cxf-core

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);

代码示例来源:origin: apache/cxf

return isAttributeNameQualified(attribute, attributeSchema)
    || (localSchema != null
      && !(attribute.getQName().getNamespaceURI().equals(localSchema.getTargetNamespace())));
return isAttributeNameQualified(attribute, attributeSchema);

代码示例来源:origin: apache/cxf

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);

代码示例来源:origin: org.apache.cxf/cxf-common-utilities

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);
}

代码示例来源:origin: apache/cxf

public static void addUtilityTypesToSchema(XmlSchema root) {
  XmlSchemaUtils.addImportIfNeeded(root, UTILITY_TYPES_SCHEMA_NS);
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

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) {

代码示例来源:origin: org.apache.cxf/cxf-api

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;
  }
}

代码示例来源:origin: apache/cxf

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;
}

代码示例来源:origin: apache/cxf

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);

相关文章