private boolean isWrappableSequence(XmlSchemaComplexType type) { if (type.getParticle() instanceof XmlSchemaSequence) { XmlSchemaSequence seq = (XmlSchemaSequence)type.getParticle(); List<XmlSchemaSequenceMember> items = seq.getItems(); for (XmlSchemaSequenceMember member : items) { if (!(member instanceof XmlSchemaElement)) { return false; } } return true; } else if (type.getParticle() == null) { return true; } return false; }
private void addElementNames(List<QName> result, XmlSchemaComplexType type) { XmlSchemaComplexType baseType = getBaseType(type); XmlSchemaParticle particle = baseType != null ? baseType.getParticle() : type.getParticle(); addElementNames(result, particle); }
public static boolean isUnion(XmlSchemaComplexType type) { boolean isUnion = false; if (type.getParticle() instanceof XmlSchemaChoice && type.getAttributes().isEmpty()) { isUnion = true; } return isUnion; }
/** * Create an avro complex type field using an XML schema type. * * @param xsdType the XML schema complex type * @param level the depth in the hierarchy * @param avroFields array of avro fields being populated * @throws Xsd2AvroTranslatorException if something abnormal in the xsd */ private void visit(XmlSchema xmlSchema, XmlSchemaComplexType xsdType, final int level, final ArrayNode avroFields) { visit(xmlSchema, xsdType.getParticle(), level, avroFields); }
public static XmlSchemaAll getAll(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaAll all = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_ALL; } try { all = (XmlSchemaAll) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_CHOICE_PARTICLE", type); } return all; }
public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaSequence sequence = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_SEQUENCE; } try { sequence = (XmlSchemaSequence) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_SEQUENCE_PARTICLE", type); } return sequence; } public static XmlSchemaChoice getChoice(XmlSchemaComplexType type) {
public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaSequence sequence = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_SEQUENCE; } try { sequence = (XmlSchemaSequence) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_SEQUENCE_PARTICLE", type); } return sequence; } public static XmlSchemaChoice getChoice(XmlSchemaComplexType type) {
public static XmlSchemaChoice getChoice(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaChoice choice = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_CHOICE; } try { choice = (XmlSchemaChoice) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_CHOICE_PARTICLE", type); } return choice; } public static XmlSchemaAll getAll(XmlSchemaComplexType type) {
public static XmlSchemaAll getAll(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaAll all = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_ALL; } try { all = (XmlSchemaAll) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_CHOICE_PARTICLE", type); } return all; } public static boolean isAttributeNameQualified(XmlSchemaAttribute attribute, XmlSchema schema) {
public static XmlSchemaChoice getChoice(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaChoice choice = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_CHOICE; } try { choice = (XmlSchemaChoice) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_CHOICE_PARTICLE", type); } return choice; } public static XmlSchemaAll getAll(XmlSchemaComplexType type) {
public static XmlSchemaAll getAll(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaAll all = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_ALL; } try { all = (XmlSchemaAll) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_CHOICE_PARTICLE", type); } return all; } public static boolean isAttributeNameQualified(XmlSchemaAttribute attribute, XmlSchema schema) {
public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) { XmlSchemaParticle particle = type.getParticle(); XmlSchemaSequence sequence = null; if (particle == null) { // the code that uses this wants to iterate. An empty one is more useful than // a null pointer, and certainly an exception. return EMPTY_SEQUENCE; } try { sequence = (XmlSchemaSequence) particle; } catch (ClassCastException cce) { unsupportedConstruct("NON_SEQUENCE_PARTICLE", type); } return sequence; } public static XmlSchemaChoice getChoice(XmlSchemaComplexType type) {
private XmlSchemaSequence getTypeSequence(XmlSchemaComplexType type, QName parentName) { if (!(type.getParticle() instanceof XmlSchemaSequence)) { unsupportedConstruct("NON_SEQUENCE_PARTICLE", type.getQName() != null ? type.getQName() : parentName); } return (XmlSchemaSequence)type.getParticle(); }
private boolean isEmptyType(XmlSchemaType type, QName parentName) { if (type instanceof XmlSchemaComplexType) { XmlSchemaComplexType complexType = (XmlSchemaComplexType)type; if (complexType.getParticle() == null) { return true; } XmlSchemaSequence sequence = getTypeSequence(complexType, parentName); if (sequence.getItems().isEmpty()) { return true; } } return false; }
private CorbaType processRegularUnion(XmlSchemaComplexType complex, QName defaultName) throws Exception { //NEED TO DO QName name = null; QName schematypeName = complex.getQName(); if (schematypeName == null) { schematypeName = defaultName; name = createQNameCorbaNamespace(defaultName.getLocalPart() + "Type"); } else { name = createQNameCorbaNamespace(schematypeName.getLocalPart()); } return createUnion(name, (XmlSchemaChoice)complex.getParticle(), defaultName, schematypeName); }
private static XmlSchemaComplexType getRowNameBasedSchemaComplexType( XmlSchemaComplexType wrapperSchemaComplexType) { return (((XmlSchemaComplexType) ((XmlSchemaElement) ((XmlSchemaSequence) wrapperSchemaComplexType .getParticle()).getItems().getItem(0)).getSchemaType())); }
private static String getResultRowName(XmlSchemaComplexType wrapperSchemaComplexType) { return ((XmlSchemaElement) ((XmlSchemaSequence) wrapperSchemaComplexType .getParticle()).getItems().getItem(0)).getName(); }
private static void processXMLSchemaComplexType(XmlSchemaType schemaType, TypeMapper mapper, String opName, Map schemaMap, String qnameSuffix) { if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType; if (cmplxType.getContentModel() == null) { processSchemaSequence(cmplxType.getParticle(), mapper, opName, schemaMap, qnameSuffix); } else { processComplexContentModel(cmplxType, mapper, opName, schemaMap, qnameSuffix); } processAttributes(cmplxType, opName, qnameSuffix, mapper); } }
private static void processXMLSchemaComplexType(XmlSchemaType schemaType, TypeMapper mapper, String opName, Map schemaMap, String qnameSuffix) { if (schemaType instanceof XmlSchemaComplexType) { XmlSchemaComplexType cmplxType = (XmlSchemaComplexType) schemaType; if (cmplxType.getContentModel() == null) { processSchemaSequence(cmplxType.getParticle(), mapper, opName, schemaMap, qnameSuffix); } else { processComplexContentModel(cmplxType, mapper, opName, schemaMap, qnameSuffix); } processAttributes(cmplxType, opName, qnameSuffix, mapper); } }
private XmlSchemaComplexType duplicateXmlSchemaComplexType(Scope newScope) { XmlSchemaComplexType oldSchemaType = (XmlSchemaComplexType) getSchemaType(); XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, true); newSchemaType.setName(newScope.toString()); newSchemaType.setParticle(oldSchemaType.getParticle()); return newSchemaType; }