Java Code Examples for org.apache.ws.commons.schema.XmlSchemaType#getQName()

The following examples show how to use org.apache.ws.commons.schema.XmlSchemaType#getQName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScopedNameVisitor.java    From cxf with Apache License 2.0 6 votes vote down vote up
private static CorbaType getCorbaSchemaType(XmlSchema xmlSchema,
                                                TypeMappingType typeMap,
                                                XmlSchemaType stype,
                                                Scope scopedName) {
    CorbaType ctype = null;
    if (stype.getQName().equals(Constants.XSD_STRING)) {
        ctype = new CorbaType();
        ctype.setName(CorbaConstants.NT_CORBA_STRING.getLocalPart());
        ctype.setQName(CorbaConstants.NT_CORBA_STRING);
        ctype.setType(Constants.XSD_STRING);
    } else {
        QName qname = stype.getQName();
        ctype = findCorbaTypeForSchemaType(typeMap, qname, scopedName);
    }
    return ctype;
}
 
Example 2
Source File: XmlSchemaExtractor.java    From syndesis with Apache License 2.0 5 votes vote down vote up
public XmlSchemaElement extract(QName name, XmlSchemaType type) throws ParserException {

        // find target schema
        final XmlSchema targetSchema = getOrCreateTargetSchema(name.getNamespaceURI());

        // create new element in target schema
        final XmlSchemaElement result = new XmlSchemaElement(targetSchema, true);
        result.setName(name.getLocalPart());

        // set element type to the provided type
        final QName typeQName = type.getQName();
        withNamespace(typeQName.getNamespaceURI(), () -> setTargetTypeQName(typeQName, result::setSchemaTypeName));
        return result;
    }
 
Example 3
Source File: WSDLToCorbaHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
public CorbaType convertSchemaToCorbaType(XmlSchemaType stype,
                                              QName defaultName,
                                              XmlSchemaType parent,
                                              XmlSchemaAnnotation annotation,
                                              boolean anonymous)
    throws Exception {
    CorbaType corbaTypeImpl = null;
    if (!isAddressingNamespace(stype.getQName())) {
        // need to determine if its a primitive type.
        if (stype instanceof XmlSchemaComplexType) {
            corbaTypeImpl = processComplexType((XmlSchemaComplexType)stype,
                                                          defaultName, annotation, anonymous);
        } else if (stype instanceof XmlSchemaSimpleType) {
            corbaTypeImpl = processSimpleType((XmlSchemaSimpleType)stype,
                                              defaultName, anonymous);
        }  else if (xmlSchemaList.getElementByQName(stype.getQName()) != null) {
            XmlSchemaElement el = xmlSchemaList.getElementByQName(stype.getQName());
            //REVISIT, passing ns uri because of a bug in XmlSchema (Bug: WSCOMMONS-69)
            corbaTypeImpl = processElementType(el,
                                               defaultName,
                                               stype.getQName().getNamespaceURI());
        } else {
            throw new Exception("Couldn't convert schema " + stype.getQName() + " to corba type");
        }
    }

    if (corbaTypeImpl != null && !isDuplicate(corbaTypeImpl)) {
        typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
    }

    return corbaTypeImpl;
}
 
Example 4
Source File: ServiceJavascriptBuilder.java    From cxf with Apache License 2.0 5 votes vote down vote up
private String getElementObjectName(ParticleInfo element) {
    XmlSchemaType type = element.getType();

    if (!element.isEmpty()) {
        if (type instanceof XmlSchemaComplexType) {
            return nameManager.getJavascriptName(element.getControllingName());
        }
        return "type " + type.getQName(); // could it be anonymous?
    }
    return "empty element?";
}
 
Example 5
Source File: JavascriptUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
static void unsupportedConstruct(String messageKey, XmlSchemaType subject) {
    Message message = new Message(messageKey, LOG, subject.getQName(),
                                  cleanedUpSchemaSource(subject));
    throw new UnsupportedConstruct(message);
}
 
Example 6
Source File: ServiceJavascriptBuilder.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static void unsupportedConstruct(String messageKey, XmlSchemaType subject) {
    Message message = new Message(messageKey, LOG, subject.getQName(),
                                  cleanedUpSchemaSource(subject));
    LOG.severe(message.toString());
    throw new UnsupportedConstruct(message);
}