private void addCrossImports(XmlSchema schema, XmlSchemaAll all) { for (XmlSchemaObjectBase seqMember : all.getItems()) { if (seqMember instanceof XmlSchemaElement) { addElementCrossImportsElement(schema, (XmlSchemaElement)seqMember); } } }
private XmlSchemaAll handleAll(XmlSchema schema, Element allEl, Element schemaEl) { XmlSchemaAll all = new XmlSchemaAll(); //handle min and max occurences all.minOccurs = getMinOccurs(allEl); all.maxOccurs = getMaxOccurs(allEl); for (Element el = XDOMUtil.getFirstChildElementNS(allEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil.getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, false); all.items.add(element); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); all.setAnnotation(annotation); } } return all; }
sequence = (XmlSchemaAll) particle; } else { sequence = new XmlSchemaAll(); complexType.setParticle(sequence); sequence.setMinOccurs(optional ? 0 : 1); sequence.getItems().add(tmpElement);
private void addCrossImports(XmlSchema schema, XmlSchemaAll all) { for (XmlSchemaObjectBase seqMember : all.getItems()) { if (seqMember instanceof XmlSchemaElement) { addElementCrossImportsElement(schema, (XmlSchemaElement)seqMember); } } }
private XmlSchemaAll handleAll(XmlSchema schema, Element allEl, Element schemaEl) { XmlSchemaAll all = new XmlSchemaAll(); //handle min and max occurences all.minOccurs = getMinOccurs(allEl); all.maxOccurs = getMaxOccurs(allEl); for (Element el = XDOMUtil.getFirstChildElementNS(allEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, false); all.items.add(element); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); all.setAnnotation(annotation); } } return all; }
private void addCrossImports(XmlSchema schema, XmlSchemaAll all) { for (XmlSchemaObjectBase seqMember : all.getItems()) { if (seqMember instanceof XmlSchemaElement) { addElementCrossImportsElement(schema, (XmlSchemaElement)seqMember); } } }
private XmlSchemaAll handleAll(XmlSchema schema, Element allEl, Element schemaEl) { XmlSchemaAll all = new XmlSchemaAll(); //handle min and max occurences all.minOccurs = getMinOccurs(allEl); all.maxOccurs = getMaxOccurs(allEl); for (Element el = XDOMUtil.getFirstChildElementNS(allEl, XmlSchema.SCHEMA_NS); el != null; el = XDOMUtil .getNextSiblingElementNS(el, XmlSchema.SCHEMA_NS)) { if (el.getLocalName().equals("element")) { XmlSchemaElement element = handleElement(schema, el, schemaEl, false); all.items.add(element); } else if (el.getLocalName().equals("annotation")) { XmlSchemaAnnotation annotation = handleAnnotation(el); all.setAnnotation(annotation); } } return all; }
private void addCrossImports(XmlSchema schema, XmlSchemaAll all) { for (XmlSchemaObjectBase seqMember : all.getItems()) { if (seqMember instanceof XmlSchemaElement) { addElementCrossImportsElement(schema, (XmlSchemaElement)seqMember); } } }
private void addCrossImports(XmlSchema schema, XmlSchemaAll all) { for (XmlSchemaObject seqMember : all.getItems()) { if (seqMember instanceof XmlSchemaElement) { addElementCrossImportsElement(schema, (XmlSchemaElement)seqMember); } } }
processCollectionElements(all.getItems(), level); } else {
/** * A particle is usually all or sequence. It contains a collection of other * schema objects that need to be processed. * * @param schema the XML Schema * @param jaxbNamespace the JAXB namespace * @param jaxbNamespacePrefix the JAXB namespace prefix * @param parentName the name of the parent schema object for logging * @param particle the particle schema object */ protected void processParticle(final XmlSchema schema, final String jaxbNamespace, final String jaxbNamespacePrefix, final QName parentName, final XmlSchemaParticle particle) { if (particle == null) { return; } if (particle instanceof XmlSchemaSequence) { XmlSchemaSequence sequence = (XmlSchemaSequence) particle; processCollectionElements(schema, jaxbNamespace, jaxbNamespacePrefix, sequence.getItems()); } else if (particle instanceof XmlSchemaAll) { XmlSchemaAll all = (XmlSchemaAll) particle; processCollectionElements(schema, jaxbNamespace, jaxbNamespacePrefix, all.getItems()); } }
int fieldIndex = 0; XmlSchemaAll all = (XmlSchemaAll) particle; for (XmlSchemaAllMember member : all.getItems()) { addField(fieldIndex, member, fields, compositeTypes); fieldIndex++;
private void visit(XmlSchema xmlSchema, XmlSchemaParticle particle, final int level, final ArrayNode avroFields) { if (particle.getMaxOccurs() > 1) { /* TODO find a way to handle occuring sequences and alls */ log.warn("Schema object at line " + particle.getLineNumber() + " contains a multi-occurence particle that is ignored"); } if (particle instanceof XmlSchemaSequence) { XmlSchemaSequence sequence = (XmlSchemaSequence) particle; for (XmlSchemaSequenceMember member : sequence.getItems()) { visit(xmlSchema, member, level, avroFields); } } else if (particle instanceof XmlSchemaAll) { XmlSchemaAll all = (XmlSchemaAll) particle; for (XmlSchemaAllMember member : all.getItems()) { visit(xmlSchema, member, level, avroFields); } } else { /* TODO process other particle types of interest */ /* TODO find a way to handle xsd:attribute */ log.warn("Schema object does not contain a sequence or all element at line " + particle.getLineNumber()); } }
for (XmlSchemaAllMember member : xmlSchemaAll.getItems()) { XmlSchemaElement innerElement = (XmlSchemaElement) member; QName qName = innerElement.getQName();
} else if (particle instanceof XmlSchemaAll) { XmlSchemaAll acontainer = (XmlSchemaAll)particle; iterL = acontainer.getItems().iterator(); } else { LOG.warning("Unknown particle type " + particle.getClass().getName());
for (XmlSchemaAllMember sequenceMember : sequence.getItems()) {
for (XmlSchemaAllMember sequenceMember : sequence.getItems()) {
List<XmlSchemaAllMember> items = ((XmlSchemaAll) particle).getItems(); processSchemaAllItems(parentElementQName, items, metainfHolder, false, parentSchema); } else if (particle instanceof XmlSchemaChoice) {
List<XmlSchemaAllMember> items = ((XmlSchemaAll) particle).getItems(); processSchemaAllItems(parentElementQName, items, metainfHolder, false, parentSchema); } else if (particle instanceof XmlSchemaChoice) {