public static XmlSchemaElement getReferredElement(XmlSchemaElement element, SchemaCollection xmlSchemaCollection) { if (element.isRef()) { /* * Calling getTarget works if everything is in the collection already. */ XmlSchemaElement refElement = element.getRef().getTarget(); if (refElement == null) { throw new RuntimeException("Dangling reference"); } return refElement; } return null; }
public static XmlSchemaElement getReferredElement(XmlSchemaElement element, SchemaCollection xmlSchemaCollection) { if (element.isRef()) { /* * Calling getTarget works if everything is in the collection already. */ XmlSchemaElement refElement = element.getRef().getTarget(); if (refElement == null) { throw new RuntimeException("Dangling reference"); } return refElement; } return null; }
public static XmlSchemaElement getReferredElement(XmlSchemaElement element, SchemaCollection xmlSchemaCollection) { if (element.isRef()) { /* * Calling getTarget works if everything is in the collection already. */ XmlSchemaElement refElement = element.getRef().getTarget(); if (refElement == null) { throw new RuntimeException("Dangling reference"); } return refElement; } return null; }
private boolean getElementQualification(XmlSchemaElement element, String uri) { QName schemaName = element.getQName(); if (element.isRef()) { schemaName = element.getRef().getTargetQName(); } if (schemaName.getNamespaceURI().isEmpty()) { schemaName = new QName(uri, schemaName.getLocalPart()); } boolean qualified = false; if (element.getForm() == XmlSchemaForm.QUALIFIED) { qualified = true; } else { qualified = WSDLUtils.isElementFormQualified(xmlSchemaList, schemaName); } return qualified; }
/** * Wrapper around XmlSchemaElement.setName that checks for inconsistency with * refName. * @param element * @param name */ public static void setElementName(XmlSchemaElement element, String name) { if (name != null && element.isRef() && !element.getRef().getTargetQName().getLocalPart().equals(name) && (element.getQName() == null || element.getQName().getLocalPart().equals(name))) { LOG.severe("Attempt to set the name of an element with a reference name."); throw new XmlSchemaInvalidOperation("Attempt to set the name of an element " + "with a reference name."); } element.setName(name); }
/** * Wrapper around XmlSchemaElement.setName that checks for inconsistency with * refName. * @param element * @param name */ public static void setElementName(XmlSchemaElement element, String name) { if (name != null && element.isRef() && !element.getRef().getTargetQName().getLocalPart().equals(name) && (element.getQName() == null || element.getQName().getLocalPart().equals(name))) { LOG.severe("Attempt to set the name of an element with a reference name."); throw new XmlSchemaInvalidOperation("Attempt to set the name of an element " + "with a reference name."); } element.setName(name); }
/** * Wrapper around XmlSchemaElement.setName that checks for inconsistency with * refName. * @param element * @param name */ public static void setElementName(XmlSchemaElement element, String name) { if (name != null && element.isRef() && !element.getRef().getTargetQName().getLocalPart().equals(name) && (element.getQName() == null || element.getQName().getLocalPart().equals(name))) { LOG.severe("Attempt to set the name of an element with a reference name."); throw new XmlSchemaInvalidOperation("Attempt to set the name of an element " + "with a reference name."); } element.setName(name); }
/** * Wrapper around XmlSchemaElement.setRefName that checks for inconsistency with * name and QName. * @param element * @param name */ public static void setElementRefName(XmlSchemaElement element, QName name) { if (name != null && ((element.getQName() != null && !element.getQName().equals(name)) || (element.getName() != null && !element.getName().equals(name.getLocalPart())))) { LOG.severe("Attempt to set the refName of an element with a name or QName"); throw new XmlSchemaInvalidOperation("Attempt to set the refName of an element " + "with a name or QName."); } element.getRef().setTargetQName(name); // cxf conventionally keeps something in the name slot. }
/** * Wrapper around XmlSchemaElement.setRefName that checks for inconsistency with * name and QName. * @param element * @param name */ public static void setElementRefName(XmlSchemaElement element, QName name) { if (name != null && ((element.getQName() != null && !element.getQName().equals(name)) || (element.getName() != null && !element.getName().equals(name.getLocalPart())))) { LOG.severe("Attempt to set the refName of an element with a name or QName"); throw new XmlSchemaInvalidOperation("Attempt to set the refName of an element " + "with a name or QName."); } element.getRef().setTargetQName(name); // cxf conventionally keeps something in the name slot. }
/** * Wrapper around XmlSchemaElement.setRefName that checks for inconsistency with * name and QName. * @param element * @param name */ public static void setElementRefName(XmlSchemaElement element, QName name) { if (name != null && ((element.getQName() != null && !element.getQName().equals(name)) || (element.getName() != null && !element.getName().equals(name.getLocalPart())))) { LOG.severe("Attempt to set the refName of an element with a name or QName"); throw new XmlSchemaInvalidOperation("Attempt to set the refName of an element " + "with a name or QName."); } element.getRef().setTargetQName(name); // cxf conventionally keeps something in the name slot. }
/** * Wrapper around XmlSchemaElement.setRefName that checks for inconsistency with * name and QName. * @param element * @param name */ public static void setElementRefName(XmlSchemaElement element, QName name) { if (name != null && ((element.getQName() != null && !element.getQName().equals(name)) || (element.getName() != null && !element.getName().equals(name.getLocalPart())))) { LOG.severe("Attempt to set the refName of an element with a name or QName"); throw new XmlSchemaInvalidOperation("Attempt to set the refName of an element " + "with a name or QName."); } element.getRef().setTargetQName(name); // cxf conventionally keeps something in the name slot. }
/** * Wrapper around XmlSchemaElement.setRefName that checks for inconsistency with * name and QName. * @param element * @param name */ public static void setElementRefName(XmlSchemaElement element, QName name) { if (name != null && ((element.getQName() != null && !element.getQName().equals(name)) || (element.getName() != null && !element.getName().equals(name.getLocalPart())))) { LOG.severe("Attempt to set the refName of an element with a name or QName"); throw new XmlSchemaInvalidOperation("Attempt to set the refName of an element " + "with a name or QName."); } element.getRef().setTargetQName(name); // cxf conventionally keeps something in the name slot. }
private CorbaType processElementType(XmlSchemaElement stype, QName defaultName, String uri) throws Exception { String name = null; QName schemaTypeName = null; XmlSchemaType schemaType = stype.getSchemaType(); if (stype.getQName() == null) { if (stype.getRef().getTargetQName() == null) { schemaTypeName = defaultName; } else { name = stype.getRef().getTargetQName().getLocalPart(); schemaType = findSchemaType(stype.getRef().getTargetQName()); } } else { name = stype.getQName().getLocalPart(); } if (schemaTypeName == null) { schemaTypeName = createQNameTargetNamespace(name); } CorbaType result = convertSchemaToCorbaType(schemaType, schemaTypeName, schemaType, null, false); result.setQualified(getElementQualification(stype, uri)); return result; }
private static List<WrapperElement> createWrappedElements(XmlSchemaSequence seq) { List<WrapperElement> qnames = new ArrayList<>(); if (seq != null) { List<XmlSchemaSequenceMember> items = seq.getItems(); for (XmlSchemaSequenceMember seqMember : items) { XmlSchemaElement subElement = (XmlSchemaElement)seqMember; if (subElement.getQName() != null) { qnames.add(new WrapperElement(subElement.getWireName(), subElement.getSchemaTypeName())); } else { qnames.add(new WrapperElement(subElement.getRef().getTargetQName(), subElement.getSchemaTypeName())); } } } return qnames; }
public static XmlSchemaElement getXmlSchemaSequenceElement(XmlSchemaObject schemaType, ServiceInfo serviceInfo) { XmlSchemaObject stype = schemaType; XmlSchemaElement el = null; if (schemaType instanceof XmlSchemaElement) { stype = ((XmlSchemaElement) schemaType).getSchemaType(); if (stype == null) { stype = CorbaUtils.getXmlSchemaType(serviceInfo, ((XmlSchemaElement) schemaType) .getRef().getTargetQName()); } } if (stype instanceof XmlSchemaComplexType) { //only one element inside the XmlSchemaComplexType XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype; XmlSchemaParticle group = ctype.getParticle(); /* This code seems to think that we're guaranteed a sequence here */ XmlSchemaSequence seq = (XmlSchemaSequence) group; /* and an element in it, too */ el = (XmlSchemaElement) seq.getItems().get(0); } else { el = (XmlSchemaElement) schemaType; } return el; }
private void addElementCrossImportsElement(XmlSchema schema, XmlSchemaElement item) { XmlSchemaElement element = item; XmlSchemaUtils.addImportIfNeeded(schema, element.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, element.getSchemaTypeName()); // if there's an anonymous type, it might have element refs in it. XmlSchemaType schemaType = element.getSchemaType(); if (!crossImportsAdded(schema, schemaType)) { addCrossImportsType(schema, schemaType); } }
private void addElementCrossImportsElement(XmlSchema schema, XmlSchemaElement item) { XmlSchemaElement element = item; XmlSchemaUtils.addImportIfNeeded(schema, element.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, element.getSchemaTypeName()); // if there's an anonymous type, it might have element refs in it. XmlSchemaType schemaType = element.getSchemaType(); if (!crossImportsAdded(schema, schemaType)) { addCrossImportsType(schema, schemaType); } }
private void addElementCrossImportsElement(XmlSchema schema, XmlSchemaElement item) { XmlSchemaElement element = (XmlSchemaElement)item; XmlSchemaUtils.addImportIfNeeded(schema, element.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, element.getSchemaTypeName()); // if there's an anonymous type, it might have element refs in it. XmlSchemaType schemaType = element.getSchemaType(); if (!crossImportsAdded(schema, schemaType)) { addCrossImportsType(schema, schemaType); } }
private void addElementCrossImportsElement(XmlSchema schema, XmlSchemaElement item) { XmlSchemaElement element = item; XmlSchemaUtils.addImportIfNeeded(schema, element.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, element.getSchemaTypeName()); // if there's an anonymous type, it might have element refs in it. XmlSchemaType schemaType = element.getSchemaType(); if (!crossImportsAdded(schema, schemaType)) { addCrossImportsType(schema, schemaType); } }
private void addElementCrossImportsElement(XmlSchema schema, XmlSchemaElement item) { XmlSchemaElement element = item; XmlSchemaUtils.addImportIfNeeded(schema, element.getRef().getTargetQName()); XmlSchemaUtils.addImportIfNeeded(schema, element.getSchemaTypeName()); // if there's an anonymous type, it might have element refs in it. XmlSchemaType schemaType = element.getSchemaType(); if (!crossImportsAdded(schema, schemaType)) { addCrossImportsType(schema, schemaType); } }